mirror of
https://github.com/apple/pkl.git
synced 2026-05-28 17:49:15 +02:00
Fix calls to string case api (#1620)
* Enable IntelliJ inspection for calls to `String.toLowerCase()` and `String.toUpperCase()` * Enable error prone check * Fix all issues
This commit is contained in:
@@ -17,6 +17,7 @@ package org.pkl.gradle.test.extreader;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Locale;
|
||||
import org.msgpack.core.MessagePack;
|
||||
import org.msgpack.value.Value;
|
||||
import org.msgpack.value.ValueFactory;
|
||||
@@ -77,7 +78,7 @@ public class Main {
|
||||
|
||||
var colonIndex = uri.indexOf(':');
|
||||
var schemeSpecific = colonIndex >= 0 ? uri.substring(colonIndex + 1) : uri;
|
||||
var contents = schemeSpecific.toUpperCase().getBytes(StandardCharsets.UTF_8);
|
||||
var contents = schemeSpecific.toUpperCase(Locale.ROOT).getBytes(StandardCharsets.UTF_8);
|
||||
|
||||
packer.packArrayHeader(2);
|
||||
packer.packInt(READ_RESOURCE_RESPONSE);
|
||||
|
||||
@@ -18,6 +18,7 @@ package org.pkl.gradle;
|
||||
import java.io.File;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
@@ -453,7 +454,7 @@ public class PklPlugin implements Plugin<Project> {
|
||||
+ spec.getName()
|
||||
+ "'. Either apply a JVM plugin (e.g. 'java') or set the sourceSet property explicitly.");
|
||||
}
|
||||
if (sourceSet.getName().toLowerCase().contains("test")) {
|
||||
if (sourceSet.getName().toLowerCase(Locale.ROOT).contains("test")) {
|
||||
module.getTestSources().from(append(module.getTestSources().getFiles(), outputDir));
|
||||
} else {
|
||||
module.setSourceDirs(append(module.getSourceDirs(), outputDir));
|
||||
|
||||
@@ -25,6 +25,7 @@ import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.function.Function;
|
||||
import org.gradle.api.InvalidUserDataException;
|
||||
import org.gradle.api.file.FileSystemLocation;
|
||||
@@ -183,7 +184,7 @@ public final class PluginUtils {
|
||||
return TestReporter.getDefault();
|
||||
}
|
||||
try {
|
||||
return TestReporter.valueOf(inputStr.toUpperCase());
|
||||
return TestReporter.valueOf(inputStr.toUpperCase(Locale.ROOT));
|
||||
} catch (IllegalArgumentException e) {
|
||||
var sb = new StringBuilder("Invalid test reporter: '");
|
||||
sb.append(inputStr).append("'. ");
|
||||
@@ -197,7 +198,7 @@ public final class PluginUtils {
|
||||
} else {
|
||||
sb.append(", ");
|
||||
}
|
||||
sb.append('\'').append(value.toString().toLowerCase()).append('\'');
|
||||
sb.append('\'').append(value.toString().toLowerCase(Locale.ROOT)).append('\'');
|
||||
}
|
||||
sb.append(".");
|
||||
throw new InvalidUserDataException(sb.toString());
|
||||
|
||||
Reference in New Issue
Block a user