Improve ConstantFieldFeature compatibility
This commit makes ConstantFieldFeature compatible with GraalVM 22.2 while retaining GraalVM 22.1 compatibility. See gh-28624
This commit is contained in:
parent
279f55fdfa
commit
b64edebadc
|
@ -41,9 +41,9 @@ class ConstantFieldFeature implements Feature {
|
||||||
DebugContext debug = access.getDebugContext();
|
DebugContext debug = access.getDebugContext();
|
||||||
try (DebugContext.Scope scope = debug.scope("ConstantFieldFeature.duringSetup")) {
|
try (DebugContext.Scope scope = debug.scope("ConstantFieldFeature.duringSetup")) {
|
||||||
debug.log("Installing constant field substitution processor : " + scope);
|
debug.log("Installing constant field substitution processor : " + scope);
|
||||||
ClassLoader applicationClassLoader = access.getApplicationClassLoader();
|
ClassLoader classLoader = ConstantFieldFeature.class.getClassLoader();
|
||||||
ConstantFieldSubstitutionProcessor substitutionProcessor =
|
ConstantFieldSubstitutionProcessor substitutionProcessor =
|
||||||
new ConstantFieldSubstitutionProcessor(debug, applicationClassLoader);
|
new ConstantFieldSubstitutionProcessor(debug, classLoader);
|
||||||
access.registerSubstitutionProcessor(substitutionProcessor);
|
access.registerSubstitutionProcessor(substitutionProcessor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@ package org.springframework.aot.graalvm;
|
||||||
|
|
||||||
import java.lang.annotation.Annotation;
|
import java.lang.annotation.Annotation;
|
||||||
|
|
||||||
|
import com.oracle.graal.pointsto.infrastructure.WrappedElement;
|
||||||
import com.oracle.svm.core.meta.ReadableJavaField;
|
import com.oracle.svm.core.meta.ReadableJavaField;
|
||||||
import jdk.vm.ci.meta.JavaConstant;
|
import jdk.vm.ci.meta.JavaConstant;
|
||||||
import jdk.vm.ci.meta.JavaType;
|
import jdk.vm.ci.meta.JavaType;
|
||||||
|
@ -31,7 +32,7 @@ import jdk.vm.ci.meta.ResolvedJavaType;
|
||||||
* @author Phillip Webb
|
* @author Phillip Webb
|
||||||
* @since 6.0
|
* @since 6.0
|
||||||
*/
|
*/
|
||||||
class ConstantReadableJavaField implements ReadableJavaField {
|
class ConstantReadableJavaField implements ReadableJavaField, WrappedElement {
|
||||||
|
|
||||||
private final ResolvedJavaField original;
|
private final ResolvedJavaField original;
|
||||||
|
|
||||||
|
@ -109,4 +110,8 @@ class ConstantReadableJavaField implements ReadableJavaField {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object getWrapped() {
|
||||||
|
return this.original;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue