Skip to content

Commit 5c5f58e

Browse files
tzezulajormundur00
authored andcommitted
[GR-60379] Make InternalResourceCache#useInternalResources compilation constant.
1 parent f6da21f commit 5c5f58e

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

truffle/src/com.oracle.truffle.polyglot/src/com/oracle/truffle/polyglot/InternalResourceCache.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,10 @@ final class InternalResourceCache {
9595

9696
/**
9797
* Recomputed before the analyses by a substitution in the {@code TruffleBaseFeature} based on
98-
* the {@code CopyLanguageResources} option value. The field must not be declared as
99-
* {@code final} to make the substitution function correctly.
98+
* the {@code CopyLanguageResources} option value. The field must not qualify as a Java language
99+
* constant (as defined in JLS 15.28) to prevent the Java compiler from inlining its value.
100100
*/
101-
private static boolean useInternalResources = true;
101+
private static final boolean useInternalResources = Boolean.TRUE.booleanValue();
102102
private static boolean useExternalDirectoryInNativeImage = true;
103103

104104
private final String id;
@@ -292,8 +292,9 @@ private static String sanitize(String pathElement) {
292292
}
293293

294294
/**
295-
* Returns true if internal resources are enabled. Internal resources can be disabled in the
296-
* native image using {-H:-CopyLanguageResources} option.
295+
* Returns true if internal resources are enabled. Internal resources are disabled in the native
296+
* image when both the copying and inclusion of language resources are turned off. This can be
297+
* achieved by using the {@code -H:-IncludeLanguageResources} option.
297298
*/
298299
public static boolean usesInternalResources() {
299300
return useInternalResources;

0 commit comments

Comments
 (0)