Skip to content

Commit

Permalink
Improve ConstantFieldFeature compatibility
Browse files Browse the repository at this point in the history
This commit makes ConstantFieldFeature
compatible with GraalVM 22.2 while retaining
GraalVM 22.1 compatibility.

See spring-projectsgh-28624
  • Loading branch information
sdeleuze committed Jul 4, 2022
1 parent 279f55f commit b64edeb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ private void duringSetup(DuringSetupAccessImpl access) {
DebugContext debug = access.getDebugContext();
try (DebugContext.Scope scope = debug.scope("ConstantFieldFeature.duringSetup")) {
debug.log("Installing constant field substitution processor : " + scope);
ClassLoader applicationClassLoader = access.getApplicationClassLoader();
ClassLoader classLoader = ConstantFieldFeature.class.getClassLoader();
ConstantFieldSubstitutionProcessor substitutionProcessor =
new ConstantFieldSubstitutionProcessor(debug, applicationClassLoader);
new ConstantFieldSubstitutionProcessor(debug, classLoader);
access.registerSubstitutionProcessor(substitutionProcessor);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import java.lang.annotation.Annotation;

import com.oracle.graal.pointsto.infrastructure.WrappedElement;
import com.oracle.svm.core.meta.ReadableJavaField;
import jdk.vm.ci.meta.JavaConstant;
import jdk.vm.ci.meta.JavaType;
Expand All @@ -31,7 +32,7 @@
* @author Phillip Webb
* @since 6.0
*/
class ConstantReadableJavaField implements ReadableJavaField {
class ConstantReadableJavaField implements ReadableJavaField, WrappedElement {

private final ResolvedJavaField original;

Expand Down Expand Up @@ -109,4 +110,8 @@ public boolean injectFinalForRuntimeCompilation() {
return true;
}

@Override
public Object getWrapped() {
return this.original;
}
}

0 comments on commit b64edeb

Please sign in to comment.