Skip to content

Commit

Permalink
Include Classes Listed in Generator Map
Browse files Browse the repository at this point in the history
This allows testing of classes that are serializable,
but do not use Security's serialVersionUID.

Issue gh-16276
  • Loading branch information
jzheaux committed Dec 13, 2024
1 parent 82cc3ad commit f7b9b72
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -298,9 +298,13 @@ static Stream<Class<?>> getClassesToSerialize() throws Exception {
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);
}
}
Expand Down

0 comments on commit f7b9b72

Please sign in to comment.