Skip to content

Commit f7b9b72

Browse files
committed
Include Classes Listed in Generator Map
This allows testing of classes that are serializable, but do not use Security's serialVersionUID. Issue gh-16276
1 parent 82cc3ad commit f7b9b72

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

config/src/test/java/org/springframework/security/SpringSecurityCoreVersionSerializableTests.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,9 +298,13 @@ static Stream<Class<?>> getClassesToSerialize() throws Exception {
298298
for (BeanDefinition component : components) {
299299
Class<?> clazz = Class.forName(component.getBeanClassName());
300300
boolean isAbstract = Modifier.isAbstract(clazz.getModifiers());
301+
if (isAbstract) {
302+
continue;
303+
}
301304
boolean matchesExpectedSerialVersion = ObjectStreamClass.lookup(clazz)
302305
.getSerialVersionUID() == securitySerialVersionUid;
303-
if (!isAbstract && matchesExpectedSerialVersion) {
306+
boolean isUnderTest = generatorByClassName.containsKey(clazz);
307+
if (matchesExpectedSerialVersion || isUnderTest) {
304308
classes.add(clazz);
305309
}
306310
}

0 commit comments

Comments
 (0)