diff --git a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/SecurityServicesFeature.java b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/SecurityServicesFeature.java index 56e4790d7fbb..90e40bee71bd 100644 --- a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/SecurityServicesFeature.java +++ b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/SecurityServicesFeature.java @@ -675,7 +675,15 @@ private static boolean isValid(Service s) { private static Function> getConstructorParameterClassAccessor(ImageClassLoader loader) { Map knownEngines = ReflectionUtil.readStaticField(Provider.class, "knownEngines"); Class clazz = loader.findClassOrFail("java.security.Provider$EngineDescription"); - Field consParamClassNameField = ReflectionUtil.lookupField(clazz, "constructorParameterClassName"); + Field consParamClassField; + + try { + consParamClassField = ReflectionUtil.lookupField(clazz, "constructorParameterClassName"); + } catch (ReflectionUtil.ReflectionUtilError e) { + consParamClassField = ReflectionUtil.lookupField(clazz, "constructorParameterClass"); + } + + final Field consParamClassFieldFinal = consParamClassField; /* * The returned lambda captures the value of the Provider.knownEngines map retrieved above @@ -700,9 +708,12 @@ private static Function> getConstructorParameterClassAccessor(I if (engineDescription == null) { return null; } - String constrParamClassName = (String) consParamClassNameField.get(engineDescription); - if (constrParamClassName != null) { - return loader.findClass(constrParamClassName).get(); + if (consParamClassFieldFinal.getName().equals("constructorParameterClass")) { + return (Class) consParamClassFieldFinal.get(engineDescription); + } + String constructorParameterClassName = (String) consParamClassFieldFinal.get(engineDescription); + if (constructorParameterClassName != null) { + return loader.findClass(constructorParameterClassName).get(); } } catch (IllegalAccessException e) { VMError.shouldNotReachHere(e);