1
1
/*
2
- * Copyright 2002-2022 the original author or authors.
2
+ * Copyright 2002-2023 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -274,19 +274,6 @@ public ExecutableHintPredicate<T> invoke() {
274
274
return this ;
275
275
}
276
276
277
- @ Override
278
- public boolean test (RuntimeHints runtimeHints ) {
279
- return (new TypeHintPredicate (TypeReference .of (this .executable .getDeclaringClass ()))
280
- .withAnyMemberCategory (getPublicMemberCategories ())
281
- .and (hints -> Modifier .isPublic (this .executable .getModifiers ())))
282
- .or (new TypeHintPredicate (TypeReference .of (this .executable .getDeclaringClass ())).withAnyMemberCategory (getDeclaredMemberCategories ()))
283
- .or (exactMatch ()).test (runtimeHints );
284
- }
285
-
286
- abstract MemberCategory [] getPublicMemberCategories ();
287
-
288
- abstract MemberCategory [] getDeclaredMemberCategories ();
289
-
290
277
abstract Predicate <RuntimeHints > exactMatch ();
291
278
292
279
/**
@@ -309,6 +296,14 @@ public static class ConstructorHintPredicate extends ExecutableHintPredicate<Con
309
296
}
310
297
311
298
@ Override
299
+ public boolean test (RuntimeHints runtimeHints ) {
300
+ return (new TypeHintPredicate (TypeReference .of (this .executable .getDeclaringClass ()))
301
+ .withAnyMemberCategory (getPublicMemberCategories ())
302
+ .and (hints -> Modifier .isPublic (this .executable .getModifiers ())))
303
+ .or (new TypeHintPredicate (TypeReference .of (this .executable .getDeclaringClass ())).withAnyMemberCategory (getDeclaredMemberCategories ()))
304
+ .or (exactMatch ()).test (runtimeHints );
305
+ }
306
+
312
307
MemberCategory [] getPublicMemberCategories () {
313
308
if (this .executableMode == ExecutableMode .INTROSPECT ) {
314
309
return new MemberCategory [] { MemberCategory .INTROSPECT_PUBLIC_CONSTRUCTORS ,
@@ -317,7 +312,6 @@ MemberCategory[] getPublicMemberCategories() {
317
312
return new MemberCategory [] { MemberCategory .INVOKE_PUBLIC_CONSTRUCTORS };
318
313
}
319
314
320
- @ Override
321
315
MemberCategory [] getDeclaredMemberCategories () {
322
316
if (this .executableMode == ExecutableMode .INTROSPECT ) {
323
317
return new MemberCategory [] { MemberCategory .INTROSPECT_DECLARED_CONSTRUCTORS ,
@@ -344,6 +338,16 @@ public static class MethodHintPredicate extends ExecutableHintPredicate<Method>
344
338
}
345
339
346
340
@ Override
341
+ public boolean test (RuntimeHints runtimeHints ) {
342
+ return (new TypeHintPredicate (TypeReference .of (this .executable .getDeclaringClass ()))
343
+ .withAnyMemberCategory (getPublicMemberCategories ())
344
+ .and (hints -> Modifier .isPublic (this .executable .getModifiers ())))
345
+ .or (new TypeHintPredicate (TypeReference .of (this .executable .getDeclaringClass ()))
346
+ .withAnyMemberCategory (getDeclaredMemberCategories ())
347
+ .and (hints -> !Modifier .isPublic (this .executable .getModifiers ())))
348
+ .or (exactMatch ()).test (runtimeHints );
349
+ }
350
+
347
351
MemberCategory [] getPublicMemberCategories () {
348
352
if (this .executableMode == ExecutableMode .INTROSPECT ) {
349
353
return new MemberCategory [] { MemberCategory .INTROSPECT_PUBLIC_METHODS ,
@@ -352,7 +356,6 @@ MemberCategory[] getPublicMemberCategories() {
352
356
return new MemberCategory [] { MemberCategory .INVOKE_PUBLIC_METHODS };
353
357
}
354
358
355
- @ Override
356
359
MemberCategory [] getDeclaredMemberCategories () {
357
360
358
361
if (this .executableMode == ExecutableMode .INTROSPECT ) {
@@ -392,8 +395,7 @@ public boolean test(RuntimeHints runtimeHints) {
392
395
393
396
private boolean memberCategoryMatch (TypeHint typeHint ) {
394
397
if (Modifier .isPublic (this .field .getModifiers ())) {
395
- return typeHint .getMemberCategories ().contains (MemberCategory .PUBLIC_FIELDS ) ||
396
- typeHint .getMemberCategories ().contains (MemberCategory .DECLARED_FIELDS );
398
+ return typeHint .getMemberCategories ().contains (MemberCategory .PUBLIC_FIELDS );
397
399
}
398
400
else {
399
401
return typeHint .getMemberCategories ().contains (MemberCategory .DECLARED_FIELDS );
0 commit comments