Use TypeReference consistently in hints writer
Closes gh-28606
This commit is contained in:
@@ -63,6 +63,16 @@ public class ProxyHintsWriterTests {
|
||||
]""", hints);
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldWriteInnerClass() throws JSONException {
|
||||
ProxyHints hints = new ProxyHints();
|
||||
hints.registerJdkProxy(Inner.class);
|
||||
assertEquals("""
|
||||
[
|
||||
{ "interfaces": [ "org.springframework.aot.nativex.ProxyHintsWriterTests$Inner" ] }
|
||||
]""", hints);
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldWriteCondition() throws JSONException {
|
||||
ProxyHints hints = new ProxyHints();
|
||||
@@ -81,4 +91,8 @@ public class ProxyHintsWriterTests {
|
||||
JSONAssert.assertEquals(expectedString, out.toString(), JSONCompareMode.NON_EXTENSIBLE);
|
||||
}
|
||||
|
||||
interface Inner {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -158,6 +158,27 @@ public class ReflectionHintsWriterTests {
|
||||
""", hints);
|
||||
}
|
||||
|
||||
@Test
|
||||
void methodWithInnerClassParameter() throws JSONException {
|
||||
ReflectionHints hints = new ReflectionHints();
|
||||
hints.registerType(Integer.class, builder -> builder.withMethod("test", List.of(TypeReference.of(Inner.class)),
|
||||
b -> b.withMode(ExecutableMode.INVOKE)));
|
||||
|
||||
assertEquals("""
|
||||
[
|
||||
{
|
||||
"name": "java.lang.Integer",
|
||||
"methods": [
|
||||
{
|
||||
"name": "test",
|
||||
"parameterTypes": ["org.springframework.aot.nativex.ReflectionHintsWriterTests$Inner"]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
""", hints);
|
||||
}
|
||||
|
||||
@Test
|
||||
void methodAndQueriedMethods() throws JSONException {
|
||||
ReflectionHints hints = new ReflectionHints();
|
||||
@@ -194,4 +215,9 @@ public class ReflectionHintsWriterTests {
|
||||
JSONAssert.assertEquals(expectedString, out.toString(), JSONCompareMode.NON_EXTENSIBLE);
|
||||
}
|
||||
|
||||
|
||||
static class Inner {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user