diff options
9 files changed, 20 insertions, 11 deletions
diff --git a/enigma-cli/src/main/java/cuchaz/enigma/command/Command.java b/enigma-cli/src/main/java/cuchaz/enigma/command/Command.java index 06c49162..53b277f6 100644 --- a/enigma-cli/src/main/java/cuchaz/enigma/command/Command.java +++ b/enigma-cli/src/main/java/cuchaz/enigma/command/Command.java | |||
| @@ -5,6 +5,7 @@ import java.io.IOException; | |||
| 5 | import java.nio.file.Files; | 5 | import java.nio.file.Files; |
| 6 | import java.nio.file.Path; | 6 | import java.nio.file.Path; |
| 7 | import java.nio.file.Paths; | 7 | import java.nio.file.Paths; |
| 8 | import java.util.Locale; | ||
| 8 | 9 | ||
| 9 | import net.fabricmc.mappingio.MappingReader; | 10 | import net.fabricmc.mappingio.MappingReader; |
| 10 | import net.fabricmc.mappingio.tree.MemoryMappingTree; | 11 | import net.fabricmc.mappingio.tree.MemoryMappingTree; |
| @@ -56,7 +57,7 @@ public abstract class Command { | |||
| 56 | 57 | ||
| 57 | protected static EntryTree<EntryMapping> readMappings(Path path, ProgressListener progress, MappingSaveParameters saveParameters) throws IOException, MappingParseException { | 58 | protected static EntryTree<EntryMapping> readMappings(Path path, ProgressListener progress, MappingSaveParameters saveParameters) throws IOException, MappingParseException { |
| 58 | // Legacy | 59 | // Legacy |
| 59 | if (path.getFileName().toString().toLowerCase().endsWith(".zip")) { | 60 | if (path.getFileName().toString().toLowerCase(Locale.ROOT).endsWith(".zip")) { |
| 60 | return MappingFormat.ENIGMA_ZIP.read(path, progress, saveParameters, null); | 61 | return MappingFormat.ENIGMA_ZIP.read(path, progress, saveParameters, null); |
| 61 | } | 62 | } |
| 62 | 63 | ||
diff --git a/enigma-cli/src/main/java/cuchaz/enigma/command/MappingCommandsUtil.java b/enigma-cli/src/main/java/cuchaz/enigma/command/MappingCommandsUtil.java index e1e216a5..7c6bf436 100644 --- a/enigma-cli/src/main/java/cuchaz/enigma/command/MappingCommandsUtil.java +++ b/enigma-cli/src/main/java/cuchaz/enigma/command/MappingCommandsUtil.java | |||
| @@ -4,6 +4,7 @@ import java.io.IOException; | |||
| 4 | import java.io.UncheckedIOException; | 4 | import java.io.UncheckedIOException; |
| 5 | import java.nio.file.Files; | 5 | import java.nio.file.Files; |
| 6 | import java.nio.file.Path; | 6 | import java.nio.file.Path; |
| 7 | import java.util.Locale; | ||
| 7 | 8 | ||
| 8 | import net.fabricmc.mappingio.MappingWriter; | 9 | import net.fabricmc.mappingio.MappingWriter; |
| 9 | import net.fabricmc.mappingio.tree.VisitableMappingTree; | 10 | import net.fabricmc.mappingio.tree.VisitableMappingTree; |
| @@ -34,7 +35,7 @@ public final class MappingCommandsUtil { | |||
| 34 | MappingFormat format = null; | 35 | MappingFormat format = null; |
| 35 | 36 | ||
| 36 | try { | 37 | try { |
| 37 | format = MappingFormat.valueOf(type.toUpperCase()); | 38 | format = MappingFormat.valueOf(type.toUpperCase(Locale.ROOT)); |
| 38 | } catch (IllegalArgumentException ignored) { | 39 | } catch (IllegalArgumentException ignored) { |
| 39 | if (type.equals("tinyv2")) { | 40 | if (type.equals("tinyv2")) { |
| 40 | format = MappingFormat.TINY_V2; | 41 | format = MappingFormat.TINY_V2; |
| @@ -101,7 +102,7 @@ public final class MappingCommandsUtil { | |||
| 101 | MappingFormat format = null; | 102 | MappingFormat format = null; |
| 102 | 103 | ||
| 103 | try { | 104 | try { |
| 104 | format = MappingFormat.valueOf(type.toUpperCase()); | 105 | format = MappingFormat.valueOf(type.toUpperCase(Locale.ROOT)); |
| 105 | } catch (IllegalArgumentException ignored) { | 106 | } catch (IllegalArgumentException ignored) { |
| 106 | // ignored | 107 | // ignored |
| 107 | } | 108 | } |
diff --git a/enigma-server/src/main/java/cuchaz/enigma/network/DedicatedEnigmaServer.java b/enigma-server/src/main/java/cuchaz/enigma/network/DedicatedEnigmaServer.java index af5e34b3..a3c38824 100644 --- a/enigma-server/src/main/java/cuchaz/enigma/network/DedicatedEnigmaServer.java +++ b/enigma-server/src/main/java/cuchaz/enigma/network/DedicatedEnigmaServer.java | |||
| @@ -6,6 +6,7 @@ import java.nio.file.Files; | |||
| 6 | import java.nio.file.Path; | 6 | import java.nio.file.Path; |
| 7 | import java.nio.file.Paths; | 7 | import java.nio.file.Paths; |
| 8 | import java.util.List; | 8 | import java.util.List; |
| 9 | import java.util.Locale; | ||
| 9 | import java.util.concurrent.BlockingQueue; | 10 | import java.util.concurrent.BlockingQueue; |
| 10 | import java.util.concurrent.Executors; | 11 | import java.util.concurrent.Executors; |
| 11 | import java.util.concurrent.LinkedBlockingDeque; | 12 | import java.util.concurrent.LinkedBlockingDeque; |
| @@ -102,7 +103,7 @@ public class DedicatedEnigmaServer extends EnigmaServer { | |||
| 102 | 103 | ||
| 103 | if (Files.isDirectory(mappingsFile)) { | 104 | if (Files.isDirectory(mappingsFile)) { |
| 104 | mappingFormat = MappingFormat.ENIGMA_DIRECTORY; | 105 | mappingFormat = MappingFormat.ENIGMA_DIRECTORY; |
| 105 | } else if (mappingsFile.getFileName().toString().toLowerCase().endsWith(".zip")) { | 106 | } else if (mappingsFile.getFileName().toString().toLowerCase(Locale.ROOT).endsWith(".zip")) { |
| 106 | mappingFormat = MappingFormat.ENIGMA_ZIP; | 107 | mappingFormat = MappingFormat.ENIGMA_ZIP; |
| 107 | } else { | 108 | } else { |
| 108 | mappingFormat = MappingFormat.ENIGMA_FILE; | 109 | mappingFormat = MappingFormat.ENIGMA_FILE; |
diff --git a/enigma-swing/src/main/java/cuchaz/enigma/gui/Main.java b/enigma-swing/src/main/java/cuchaz/enigma/gui/Main.java index dc58464c..6dd89572 100644 --- a/enigma-swing/src/main/java/cuchaz/enigma/gui/Main.java +++ b/enigma-swing/src/main/java/cuchaz/enigma/gui/Main.java | |||
| @@ -18,6 +18,7 @@ import java.nio.file.Path; | |||
| 18 | import java.nio.file.Paths; | 18 | import java.nio.file.Paths; |
| 19 | import java.util.EnumSet; | 19 | import java.util.EnumSet; |
| 20 | import java.util.List; | 20 | import java.util.List; |
| 21 | import java.util.Locale; | ||
| 21 | import java.util.Set; | 22 | import java.util.Set; |
| 22 | 23 | ||
| 23 | import joptsimple.OptionException; | 24 | import joptsimple.OptionException; |
| @@ -143,7 +144,7 @@ public class Main { | |||
| 143 | 144 | ||
| 144 | if (Files.isDirectory(mappingsPath)) { | 145 | if (Files.isDirectory(mappingsPath)) { |
| 145 | controller.openMappings(MappingFormat.ENIGMA_DIRECTORY, mappingsPath); | 146 | controller.openMappings(MappingFormat.ENIGMA_DIRECTORY, mappingsPath); |
| 146 | } else if (mappingsPath.getFileName().toString().toLowerCase().endsWith(".zip")) { | 147 | } else if (mappingsPath.getFileName().toString().toLowerCase(Locale.ROOT).endsWith(".zip")) { |
| 147 | controller.openMappings(MappingFormat.ENIGMA_ZIP, mappingsPath); | 148 | controller.openMappings(MappingFormat.ENIGMA_ZIP, mappingsPath); |
| 148 | } else { | 149 | } else { |
| 149 | controller.openMappings(MappingFormat.ENIGMA_FILE, mappingsPath); | 150 | controller.openMappings(MappingFormat.ENIGMA_FILE, mappingsPath); |
diff --git a/enigma-swing/src/main/java/cuchaz/enigma/gui/config/legacy/Config.java b/enigma-swing/src/main/java/cuchaz/enigma/gui/config/legacy/Config.java index 9955a6b0..1d7082de 100644 --- a/enigma-swing/src/main/java/cuchaz/enigma/gui/config/legacy/Config.java +++ b/enigma-swing/src/main/java/cuchaz/enigma/gui/config/legacy/Config.java | |||
| @@ -5,6 +5,7 @@ import java.io.BufferedReader; | |||
| 5 | import java.lang.reflect.Type; | 5 | import java.lang.reflect.Type; |
| 6 | import java.nio.file.Files; | 6 | import java.nio.file.Files; |
| 7 | import java.nio.file.Path; | 7 | import java.nio.file.Path; |
| 8 | import java.util.Locale; | ||
| 8 | 9 | ||
| 9 | import com.google.gson.Gson; | 10 | import com.google.gson.Gson; |
| 10 | import com.google.gson.GsonBuilder; | 11 | import com.google.gson.GsonBuilder; |
| @@ -98,7 +99,7 @@ public class Config { | |||
| 98 | private static class IntSerializer implements JsonSerializer<Integer> { | 99 | private static class IntSerializer implements JsonSerializer<Integer> { |
| 99 | @Override | 100 | @Override |
| 100 | public JsonElement serialize(Integer src, Type typeOfSrc, JsonSerializationContext context) { | 101 | public JsonElement serialize(Integer src, Type typeOfSrc, JsonSerializationContext context) { |
| 101 | return new JsonPrimitive("#" + Integer.toHexString(src).toUpperCase()); | 102 | return new JsonPrimitive("#" + Integer.toHexString(src).toUpperCase(Locale.ROOT)); |
| 102 | } | 103 | } |
| 103 | } | 104 | } |
| 104 | 105 | ||
diff --git a/enigma-swing/src/main/java/cuchaz/enigma/gui/dialog/JavadocDialog.java b/enigma-swing/src/main/java/cuchaz/enigma/gui/dialog/JavadocDialog.java index 05b7dfbe..657c58bd 100644 --- a/enigma-swing/src/main/java/cuchaz/enigma/gui/dialog/JavadocDialog.java +++ b/enigma-swing/src/main/java/cuchaz/enigma/gui/dialog/JavadocDialog.java | |||
| @@ -17,6 +17,7 @@ import java.awt.Dimension; | |||
| 17 | import java.awt.FlowLayout; | 17 | import java.awt.FlowLayout; |
| 18 | import java.awt.event.KeyAdapter; | 18 | import java.awt.event.KeyAdapter; |
| 19 | import java.awt.event.KeyEvent; | 19 | import java.awt.event.KeyEvent; |
| 20 | import java.util.Locale; | ||
| 20 | import java.util.Objects; | 21 | import java.util.Objects; |
| 21 | 22 | ||
| 22 | import javax.swing.JButton; | 23 | import javax.swing.JButton; |
| @@ -223,7 +224,7 @@ public class JavadocDialog { | |||
| 223 | } | 224 | } |
| 224 | 225 | ||
| 225 | public String getText() { | 226 | public String getText() { |
| 226 | return "@" + this.name().toLowerCase(); | 227 | return "@" + this.name().toLowerCase(Locale.ROOT); |
| 227 | } | 228 | } |
| 228 | 229 | ||
| 229 | public boolean isInline() { | 230 | public boolean isInline() { |
diff --git a/enigma-swing/src/main/java/cuchaz/enigma/gui/util/ScaleUtil.java b/enigma-swing/src/main/java/cuchaz/enigma/gui/util/ScaleUtil.java index c11963df..27b8a6bb 100644 --- a/enigma-swing/src/main/java/cuchaz/enigma/gui/util/ScaleUtil.java +++ b/enigma-swing/src/main/java/cuchaz/enigma/gui/util/ScaleUtil.java | |||
| @@ -5,6 +5,7 @@ import java.awt.Font; | |||
| 5 | import java.awt.Insets; | 5 | import java.awt.Insets; |
| 6 | import java.util.ArrayList; | 6 | import java.util.ArrayList; |
| 7 | import java.util.List; | 7 | import java.util.List; |
| 8 | import java.util.Locale; | ||
| 8 | import java.util.function.Predicate; | 9 | import java.util.function.Predicate; |
| 9 | 10 | ||
| 10 | import javax.swing.BorderFactory; | 11 | import javax.swing.BorderFactory; |
| @@ -98,7 +99,7 @@ public class ScaleUtil { | |||
| 98 | 99 | ||
| 99 | @SuppressWarnings("null") | 100 | @SuppressWarnings("null") |
| 100 | private static BasicTweaker createTweakerForCurrentLook(float dpiScaling) { | 101 | private static BasicTweaker createTweakerForCurrentLook(float dpiScaling) { |
| 101 | String testString = UIManager.getLookAndFeel().getName().toLowerCase(); | 102 | String testString = UIManager.getLookAndFeel().getName().toLowerCase(Locale.ROOT); |
| 102 | 103 | ||
| 103 | if (testString.contains("windows")) { | 104 | if (testString.contains("windows")) { |
| 104 | return new WindowsTweaker(dpiScaling, testString.contains("classic")) { | 105 | return new WindowsTweaker(dpiScaling, testString.contains("classic")) { |
diff --git a/enigma/src/main/java/cuchaz/enigma/analysis/StructureTreeNode.java b/enigma/src/main/java/cuchaz/enigma/analysis/StructureTreeNode.java index 95c2c2a1..c0979f5c 100644 --- a/enigma/src/main/java/cuchaz/enigma/analysis/StructureTreeNode.java +++ b/enigma/src/main/java/cuchaz/enigma/analysis/StructureTreeNode.java | |||
| @@ -3,6 +3,7 @@ package cuchaz.enigma.analysis; | |||
| 3 | import java.util.ArrayList; | 3 | import java.util.ArrayList; |
| 4 | import java.util.Comparator; | 4 | import java.util.Comparator; |
| 5 | import java.util.List; | 5 | import java.util.List; |
| 6 | import java.util.Locale; | ||
| 6 | import java.util.stream.Stream; | 7 | import java.util.stream.Stream; |
| 7 | 8 | ||
| 8 | import javax.swing.tree.DefaultMutableTreeNode; | 9 | import javax.swing.tree.DefaultMutableTreeNode; |
| @@ -67,9 +68,9 @@ public class StructureTreeNode extends DefaultMutableTreeNode { | |||
| 67 | case DEFAULT -> children; | 68 | case DEFAULT -> children; |
| 68 | case A_Z -> children.sorted(Comparator.comparing(e -> (e instanceof MethodEntry m && m.isConstructor()) | 69 | case A_Z -> children.sorted(Comparator.comparing(e -> (e instanceof MethodEntry m && m.isConstructor()) |
| 69 | // compare the class name when the entry is a constructor | 70 | // compare the class name when the entry is a constructor |
| 70 | ? project.getMapper().deobfuscate(e.getParent()).getSimpleName().toLowerCase() : project.getMapper().deobfuscate(e).getSimpleName().toLowerCase())); | 71 | ? project.getMapper().deobfuscate(e.getParent()).getSimpleName().toLowerCase(Locale.ROOT) : project.getMapper().deobfuscate(e).getSimpleName().toLowerCase())); |
| 71 | case Z_A -> children.sorted( | 72 | case Z_A -> children.sorted( |
| 72 | Comparator.comparing(e -> (e instanceof MethodEntry m && m.isConstructor()) ? project.getMapper().deobfuscate(((ParentedEntry<?>) e).getParent()).getSimpleName().toLowerCase() : project.getMapper().deobfuscate((ParentedEntry<?>) e).getSimpleName().toLowerCase()).reversed()); | 73 | Comparator.comparing(e -> (e instanceof MethodEntry m && m.isConstructor()) ? project.getMapper().deobfuscate(((ParentedEntry<?>) e).getParent()).getSimpleName().toLowerCase() : project.getMapper().deobfuscate((ParentedEntry<?>) e).getSimpleName().toLowerCase(Locale.ROOT)).reversed()); |
| 73 | }; | 74 | }; |
| 74 | 75 | ||
| 75 | for (ParentedEntry<?> child : children.toList()) { | 76 | for (ParentedEntry<?> child : children.toList()) { |
diff --git a/enigma/src/main/java/cuchaz/enigma/translation/representation/AccessFlags.java b/enigma/src/main/java/cuchaz/enigma/translation/representation/AccessFlags.java index 24204f89..bd45340d 100644 --- a/enigma/src/main/java/cuchaz/enigma/translation/representation/AccessFlags.java +++ b/enigma/src/main/java/cuchaz/enigma/translation/representation/AccessFlags.java | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | package cuchaz.enigma.translation.representation; | 1 | package cuchaz.enigma.translation.representation; |
| 2 | 2 | ||
| 3 | import java.lang.reflect.Modifier; | 3 | import java.lang.reflect.Modifier; |
| 4 | import java.util.Locale; | ||
| 4 | 5 | ||
| 5 | import org.objectweb.asm.Opcodes; | 6 | import org.objectweb.asm.Opcodes; |
| 6 | 7 | ||
| @@ -110,7 +111,7 @@ public class AccessFlags { | |||
| 110 | 111 | ||
| 111 | @Override | 112 | @Override |
| 112 | public String toString() { | 113 | public String toString() { |
| 113 | StringBuilder builder = new StringBuilder(Access.get(this).toString().toLowerCase()); | 114 | StringBuilder builder = new StringBuilder(Access.get(this).toString().toLowerCase(Locale.ROOT)); |
| 114 | 115 | ||
| 115 | if (isStatic()) { | 116 | if (isStatic()) { |
| 116 | builder.append(" static"); | 117 | builder.append(" static"); |