Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GR-51623] Use Locale.ROOT instead of Locale.ENGLISH. #8328

Merged
merged 2 commits into from
Feb 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ protected void verify(StructuredGraph graph, CoreProviders context) {
}
String calleeName = callee.getName();
if (calleeName.equals(TO_LOWER_CASE_METHOD_NAME) || calleeName.equals(TO_UPPER_CASE_METHOD_NAME)) {
throw new VerificationError(t, "call to parameterless %s is prohibited to avoid localization issues. Please pass a locale such as 'Locale.ENGLISH' explicitly.",
throw new VerificationError(t, "call to parameterless %s is prohibited to avoid localization issues. Please pass a locale such as 'Locale.ROOT' explicitly.",
callee.format("%H.%n(%p)"));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ static class HexCodeFileDisTool {
arch = "amd64";
}
int wordWidth = arch.endsWith("64") ? 64 : Integer.parseInt(Services.getSavedProperty("sun.arch.data.model", "64"));
String hcf = new HexCodeFile(code, 0L, arch.toLowerCase(Locale.ENGLISH), wordWidth).toEmbeddedString();
String hcf = new HexCodeFile(code, 0L, arch.toLowerCase(Locale.ROOT), wordWidth).toEmbeddedString();
try {
toolMethod.invokeExact(hcf);
} catch (Throwable e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ public int getPhaseSkipOdds() {
@Override
public String toString() {
return String.format("%s%n%s%nProbability of inserting a phase: 1/%s (-Dtest.graal.skip.phase.insertion.odds.%s=%s)%n",
super.toString(), ignoredPhasesToString(), phaseSkipOdds, String.join(".", getTierName().toLowerCase(Locale.ENGLISH).split(" ")), phaseSkipOdds);
super.toString(), ignoredPhasesToString(), phaseSkipOdds, String.join(".", getTierName().toLowerCase(Locale.ROOT).split(" ")), phaseSkipOdds);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ protected String ignoredPhasesToString() {
return "Every phase that was given is in the resulting tier plan.";
}
Formatter formatter = new Formatter();
formatter.format("Phase%s in %s ignored by the fuzzer:%n", getIgnoredPhases().size() > 1 ? "s" : "", getTierName().toLowerCase(Locale.ENGLISH));
formatter.format("Phase%s in %s ignored by the fuzzer:%n", getIgnoredPhases().size() > 1 ? "s" : "", getTierName().toLowerCase(Locale.ROOT));
for (BasePhase<? super C> phase : getIgnoredPhases()) {
if (phase instanceof PhaseSuite) {
formatter.format("%s", PrintingUtils.indent(phase.toString()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1896,7 +1896,7 @@ public static String applyFormattingFlagsAndWidth(String s, int flags, int width

String res = sb.toString();
if ((flags & UPPERCASE) == UPPERCASE) {
res = res.toUpperCase(Locale.ENGLISH);
res = res.toUpperCase(Locale.ROOT);
}
return res;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ String toString(LIRInstruction obj) {
StringBuilder result = new StringBuilder();

appendValues(result, obj, "", " = ", "(", ")", new String[]{""}, defs);
result.append(String.valueOf(getOpcode(obj)).toUpperCase(Locale.ENGLISH));
result.append(String.valueOf(getOpcode(obj)).toUpperCase(Locale.ROOT));
appendValues(result, obj, " ", "", "(", ")", new String[]{"", "~"}, uses, alives);
appendValues(result, obj, " ", "", "{", "}", new String[]{""}, temps);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -774,7 +774,7 @@ public enum MandatoryStages {
* is found, returns {@link #COMMUNITY}.
*/
public static MandatoryStages getFromName(String name) {
switch (name.toLowerCase(Locale.ENGLISH)) {
switch (name.toLowerCase(Locale.ROOT)) {
case "economy":
return ECONOMY;
case "community":
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ public static Object parseOptionValue(OptionDescriptor desc, Object uncheckedVal
}

private static long parseLong(String v) {
String valueString = v.toLowerCase(Locale.ENGLISH);
String valueString = v.toLowerCase(Locale.ROOT);
long scale = 1;
if (valueString.endsWith("k")) {
scale = 1024L;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ private void initClosure(IntrinsificationTarget target) {
this.envPackage = target.envPackage;
this.envClassName = target.envClassName;

this.envName = envClassName.toLowerCase(Locale.ENGLISH);
this.envName = envClassName.toLowerCase(Locale.ROOT);
this.imports = envPackage + "." + envClassName + ";\n";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ public enum SpecComplianceMode {
@Override
public SpecComplianceMode apply(String s) {
try {
return SpecComplianceMode.valueOf(s.toUpperCase(Locale.ENGLISH));
return SpecComplianceMode.valueOf(s.toUpperCase(Locale.ROOT));
} catch (IllegalArgumentException e) {
throw new IllegalArgumentException("--java.SpecCompliance: Mode can be 'strict' or 'hotspot'.");
}
Expand All @@ -286,7 +286,7 @@ public enum VerifyMode {
@Override
public VerifyMode apply(String s) {
try {
return VerifyMode.valueOf(s.toUpperCase(Locale.ENGLISH));
return VerifyMode.valueOf(s.toUpperCase(Locale.ROOT));
} catch (IllegalArgumentException e) {
throw new IllegalArgumentException("-Xverify: Mode can be 'none', 'remote' or 'all'.");
}
Expand Down Expand Up @@ -342,7 +342,7 @@ public LivenessAnalysisMode apply(String s) {
return LivenessAnalysisMode.NONE;
}
try {
return LivenessAnalysisMode.valueOf(s.toUpperCase(Locale.ENGLISH));
return LivenessAnalysisMode.valueOf(s.toUpperCase(Locale.ROOT));
} catch (IllegalArgumentException e) {
throw new IllegalArgumentException("--java.LivenessAnalysis can only be 'none'|'false', 'auto' or 'all'|'true'.");
}
Expand Down Expand Up @@ -639,7 +639,7 @@ public enum JImageMode {
@Override
public JImageMode apply(String s) {
try {
return JImageMode.valueOf(s.toUpperCase(Locale.ENGLISH));
return JImageMode.valueOf(s.toUpperCase(Locale.ROOT));
} catch (IllegalArgumentException e) {
throw new IllegalArgumentException("JImage: Mode can be 'native', 'java'.");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public class Main {
static {
String logLevel = System.getenv(LOGGING_PROP);
if (logLevel != null) {
Level level = Level.parse(logLevel.toUpperCase(Locale.ENGLISH));
Level level = Level.parse(logLevel.toUpperCase(Locale.ROOT));
LOGGER.setLevel(level);
Handler[] handlers = Logger.getLogger("").getHandlers();
for (Handler h : handlers) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1080,7 +1080,7 @@ private static DeclaredType getComponentType(TypeMirror arrayType, Types types)
}

private static String cacheEntryName(CharSequence name) {
return name.toString().replace('.', '_').toUpperCase(Locale.ENGLISH) + "_BINARY_NAME";
return name.toString().replace('.', '_').toUpperCase(Locale.ROOT) + "_BINARY_NAME";
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ protected void onValueUpdate(EconomicMap<OptionKey<?>, Object> values, Boolean o
public static final OptionKey<String> AnalysisContextSensitivity = new OptionKey<>("insens") {
@Override
protected void onValueUpdate(EconomicMap<OptionKey<?>, Object> values, String oldValue, String newValue) {
switch (newValue.toLowerCase(Locale.ENGLISH)) {
switch (newValue.toLowerCase(Locale.ROOT)) {
case "insens":
AllocationSiteSensitiveHeap.update(values, false);
MinHeapContextDepth.update(values, 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public String getSegmentName(ObjectFile.Format f) {
// default implementation
switch (f) {
case MACH_O:
return getFormatDependentName(f).toUpperCase(Locale.ENGLISH);
return getFormatDependentName(f).toUpperCase(Locale.ROOT);
default:
case ELF:
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ int flags() {
abstract int flags();

public static ELFMachine from(String s) {
switch (s.toLowerCase(Locale.ENGLISH)) {
switch (s.toLowerCase(Locale.ROOT)) {
case "amd64":
case "x86_64":
return X86_64;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ static void ensureInitialized() {
if (signalDispatcherThread.getState() == Thread.State.NEW) {
if (!jdkMiscSignalInit()) {
VMError.shouldNotReachHere("Native state initialization for jdk.internal.misc.Signal failed with error code: 0x" +
Integer.toUnsignedString(WinBase.GetLastError(), 16).toUpperCase(Locale.ENGLISH));
Integer.toUnsignedString(WinBase.GetLastError(), 16).toUpperCase(Locale.ROOT));
}
RuntimeSupport.getRuntimeSupport().addTearDownHook(isFirstIsolate -> osTerminateSignalThread());
signalDispatcherThread.start();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public enum OS {
* Returns a string that can be used in a package name.
*/
public String asPackageName() {
return name().toLowerCase(Locale.ENGLISH);
return name().toLowerCase(Locale.ROOT);
}

public boolean isCurrent() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ protected SystemPropertiesSupport() {
initializeProperty("java.vendor", vm.vendor);
initializeProperty("java.vendor.url", vm.vendorUrl);
initializeProperty("java.vendor.version", vm.vendorVersion);
assert vm.info.equals(vm.info.toLowerCase(Locale.ENGLISH)) : "java.vm.info should not contain uppercase characters";
assert vm.info.equals(vm.info.toLowerCase(Locale.ROOT)) : "java.vm.info should not contain uppercase characters";
initializeProperty("java.vm.info", vm.info);
initializeProperty("java.vm.name", "Substrate VM");
initializeProperty("java.vm.vendor", vm.vendor);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ private static Charset lookup2(String charsetName) {
}

Map<String, Charset> charsets = ImageSingletons.lookup(LocalizationSupport.class).charsets;
Charset cs = charsets.get(charsetName.toLowerCase(Locale.ENGLISH));
Charset cs = charsets.get(charsetName.toLowerCase(Locale.ROOT));
if (cs != null) {
cache(charsetName, cs);
return cs;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ private static void verifySelections(JfrLogSelection[] selections) {
for (JfrLogSelection selection : selections) {
if (!selection.matchesATagSet) {
throw new IllegalArgumentException("No tag set matches tag combination " +
selection.tags.toString().toLowerCase(Locale.ENGLISH) + (selection.wildcard ? "*" : "") + " for FlightRecorderLogging");
selection.tags.toString().toLowerCase(Locale.ROOT) + (selection.wildcard ? "*" : "") + " for FlightRecorderLogging");
}
}
}
Expand Down Expand Up @@ -136,7 +136,7 @@ private static JfrLogSelection parse(String str) {
if ((equalsIndex = str.indexOf('=')) > 0) {
String value = str.substring(equalsIndex + 1);
try {
level = JfrLogLevel.valueOf(value.toUpperCase(Locale.ENGLISH));
level = JfrLogLevel.valueOf(value.toUpperCase(Locale.ROOT));
} catch (IllegalArgumentException | NullPointerException e) {
throw new IllegalArgumentException("Invalid log level '" + value + "' for FlightRecorderLogging.", e);
}
Expand All @@ -156,7 +156,7 @@ private static JfrLogSelection parse(String str) {

for (String s : tagsStr.split("\\+")) {
try {
tags.add(JfrLogTag.valueOf(s.toUpperCase(Locale.ENGLISH)));
tags.add(JfrLogTag.valueOf(s.toUpperCase(Locale.ROOT)));
} catch (IllegalArgumentException | NullPointerException e) {
throw new IllegalArgumentException("Invalid log tag '" + s + "' for FlightRecorderLogging.", e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ private static String[] createLogLevels() {
LogLevel[] values = LogLevel.values();
String[] result = new String[getMaxLogLevel(values) + 1];
for (LogLevel logLevel : values) {
result[getLevel(logLevel)] = logLevel.toString().toLowerCase(Locale.ENGLISH);
result[getLevel(logLevel)] = logLevel.toString().toLowerCase(Locale.ROOT);
}
return result;
}
Expand All @@ -141,7 +141,7 @@ private static String[] createLogTagSets() {
if (builder.length() > 0) {
builder.append(",");
}
builder.append(logTag.toString().toLowerCase(Locale.ENGLISH));
builder.append(logTag.toString().toLowerCase(Locale.ROOT));
}
result[getId(logTagSet)] = builder.toString();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public Stream<Pair<T, OptionOrigin>> getValuesWithOrigins() {

@Override
public String toString() {
return "<" + ClassUtil.getUnqualifiedName(valueType).toLowerCase(Locale.ENGLISH) + ">*";
return "<" + ClassUtil.getUnqualifiedName(valueType).toLowerCase(Locale.ROOT) + ">*";
}

public static final class Strings extends LocatableMultiOptionValue<String> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public String getDescriptionPrefix(boolean commandLineStyle) {

@Override
public String toString() {
return name().toLowerCase(Locale.ENGLISH);
return name().toLowerCase(Locale.ROOT);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ private static <T extends Annotation> List<T> getAnnotationsByType(OptionDescrip
}

private static String startLowerCase(String str) {
return str.substring(0, 1).toLowerCase(Locale.ENGLISH) + str.substring(1);
return str.substring(0, 1).toLowerCase(Locale.ROOT) + str.substring(1);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public class NativeImage {
static final String platform = getPlatform();

private static String getPlatform() {
return (OS.getCurrent().className + "-" + SubstrateUtil.getArchitectureName()).toLowerCase(Locale.ENGLISH);
return (OS.getCurrent().className + "-" + SubstrateUtil.getArchitectureName()).toLowerCase(Locale.ROOT);
}

static final String graalvmVendor = VM.getVendor();
Expand Down Expand Up @@ -1211,10 +1211,10 @@ private int completeImageBuild() {
if (getHostedOptionArgumentValue(imageBuilderArgs, oHName) == null) {
/* Also no explicit image name given as customImageBuilderArgs */
if (explicitMainClass) {
imageBuilderArgs.add(oH(SubstrateOptions.Name, "main-class lower case as image name") + mainClass.toLowerCase(Locale.ENGLISH));
imageBuilderArgs.add(oH(SubstrateOptions.Name, "main-class lower case as image name") + mainClass.toLowerCase(Locale.ROOT));
} else if (getHostedOptionArgumentValue(imageBuilderArgs, oHName) == null) {
if (hasMainClassModule) {
imageBuilderArgs.add(oH(SubstrateOptions.Name, "image-name from module-name") + mainClassModule.toLowerCase(Locale.ENGLISH));
imageBuilderArgs.add(oH(SubstrateOptions.Name, "image-name from module-name") + mainClassModule.toLowerCase(Locale.ROOT));
} else if (!listModules) {
/* Although very unlikely, report missing image-name if needed. */
throw showError("Missing image-name. Use -o <imagename> to provide one.");
Expand Down Expand Up @@ -1447,7 +1447,7 @@ private void addTargetArguments() {
if (targetPlatform == null) {
return;
}
targetPlatform = targetPlatform.toLowerCase(Locale.ENGLISH);
targetPlatform = targetPlatform.toLowerCase(Locale.ROOT);

String[] parts = targetPlatform.split("-");
if (parts.length != 2) {
Expand Down Expand Up @@ -1782,7 +1782,7 @@ private static void sanitizeJVMEnvironment(Map<String, String> environment, Map<
Function<String, String> keyMapper;
if (OS.WINDOWS.isCurrent()) {
requiredKeys.addAll(List.of("TEMP", "INCLUDE", "LIB"));
keyMapper = s -> s.toUpperCase(Locale.ENGLISH);
keyMapper = s -> s.toUpperCase(Locale.ROOT);
} else {
keyMapper = Function.identity();
}
Expand Down Expand Up @@ -2114,7 +2114,7 @@ public static List<Path> expandAsteriskClassPathElement(String cp) {
}

private static boolean hasJarFileSuffix(Path p) {
return p.getFileName().toString().toLowerCase(Locale.ENGLISH).endsWith(".jar");
return p.getFileName().toString().toLowerCase(Locale.ROOT).endsWith(".jar");
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ public static Platform getTargetPlatform(ClassLoader classLoader) {

String os = System.getProperty("svm.targetPlatformOS");
if (os == null) {
os = OS.getCurrent().className.toLowerCase(Locale.ENGLISH);
os = OS.getCurrent().className.toLowerCase(Locale.ROOT);
}

String arch = System.getProperty("svm.targetPlatformArch");
Expand Down Expand Up @@ -1714,7 +1714,7 @@ public static void checkName(String name, AnalysisMethod method, BigBang bb) {
}

public static String checkName(String name) {
String lname = name.toLowerCase(Locale.ENGLISH);
String lname = name.toLowerCase(Locale.ROOT);
String message = null;
if (lname.contains("hosted")) {
message = "Hosted element used at run time: " + name;
Expand Down
Loading
Loading