38
38
import static com .oracle .svm .core .code .RuntimeMetadataDecoderImpl .ALL_RECORD_COMPONENTS_FLAG ;
39
39
import static com .oracle .svm .core .code .RuntimeMetadataDecoderImpl .ALL_SIGNERS_FLAG ;
40
40
import static com .oracle .svm .core .configure .ConfigurationFiles .Options .TreatAllTypeReachableConditionsAsTypeReached ;
41
+ import static org .graalvm .nativeimage .dynamicaccess .AccessCondition .unconditional ;
41
42
42
43
import java .lang .reflect .AnnotatedElement ;
43
44
import java .lang .reflect .Constructor ;
@@ -651,7 +652,7 @@ private void registerField(AccessCondition cnd, boolean queriedOnly, Field refle
651
652
}
652
653
653
654
if (declaringClass .isAnnotation ()) {
654
- processAnnotationField (cnd , reflectField );
655
+ processAnnotationField (reflectField );
655
656
}
656
657
}
657
658
@@ -692,12 +693,7 @@ private void processAnnotationMethod(boolean queriedOnly, Method method) {
692
693
Class <?> annotationClass = method .getDeclaringClass ();
693
694
Class <?> proxyClass = Proxy .getProxyClass (annotationClass .getClassLoader (), annotationClass );
694
695
try {
695
- /*
696
- * build-time condition as it is registered during analysis GR-62516, this should be
697
- * deleted
698
- */
699
- var condition = TypeReachabilityCondition .create (proxyClass , false );
700
- register (condition , queriedOnly , proxyClass .getDeclaredMethod (method .getName (), method .getParameterTypes ()));
696
+ register (unconditional (), queriedOnly , proxyClass .getDeclaredMethod (method .getName (), method .getParameterTypes ()));
701
697
} catch (NoSuchMethodException e ) {
702
698
/*
703
699
* The annotation member is not present in the proxy class so we don't add it.
@@ -706,11 +702,11 @@ private void processAnnotationMethod(boolean queriedOnly, Method method) {
706
702
}
707
703
708
704
@ SuppressWarnings ("deprecation" )
709
- private void processAnnotationField (AccessCondition cnd , Field field ) {
705
+ private void processAnnotationField (Field field ) {
710
706
Class <?> annotationClass = field .getDeclaringClass ();
711
707
Class <?> proxyClass = Proxy .getProxyClass (annotationClass .getClassLoader (), annotationClass );
712
708
try {
713
- register (cnd , false , proxyClass .getDeclaredField (field .getName ()));
709
+ register (unconditional () , false , proxyClass .getDeclaredField (field .getName ()));
714
710
} catch (NoSuchFieldException e ) {
715
711
/*
716
712
* The annotation member is not present in the proxy class so we don't add it.
@@ -996,7 +992,7 @@ private void registerTypesForGenericSignature(Type type, int dimension) {
996
992
private void registerTypesForRecordComponent (RecordComponent recordComponent ) {
997
993
Method accessorOrNull = recordComponent .getAccessor ();
998
994
if (accessorOrNull != null ) {
999
- register (AccessCondition . unconditional (), true , accessorOrNull );
995
+ register (unconditional (), true , accessorOrNull );
1000
996
}
1001
997
registerTypesForAnnotations (recordComponent );
1002
998
registerTypesForTypeAnnotations (recordComponent );
@@ -1272,7 +1268,7 @@ public void registerHeapReflectionField(Field reflectField, ScanReason reason) {
1272
1268
if (!reflectivityFilter .shouldExclude (reflectField )) {
1273
1269
registerTypesForField (analysisField , reflectField , false );
1274
1270
if (analysisField .getDeclaringClass ().isAnnotation ()) {
1275
- processAnnotationField (AccessCondition . unconditional (), reflectField );
1271
+ processAnnotationField (reflectField );
1276
1272
}
1277
1273
}
1278
1274
}
@@ -1398,7 +1394,7 @@ private static int countConditionalElements(Map<? extends AnalysisElement, ? ext
1398
1394
1399
1395
public static class TestBackdoor {
1400
1396
public static void registerField (ReflectionDataBuilder reflectionDataBuilder , boolean queriedOnly , Field field ) {
1401
- reflectionDataBuilder .runConditionalInAnalysisTask (AccessCondition . unconditional (), (cnd ) -> reflectionDataBuilder .registerField (cnd , queriedOnly , field ));
1397
+ reflectionDataBuilder .runConditionalInAnalysisTask (unconditional (), (cnd ) -> reflectionDataBuilder .registerField (cnd , queriedOnly , field ));
1402
1398
}
1403
1399
}
1404
1400
0 commit comments