mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-10-02 12:39:14 +00:00
Switch serializable flag to primitive boolean
This commit improves the change made to TypeHint to use a primitive boolean for the serializable flag. See gh-36379
This commit is contained in:
@@ -84,11 +84,11 @@ class ProxyHintsTests {
|
||||
void registerJdkProxyWithJavaSerialization() {
|
||||
this.proxyHints.registerJdkProxy(hint -> {
|
||||
hint.proxiedInterfaces(TypeReference.of("com.example.Test"));
|
||||
hint.javaSerialization(true);
|
||||
hint.withJavaSerialization(true);
|
||||
});
|
||||
assertThat(this.proxyHints.jdkProxyHints()).singleElement().satisfies(hint -> {
|
||||
assertThat(hint.getProxiedInterfaces()).containsExactly(TypeReference.of("com.example.Test"));
|
||||
assertThat(hint.getSerializable()).isTrue();
|
||||
assertThat(hint.hasJavaSerialization()).isTrue();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
+19
-3
@@ -208,7 +208,7 @@ class RuntimeHintsWriterTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void serializationEnabled() throws JSONException {
|
||||
void javaSerializationEnabled() throws JSONException {
|
||||
RuntimeHints hints = new RuntimeHints();
|
||||
hints.reflection().registerType(Integer.class, builder -> builder.withJavaSerialization(true));
|
||||
|
||||
@@ -224,6 +224,22 @@ class RuntimeHintsWriterTests {
|
||||
""", hints);
|
||||
}
|
||||
|
||||
@Test
|
||||
void javaSerializationDisabled() throws JSONException {
|
||||
RuntimeHints hints = new RuntimeHints();
|
||||
hints.reflection().registerType(Integer.class, builder -> builder.withJavaSerialization(false));
|
||||
|
||||
assertEquals("""
|
||||
{
|
||||
"reflection": [
|
||||
{
|
||||
"type": "java.lang.Integer"
|
||||
}
|
||||
]
|
||||
}
|
||||
""", hints);
|
||||
}
|
||||
|
||||
@Test
|
||||
void ignoreLambda() throws JSONException {
|
||||
Runnable anonymousRunnable = () -> {};
|
||||
@@ -658,11 +674,11 @@ class RuntimeHintsWriterTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldWriteSerialization() throws JSONException {
|
||||
void shouldWriteSerializable() throws JSONException {
|
||||
RuntimeHints hints = new RuntimeHints();
|
||||
hints.proxies().registerJdkProxy(hint -> {
|
||||
hint.proxiedInterfaces(Function.class);
|
||||
hint.javaSerialization(true);
|
||||
hint.withJavaSerialization(true);
|
||||
});
|
||||
assertEquals("""
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user