From fd06f7ab6dd0561da3a347b9776589dcff6c962f Mon Sep 17 00:00:00 2001 From: Tomas Zezula Date: Tue, 17 Dec 2024 11:36:31 +0100 Subject: [PATCH] [GR-60379] Make InternalResourceCache#useInternalResources compilation constant. (cherry picked from commit 42f3bc765cc0eb062cbd362b8070020f1c4f51dd) --- .../truffle/polyglot/InternalResourceCache.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/truffle/src/com.oracle.truffle.polyglot/src/com/oracle/truffle/polyglot/InternalResourceCache.java b/truffle/src/com.oracle.truffle.polyglot/src/com/oracle/truffle/polyglot/InternalResourceCache.java index b136e2e71a19..43ba1625c6c7 100644 --- a/truffle/src/com.oracle.truffle.polyglot/src/com/oracle/truffle/polyglot/InternalResourceCache.java +++ b/truffle/src/com.oracle.truffle.polyglot/src/com/oracle/truffle/polyglot/InternalResourceCache.java @@ -95,10 +95,10 @@ final class InternalResourceCache { /** * Recomputed before the analyses by a substitution in the {@code TruffleBaseFeature} based on - * the {@code CopyLanguageResources} option value. The field must not be declared as - * {@code final} to make the substitution function correctly. + * the {@code CopyLanguageResources} option value. The field must not qualify as a Java language + * constant (as defined in JLS 15.28) to prevent the Java compiler from inlining its value. */ - private static boolean useInternalResources = true; + private static final boolean useInternalResources = Boolean.TRUE.booleanValue(); private static boolean useExternalDirectoryInNativeImage = true; private final String id; @@ -292,8 +292,9 @@ private static String sanitize(String pathElement) { } /** - * Returns true if internal resources are enabled. Internal resources can be disabled in the - * native image using {-H:-CopyLanguageResources} option. + * Returns true if internal resources are enabled. Internal resources are disabled in the native + * image when both the copying and inclusion of language resources are turned off. This can be + * achieved by using the {@code -H:-IncludeLanguageResources} option. */ public static boolean usesInternalResources() { return useInternalResources;