Include Classes Listed in Generator Map

This allows testing of classes that are serializable,
but do not use Security's serialVersionUID.

Issue gh-16276
This commit is contained in:
Josh Cummings 2024-12-12 13:19:51 -07:00
parent 82cc3ad5ec
commit f7b9b7228f
No known key found for this signature in database
GPG Key ID: A306A51F43B8E5A5
1 changed files with 5 additions and 1 deletions

View File

@ -298,9 +298,13 @@ class SpringSecurityCoreVersionSerializableTests {
for (BeanDefinition component : components) {
Class<?> clazz = Class.forName(component.getBeanClassName());
boolean isAbstract = Modifier.isAbstract(clazz.getModifiers());
if (isAbstract) {
continue;
}
boolean matchesExpectedSerialVersion = ObjectStreamClass.lookup(clazz)
.getSerialVersionUID() == securitySerialVersionUid;
if (!isAbstract && matchesExpectedSerialVersion) {
boolean isUnderTest = generatorByClassName.containsKey(clazz);
if (matchesExpectedSerialVersion || isUnderTest) {
classes.add(clazz);
}
}