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 9c29979a97c4e..36abe291a5974 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 @@ -659,7 +659,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"); + } + + Field consParamClassFieldFinal = consParamClassField; /* * The returned lambda captures the value of the Provider.knownEngines map retrieved above @@ -684,10 +692,10 @@ 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("constructorParameterClassName")) { + return loader.findClass((String) consParamClassFieldFinal.get(engineDescription)).get(); } + return (Class) consParamClassFieldFinal.get(engineDescription); } catch (IllegalAccessException e) { VMError.shouldNotReachHere(e); }