Add the necessary hints for use of Cglib proxies

This commit expands GeneratedClassHandler to allow invocation of
declared fields and methods. Generated proxies have a number of
internal fields and methods that are invoked via reflection.

See gh-28954
This commit is contained in:
Stephane Nicoll
2022-08-12 16:27:10 +02:00
parent 7c2453c373
commit 3086d90e7d
2 changed files with 5 additions and 2 deletions

View File

@@ -54,7 +54,8 @@ class GeneratedClassHandlerTests {
String className = "com.example.Test$$Proxy$$1";
this.handler.accept(className, TEST_CONTENT);
assertThat(RuntimeHintsPredicates.reflection().onType(TypeReference.of(className))
.withMemberCategory(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS))
.withMemberCategories(MemberCategory.INVOKE_DECLARED_CONSTRUCTORS,
MemberCategory.INVOKE_DECLARED_METHODS, MemberCategory.DECLARED_FIELDS))
.accepts(this.generationContext.getRuntimeHints());
}