3838import static com .oracle .svm .core .code .RuntimeMetadataDecoderImpl .ALL_RECORD_COMPONENTS_FLAG ;
3939import static com .oracle .svm .core .code .RuntimeMetadataDecoderImpl .ALL_SIGNERS_FLAG ;
4040import static com .oracle .svm .core .configure .ConfigurationFiles .Options .TreatAllTypeReachableConditionsAsTypeReached ;
41+ import static org .graalvm .nativeimage .dynamicaccess .AccessCondition .unconditional ;
4142
4243import java .lang .reflect .AnnotatedElement ;
4344import java .lang .reflect .Constructor ;
@@ -651,7 +652,7 @@ private void registerField(AccessCondition cnd, boolean queriedOnly, Field refle
651652 }
652653
653654 if (declaringClass .isAnnotation ()) {
654- processAnnotationField (cnd , reflectField );
655+ processAnnotationField (reflectField );
655656 }
656657 }
657658
@@ -692,12 +693,7 @@ private void processAnnotationMethod(boolean queriedOnly, Method method) {
692693 Class <?> annotationClass = method .getDeclaringClass ();
693694 Class <?> proxyClass = Proxy .getProxyClass (annotationClass .getClassLoader (), annotationClass );
694695 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 ()));
701697 } catch (NoSuchMethodException e ) {
702698 /*
703699 * 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) {
706702 }
707703
708704 @ SuppressWarnings ("deprecation" )
709- private void processAnnotationField (AccessCondition cnd , Field field ) {
705+ private void processAnnotationField (Field field ) {
710706 Class <?> annotationClass = field .getDeclaringClass ();
711707 Class <?> proxyClass = Proxy .getProxyClass (annotationClass .getClassLoader (), annotationClass );
712708 try {
713- register (cnd , false , proxyClass .getDeclaredField (field .getName ()));
709+ register (unconditional () , false , proxyClass .getDeclaredField (field .getName ()));
714710 } catch (NoSuchFieldException e ) {
715711 /*
716712 * 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) {
996992 private void registerTypesForRecordComponent (RecordComponent recordComponent ) {
997993 Method accessorOrNull = recordComponent .getAccessor ();
998994 if (accessorOrNull != null ) {
999- register (AccessCondition . unconditional (), true , accessorOrNull );
995+ register (unconditional (), true , accessorOrNull );
1000996 }
1001997 registerTypesForAnnotations (recordComponent );
1002998 registerTypesForTypeAnnotations (recordComponent );
@@ -1272,7 +1268,7 @@ public void registerHeapReflectionField(Field reflectField, ScanReason reason) {
12721268 if (!reflectivityFilter .shouldExclude (reflectField )) {
12731269 registerTypesForField (analysisField , reflectField , false );
12741270 if (analysisField .getDeclaringClass ().isAnnotation ()) {
1275- processAnnotationField (AccessCondition . unconditional (), reflectField );
1271+ processAnnotationField (reflectField );
12761272 }
12771273 }
12781274 }
@@ -1398,7 +1394,7 @@ private static int countConditionalElements(Map<? extends AnalysisElement, ? ext
13981394
13991395 public static class TestBackdoor {
14001396 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 ));
14021398 }
14031399 }
14041400
0 commit comments