From f7b9b7228f70df58a960b2d6029d6c117fe6a465 Mon Sep 17 00:00:00 2001 From: Josh Cummings <3627351+jzheaux@users.noreply.github.com> Date: Thu, 12 Dec 2024 13:19:51 -0700 Subject: [PATCH] Include Classes Listed in Generator Map This allows testing of classes that are serializable, but do not use Security's serialVersionUID. Issue gh-16276 --- .../SpringSecurityCoreVersionSerializableTests.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/config/src/test/java/org/springframework/security/SpringSecurityCoreVersionSerializableTests.java b/config/src/test/java/org/springframework/security/SpringSecurityCoreVersionSerializableTests.java index 557f4d879e..de2eb382d7 100644 --- a/config/src/test/java/org/springframework/security/SpringSecurityCoreVersionSerializableTests.java +++ b/config/src/test/java/org/springframework/security/SpringSecurityCoreVersionSerializableTests.java @@ -298,9 +298,13 @@ static Stream> 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); } }