Migrate hint registration to shortcuts
Migrate code to make use of the `MemberCategory` and `FieldMode` shortcuts. See gh-29011
This commit is contained in:
@@ -33,7 +33,7 @@ class ReflectionInvocationsTests {
|
||||
@Test
|
||||
void sampleTest() {
|
||||
RuntimeHints hints = new RuntimeHints();
|
||||
hints.reflection().registerType(String.class, hint -> hint.withMembers(MemberCategory.INTROSPECT_PUBLIC_METHODS));
|
||||
hints.reflection().registerType(String.class, MemberCategory.INTROSPECT_PUBLIC_METHODS);
|
||||
|
||||
RuntimeHintsInvocations invocations = RuntimeHintsRecorder.record(() -> {
|
||||
SampleReflection sample = new SampleReflection();
|
||||
@@ -45,8 +45,8 @@ class ReflectionInvocationsTests {
|
||||
@Test
|
||||
void multipleCallsTest() {
|
||||
RuntimeHints hints = new RuntimeHints();
|
||||
hints.reflection().registerType(String.class, hint -> hint.withMembers(MemberCategory.INTROSPECT_PUBLIC_METHODS));
|
||||
hints.reflection().registerType(Integer.class, hint -> hint.withMembers(MemberCategory.INTROSPECT_PUBLIC_METHODS));
|
||||
hints.reflection().registerType(String.class, MemberCategory.INTROSPECT_PUBLIC_METHODS);
|
||||
hints.reflection().registerType(Integer.class,MemberCategory.INTROSPECT_PUBLIC_METHODS);
|
||||
RuntimeHintsInvocations invocations = RuntimeHintsRecorder.record(() -> {
|
||||
SampleReflection sample = new SampleReflection();
|
||||
sample.multipleCalls(); // does Method[] methods = String.class.getMethods(); methods = Integer.class.getMethods();
|
||||
|
||||
Reference in New Issue
Block a user