Skip serialization of potentially non-serializable cached state

Closes gh-36346
This commit is contained in:
Juergen Hoeller
2026-02-17 22:13:57 +01:00
parent 9b10bb5e08
commit 22bd8bd704
2 changed files with 20 additions and 4 deletions
@@ -123,13 +123,13 @@ public class ResolvableType implements Serializable {
private @Nullable Class<?> resolved;
private volatile @Nullable ResolvableType superType;
private transient volatile @Nullable ResolvableType superType;
private volatile ResolvableType @Nullable [] interfaces;
private transient volatile ResolvableType @Nullable [] interfaces;
private volatile ResolvableType @Nullable [] generics;
private transient volatile ResolvableType @Nullable [] generics;
private volatile @Nullable Boolean unresolvableGenerics;
private transient volatile @Nullable Boolean unresolvableGenerics;
/**
@@ -1335,6 +1335,22 @@ class ResolvableTypeTests {
assertThat(deserializedNone).isSameAs(ResolvableType.NONE);
}
@Test
void serializeWithCachedState() throws Exception {
ResolvableType type = ResolvableType.forClass(List.class);
testSerialization(type);
type.getSuperType();
type.getInterfaces();
type.getGenerics();
type.hasUnresolvableGenerics();
testSerialization(type);
type.getSuperType();
type.getInterfaces();
type.getGenerics();
type.hasUnresolvableGenerics();
testSerialization(type);
}
@Test
void canResolveVoid() {
ResolvableType type = ResolvableType.forClass(void.class);