From c06224e4d7172e676db3001bd47611d260e7f169 Mon Sep 17 00:00:00 2001 From: Foivos Zakkak Date: Mon, 5 Sep 2022 13:03:38 +0300 Subject: [PATCH] Drop support for "legacy" (pre 21.1) localization feature The minimum supported GraalVM version is 21.3 --- .../steps/NativeImageFeatureStep.java | 27 ++++--------------- 1 file changed, 5 insertions(+), 22 deletions(-) diff --git a/core/deployment/src/main/java/io/quarkus/deployment/steps/NativeImageFeatureStep.java b/core/deployment/src/main/java/io/quarkus/deployment/steps/NativeImageFeatureStep.java index 479eab772e8ad..99813c687a389 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/steps/NativeImageFeatureStep.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/steps/NativeImageFeatureStep.java @@ -98,7 +98,6 @@ public class NativeImageFeatureStep { static final String BEFORE_ANALYSIS_ACCESS = Feature.BeforeAnalysisAccess.class.getName(); static final String DURING_SETUP_ACCESS = Feature.DuringSetupAccess.class.getName(); static final String DYNAMIC_PROXY_REGISTRY = "com.oracle.svm.core.jdk.proxy.DynamicProxyRegistry"; - static final String LEGACY_LOCALIZATION_FEATURE = "com.oracle.svm.core.jdk.LocalizationFeature"; static final String LOCALIZATION_FEATURE = "com.oracle.svm.core.jdk.localization.LocalizationFeature"; public static final MethodDescriptor WEAK_REFLECTION_REGISTRATION = MethodDescriptor.ofMethod(WeakReflection.class, "register", void.class, Feature.BeforeAnalysisAccess.class, Class.class, boolean.class, boolean.class, @@ -353,27 +352,11 @@ public void write(String s, byte[] bytes) { new JPMSExportBuildItem("org.graalvm.nativeimage.builder", "com.oracle.svm.core.jdk.localization", GraalVM.Version.VERSION_22_1_0)); - AssignableResultHandle registerMethod = overallCatch.createVariable(Method.class); - AssignableResultHandle locClass = overallCatch.createVariable(Class.class); - TryBlock locTryBlock = overallCatch.tryBlock(); - ResultHandle legacyLocClass = locTryBlock.loadClassFromTCCL(LEGACY_LOCALIZATION_FEATURE); - locTryBlock.assign(locClass, legacyLocClass); - - ResultHandle legacyParams = locTryBlock.marshalAsArray(Class.class, locTryBlock.loadClassFromTCCL(String.class)); - ResultHandle legacyRegisterMethod = locTryBlock.invokeVirtualMethod( - ofMethod(Class.class, "getDeclaredMethod", Method.class, String.class, Class[].class), legacyLocClass, - locTryBlock.load("addBundleToCache"), legacyParams); - locTryBlock.assign(registerMethod, legacyRegisterMethod); - - CatchBlockCreator locCatchBlock = locTryBlock.addCatch(ClassNotFoundException.class); - ResultHandle newLocClass = locCatchBlock.loadClassFromTCCL(LOCALIZATION_FEATURE); - locCatchBlock.assign(locClass, newLocClass); - - ResultHandle newParams = locCatchBlock.marshalAsArray(Class.class, locCatchBlock.loadClassFromTCCL(String.class)); - ResultHandle newRegisterMethod = locCatchBlock.invokeVirtualMethod( - ofMethod(Class.class, "getDeclaredMethod", Method.class, String.class, Class[].class), newLocClass, - locCatchBlock.load("prepareBundle"), newParams); - locCatchBlock.assign(registerMethod, newRegisterMethod); + ResultHandle locClass = overallCatch.loadClassFromTCCL(LOCALIZATION_FEATURE); + ResultHandle newParams = overallCatch.marshalAsArray(Class.class, overallCatch.loadClassFromTCCL(String.class)); + ResultHandle registerMethod = overallCatch.invokeVirtualMethod( + ofMethod(Class.class, "getDeclaredMethod", Method.class, String.class, Class[].class), locClass, + overallCatch.load("prepareBundle"), newParams); overallCatch.invokeVirtualMethod(ofMethod(AccessibleObject.class, "setAccessible", void.class, boolean.class), registerMethod, overallCatch.load(true));