diff options
| author | 2016-09-13 11:35:52 +0200 | |
|---|---|---|
| committer | 2016-09-13 11:38:05 +0200 | |
| commit | fc530f49fdbf773c497e3714c1f8e7c79020e0a3 (patch) | |
| tree | 7bb063e608295d6c7885b3d5fb0aace3f7fefec7 /src/main/java | |
| parent | fix method/argument renaming edge cases, add method/argument name rebuilder, ... (diff) | |
| download | enigma-fc530f49fdbf773c497e3714c1f8e7c79020e0a3.tar.gz enigma-fc530f49fdbf773c497e3714c1f8e7c79020e0a3.tar.xz enigma-fc530f49fdbf773c497e3714c1f8e7c79020e0a3.zip | |
Make sure to use UTF-8 in any case for I/O, change "Mark as deobfuscated" key and clean up
Diffstat (limited to 'src/main/java')
13 files changed, 46 insertions, 82 deletions
diff --git a/src/main/java/cuchaz/enigma/CommandMain.java b/src/main/java/cuchaz/enigma/CommandMain.java index 54f2707b..b0a4107c 100644 --- a/src/main/java/cuchaz/enigma/CommandMain.java +++ b/src/main/java/cuchaz/enigma/CommandMain.java | |||
| @@ -134,9 +134,15 @@ public class CommandMain { | |||
| 134 | File fileMappings = getReadableFile(getArg(args, 1, "enigma mapping", true)); | 134 | File fileMappings = getReadableFile(getArg(args, 1, "enigma mapping", true)); |
| 135 | File result = getWritableFile(getArg(args, 2, "enigma mapping", true)); | 135 | File result = getWritableFile(getArg(args, 2, "enigma mapping", true)); |
| 136 | String name = getArg(args, 3, "format type", true); | 136 | String name = getArg(args, 3, "format type", true); |
| 137 | Mappings.FormatType formatType = Mappings.FormatType.valueOf(name.toUpperCase()); | 137 | Mappings.FormatType formatType; |
| 138 | if (formatType == null) | 138 | try |
| 139 | { | ||
| 140 | formatType = Mappings.FormatType.valueOf(name.toUpperCase()); | ||
| 141 | } catch (IllegalArgumentException e) | ||
| 142 | { | ||
| 139 | throw new IllegalArgumentException(name + "is not a valid mapping format!"); | 143 | throw new IllegalArgumentException(name + "is not a valid mapping format!"); |
| 144 | } | ||
| 145 | |||
| 140 | System.out.println("Reading mappings..."); | 146 | System.out.println("Reading mappings..."); |
| 141 | Mappings mappings = new MappingsEnigmaReader().read(fileMappings); | 147 | Mappings mappings = new MappingsEnigmaReader().read(fileMappings); |
| 142 | System.out.println("Saving new mappings..."); | 148 | System.out.println("Saving new mappings..."); |
diff --git a/src/main/java/cuchaz/enigma/Main.java b/src/main/java/cuchaz/enigma/Main.java index 14c9fc62..7bff2f27 100644 --- a/src/main/java/cuchaz/enigma/Main.java +++ b/src/main/java/cuchaz/enigma/Main.java | |||
| @@ -16,6 +16,7 @@ import java.util.jar.JarFile; | |||
| 16 | import javax.swing.UIManager; | 16 | import javax.swing.UIManager; |
| 17 | 17 | ||
| 18 | import cuchaz.enigma.gui.Gui; | 18 | import cuchaz.enigma.gui.Gui; |
| 19 | import cuchaz.enigma.mapping.ClassEntry; | ||
| 19 | 20 | ||
| 20 | public class Main { | 21 | public class Main { |
| 21 | 22 | ||
| @@ -32,7 +33,7 @@ public class Main { | |||
| 32 | } | 33 | } |
| 33 | 34 | ||
| 34 | // DEBUG | 35 | // DEBUG |
| 35 | //gui.getController().openDeclaration(new ClassEntry("none/asj")); | 36 | gui.getController().openDeclaration(new ClassEntry("none/byp")); |
| 36 | } | 37 | } |
| 37 | 38 | ||
| 38 | private static File getFile(String path) { | 39 | private static File getFile(String path) { |
diff --git a/src/main/java/cuchaz/enigma/analysis/ClassImplementationsTreeNode.java b/src/main/java/cuchaz/enigma/analysis/ClassImplementationsTreeNode.java index 2a231cb5..70ece243 100644 --- a/src/main/java/cuchaz/enigma/analysis/ClassImplementationsTreeNode.java +++ b/src/main/java/cuchaz/enigma/analysis/ClassImplementationsTreeNode.java | |||
| @@ -60,7 +60,7 @@ public class ClassImplementationsTreeNode extends DefaultMutableTreeNode { | |||
| 60 | 60 | ||
| 61 | public static ClassImplementationsTreeNode findNode(ClassImplementationsTreeNode node, MethodEntry entry) { | 61 | public static ClassImplementationsTreeNode findNode(ClassImplementationsTreeNode node, MethodEntry entry) { |
| 62 | // is this the node? | 62 | // is this the node? |
| 63 | if (node.entry.equals(entry)) { | 63 | if (node.entry.equals(entry.getClassEntry())) { |
| 64 | return node; | 64 | return node; |
| 65 | } | 65 | } |
| 66 | 66 | ||
diff --git a/src/main/java/cuchaz/enigma/analysis/TreeDumpVisitor.java b/src/main/java/cuchaz/enigma/analysis/TreeDumpVisitor.java index ef8a190c..de39d36b 100644 --- a/src/main/java/cuchaz/enigma/analysis/TreeDumpVisitor.java +++ b/src/main/java/cuchaz/enigma/analysis/TreeDumpVisitor.java | |||
| @@ -14,10 +14,8 @@ import com.strobel.componentmodel.Key; | |||
| 14 | import com.strobel.decompiler.languages.java.ast.*; | 14 | import com.strobel.decompiler.languages.java.ast.*; |
| 15 | import com.strobel.decompiler.patterns.Pattern; | 15 | import com.strobel.decompiler.patterns.Pattern; |
| 16 | 16 | ||
| 17 | import java.io.File; | 17 | import java.io.*; |
| 18 | import java.io.FileWriter; | 18 | import java.nio.charset.Charset; |
| 19 | import java.io.IOException; | ||
| 20 | import java.io.Writer; | ||
| 21 | 19 | ||
| 22 | public class TreeDumpVisitor implements IAstVisitor<Void, Void> { | 20 | public class TreeDumpVisitor implements IAstVisitor<Void, Void> { |
| 23 | 21 | ||
| @@ -32,7 +30,7 @@ public class TreeDumpVisitor implements IAstVisitor<Void, Void> { | |||
| 32 | @Override | 30 | @Override |
| 33 | public Void visitCompilationUnit(CompilationUnit node, Void ignored) { | 31 | public Void visitCompilationUnit(CompilationUnit node, Void ignored) { |
| 34 | try { | 32 | try { |
| 35 | m_out = new FileWriter(m_file); | 33 | m_out = new OutputStreamWriter(new FileOutputStream(m_file), Charset.forName("UTF-8")); |
| 36 | recurse(node, ignored); | 34 | recurse(node, ignored); |
| 37 | m_out.close(); | 35 | m_out.close(); |
| 38 | return null; | 36 | return null; |
diff --git a/src/main/java/cuchaz/enigma/bytecode/CheckCastIterator.java b/src/main/java/cuchaz/enigma/bytecode/CheckCastIterator.java index 19c39d3c..d15dd87c 100644 --- a/src/main/java/cuchaz/enigma/bytecode/CheckCastIterator.java +++ b/src/main/java/cuchaz/enigma/bytecode/CheckCastIterator.java | |||
| @@ -18,6 +18,8 @@ import cuchaz.enigma.mapping.MethodEntry; | |||
| 18 | import cuchaz.enigma.mapping.Signature; | 18 | import cuchaz.enigma.mapping.Signature; |
| 19 | import javassist.bytecode.*; | 19 | import javassist.bytecode.*; |
| 20 | 20 | ||
| 21 | @Deprecated | ||
| 22 | // TODO: Find if this class can have any usage. | ||
| 21 | public class CheckCastIterator implements Iterator<CheckCast> { | 23 | public class CheckCastIterator implements Iterator<CheckCast> { |
| 22 | 24 | ||
| 23 | public static class CheckCast { | 25 | public static class CheckCast { |
diff --git a/src/main/java/cuchaz/enigma/convert/ClassIdentity.java b/src/main/java/cuchaz/enigma/convert/ClassIdentity.java index 57cbc06a..0960c86b 100644 --- a/src/main/java/cuchaz/enigma/convert/ClassIdentity.java +++ b/src/main/java/cuchaz/enigma/convert/ClassIdentity.java | |||
| @@ -273,20 +273,20 @@ public class ClassIdentity { | |||
| 273 | // update the hash with the opcode | 273 | // update the hash with the opcode |
| 274 | int opcode = iter.byteAt(pos); | 274 | int opcode = iter.byteAt(pos); |
| 275 | digest.update((byte) opcode); | 275 | digest.update((byte) opcode); |
| 276 | 276 | int constIndex; | |
| 277 | switch (opcode) { | 277 | switch (opcode) { |
| 278 | case Opcode.LDC: { | 278 | case Opcode.LDC: |
| 279 | int constIndex = iter.byteAt(pos + 1); | 279 | constIndex = iter.byteAt(pos + 1); |
| 280 | updateHashWithConstant(digest, constants, constIndex); | 280 | updateHashWithConstant(digest, constants, constIndex); |
| 281 | } | 281 | break; |
| 282 | break; | ||
| 283 | 282 | ||
| 284 | case Opcode.LDC_W: | 283 | case Opcode.LDC_W: |
| 285 | case Opcode.LDC2_W: { | 284 | case Opcode.LDC2_W: |
| 286 | int constIndex = (iter.byteAt(pos + 1) << 8) | iter.byteAt(pos + 2); | 285 | constIndex = (iter.byteAt(pos + 1) << 8) | iter.byteAt(pos + 2); |
| 287 | updateHashWithConstant(digest, constants, constIndex); | 286 | updateHashWithConstant(digest, constants, constIndex); |
| 288 | } | 287 | break; |
| 289 | break; | 288 | default: |
| 289 | break; | ||
| 290 | } | 290 | } |
| 291 | } | 291 | } |
| 292 | 292 | ||
diff --git a/src/main/java/cuchaz/enigma/convert/MatchesReader.java b/src/main/java/cuchaz/enigma/convert/MatchesReader.java index ee5e4828..550da497 100644 --- a/src/main/java/cuchaz/enigma/convert/MatchesReader.java +++ b/src/main/java/cuchaz/enigma/convert/MatchesReader.java | |||
| @@ -12,10 +12,8 @@ package cuchaz.enigma.convert; | |||
| 12 | 12 | ||
| 13 | import com.google.common.collect.Lists; | 13 | import com.google.common.collect.Lists; |
| 14 | 14 | ||
| 15 | import java.io.BufferedReader; | 15 | import java.io.*; |
| 16 | import java.io.File; | 16 | import java.nio.charset.Charset; |
| 17 | import java.io.FileReader; | ||
| 18 | import java.io.IOException; | ||
| 19 | import java.util.Collection; | 17 | import java.util.Collection; |
| 20 | import java.util.List; | 18 | import java.util.List; |
| 21 | 19 | ||
| @@ -26,7 +24,7 @@ public class MatchesReader { | |||
| 26 | 24 | ||
| 27 | public static ClassMatches readClasses(File file) | 25 | public static ClassMatches readClasses(File file) |
| 28 | throws IOException { | 26 | throws IOException { |
| 29 | try (BufferedReader in = new BufferedReader(new FileReader(file))) { | 27 | try (BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(file), Charset.forName("UTF-8")))) { |
| 30 | ClassMatches matches = new ClassMatches(); | 28 | ClassMatches matches = new ClassMatches(); |
| 31 | String line; | 29 | String line; |
| 32 | while ((line = in.readLine()) != null) { | 30 | while ((line = in.readLine()) != null) { |
| @@ -55,7 +53,7 @@ public class MatchesReader { | |||
| 55 | 53 | ||
| 56 | public static <T extends Entry> MemberMatches<T> readMembers(File file) | 54 | public static <T extends Entry> MemberMatches<T> readMembers(File file) |
| 57 | throws IOException { | 55 | throws IOException { |
| 58 | try (BufferedReader in = new BufferedReader(new FileReader(file))) { | 56 | try (BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(file), Charset.forName("UTF-8")))) { |
| 59 | MemberMatches<T> matches = new MemberMatches<T>(); | 57 | MemberMatches<T> matches = new MemberMatches<T>(); |
| 60 | String line; | 58 | String line; |
| 61 | while ((line = in.readLine()) != null) { | 59 | while ((line = in.readLine()) != null) { |
diff --git a/src/main/java/cuchaz/enigma/convert/MatchesWriter.java b/src/main/java/cuchaz/enigma/convert/MatchesWriter.java index baf79293..dccbf6f1 100644 --- a/src/main/java/cuchaz/enigma/convert/MatchesWriter.java +++ b/src/main/java/cuchaz/enigma/convert/MatchesWriter.java | |||
| @@ -10,9 +10,8 @@ | |||
| 10 | ******************************************************************************/ | 10 | ******************************************************************************/ |
| 11 | package cuchaz.enigma.convert; | 11 | package cuchaz.enigma.convert; |
| 12 | 12 | ||
| 13 | import java.io.File; | 13 | import java.io.*; |
| 14 | import java.io.FileWriter; | 14 | import java.nio.charset.Charset; |
| 15 | import java.io.IOException; | ||
| 16 | import java.util.Map; | 15 | import java.util.Map; |
| 17 | 16 | ||
| 18 | import cuchaz.enigma.mapping.BehaviorEntry; | 17 | import cuchaz.enigma.mapping.BehaviorEntry; |
| @@ -25,14 +24,14 @@ public class MatchesWriter { | |||
| 25 | 24 | ||
| 26 | public static void writeClasses(ClassMatches matches, File file) | 25 | public static void writeClasses(ClassMatches matches, File file) |
| 27 | throws IOException { | 26 | throws IOException { |
| 28 | try (FileWriter out = new FileWriter(file)) { | 27 | try (OutputStreamWriter out = new OutputStreamWriter(new FileOutputStream(file), Charset.forName("UTF-8"))) { |
| 29 | for (ClassMatch match : matches) { | 28 | for (ClassMatch match : matches) { |
| 30 | writeClassMatch(out, match); | 29 | writeClassMatch(out, match); |
| 31 | } | 30 | } |
| 32 | } | 31 | } |
| 33 | } | 32 | } |
| 34 | 33 | ||
| 35 | private static void writeClassMatch(FileWriter out, ClassMatch match) | 34 | private static void writeClassMatch(OutputStreamWriter out, ClassMatch match) |
| 36 | throws IOException { | 35 | throws IOException { |
| 37 | writeClasses(out, match.sourceClasses); | 36 | writeClasses(out, match.sourceClasses); |
| 38 | out.write(":"); | 37 | out.write(":"); |
| @@ -40,7 +39,7 @@ public class MatchesWriter { | |||
| 40 | out.write("\n"); | 39 | out.write("\n"); |
| 41 | } | 40 | } |
| 42 | 41 | ||
| 43 | private static void writeClasses(FileWriter out, Iterable<ClassEntry> classes) | 42 | private static void writeClasses(OutputStreamWriter out, Iterable<ClassEntry> classes) |
| 44 | throws IOException { | 43 | throws IOException { |
| 45 | boolean isFirst = true; | 44 | boolean isFirst = true; |
| 46 | for (ClassEntry entry : classes) { | 45 | for (ClassEntry entry : classes) { |
| @@ -55,7 +54,7 @@ public class MatchesWriter { | |||
| 55 | 54 | ||
| 56 | public static <T extends Entry> void writeMembers(MemberMatches<T> matches, File file) | 55 | public static <T extends Entry> void writeMembers(MemberMatches<T> matches, File file) |
| 57 | throws IOException { | 56 | throws IOException { |
| 58 | try (FileWriter out = new FileWriter(file)) { | 57 | try (OutputStreamWriter out = new OutputStreamWriter(new FileOutputStream(file), Charset.forName("UTF-8"))) { |
| 59 | for (Map.Entry<T, T> match : matches.matches().entrySet()) { | 58 | for (Map.Entry<T, T> match : matches.matches().entrySet()) { |
| 60 | writeMemberMatch(out, match.getKey(), match.getValue()); | 59 | writeMemberMatch(out, match.getKey(), match.getValue()); |
| 61 | } | 60 | } |
| @@ -71,7 +70,7 @@ public class MatchesWriter { | |||
| 71 | } | 70 | } |
| 72 | } | 71 | } |
| 73 | 72 | ||
| 74 | private static <T extends Entry> void writeMemberMatch(FileWriter out, T source, T dest) | 73 | private static <T extends Entry> void writeMemberMatch(OutputStreamWriter out, T source, T dest) |
| 75 | throws IOException { | 74 | throws IOException { |
| 76 | if (source != null) { | 75 | if (source != null) { |
| 77 | writeEntry(out, source); | 76 | writeEntry(out, source); |
| @@ -83,14 +82,14 @@ public class MatchesWriter { | |||
| 83 | out.write("\n"); | 82 | out.write("\n"); |
| 84 | } | 83 | } |
| 85 | 84 | ||
| 86 | private static <T extends Entry> void writeUnmatchableEntry(FileWriter out, T entry) | 85 | private static <T extends Entry> void writeUnmatchableEntry(OutputStreamWriter out, T entry) |
| 87 | throws IOException { | 86 | throws IOException { |
| 88 | out.write("!"); | 87 | out.write("!"); |
| 89 | writeEntry(out, entry); | 88 | writeEntry(out, entry); |
| 90 | out.write("\n"); | 89 | out.write("\n"); |
| 91 | } | 90 | } |
| 92 | 91 | ||
| 93 | private static <T extends Entry> void writeEntry(FileWriter out, T entry) | 92 | private static <T extends Entry> void writeEntry(OutputStreamWriter out, T entry) |
| 94 | throws IOException { | 93 | throws IOException { |
| 95 | if (entry instanceof FieldEntry) { | 94 | if (entry instanceof FieldEntry) { |
| 96 | writeField(out, (FieldEntry) entry); | 95 | writeField(out, (FieldEntry) entry); |
| @@ -99,7 +98,7 @@ public class MatchesWriter { | |||
| 99 | } | 98 | } |
| 100 | } | 99 | } |
| 101 | 100 | ||
| 102 | private static void writeField(FileWriter out, FieldEntry fieldEntry) | 101 | private static void writeField(OutputStreamWriter out, FieldEntry fieldEntry) |
| 103 | throws IOException { | 102 | throws IOException { |
| 104 | out.write(fieldEntry.getClassName()); | 103 | out.write(fieldEntry.getClassName()); |
| 105 | out.write(" "); | 104 | out.write(" "); |
| @@ -108,7 +107,7 @@ public class MatchesWriter { | |||
| 108 | out.write(fieldEntry.getType().toString()); | 107 | out.write(fieldEntry.getType().toString()); |
| 109 | } | 108 | } |
| 110 | 109 | ||
| 111 | private static void writeBehavior(FileWriter out, BehaviorEntry behaviorEntry) | 110 | private static void writeBehavior(OutputStreamWriter out, BehaviorEntry behaviorEntry) |
| 112 | throws IOException { | 111 | throws IOException { |
| 113 | out.write(behaviorEntry.getClassName()); | 112 | out.write(behaviorEntry.getClassName()); |
| 114 | out.write(" "); | 113 | out.write(" "); |
diff --git a/src/main/java/cuchaz/enigma/gui/MemberMatchingGui.java b/src/main/java/cuchaz/enigma/gui/MemberMatchingGui.java index 4383465c..50550910 100644 --- a/src/main/java/cuchaz/enigma/gui/MemberMatchingGui.java +++ b/src/main/java/cuchaz/enigma/gui/MemberMatchingGui.java | |||
| @@ -172,11 +172,8 @@ public class MemberMatchingGui<T extends Entry> { | |||
| 172 | KeyAdapter keyListener = new KeyAdapter() { | 172 | KeyAdapter keyListener = new KeyAdapter() { |
| 173 | @Override | 173 | @Override |
| 174 | public void keyPressed(KeyEvent event) { | 174 | public void keyPressed(KeyEvent event) { |
| 175 | switch (event.getKeyCode()) { | 175 | if (event.getKeyCode() == KeyEvent.VK_M) |
| 176 | case KeyEvent.VK_M: | 176 | m_matchButton.doClick(); |
| 177 | m_matchButton.doClick(); | ||
| 178 | break; | ||
| 179 | } | ||
| 180 | } | 177 | } |
| 181 | }; | 178 | }; |
| 182 | m_sourceReader.addKeyListener(keyListener); | 179 | m_sourceReader.addKeyListener(keyListener); |
| @@ -376,7 +373,7 @@ public class MemberMatchingGui<T extends Entry> { | |||
| 376 | 373 | ||
| 377 | private void setSource(T obfEntry) { | 374 | private void setSource(T obfEntry) { |
| 378 | if (obfEntry == null) { | 375 | if (obfEntry == null) { |
| 379 | m_obfSourceEntry = obfEntry; | 376 | m_obfSourceEntry = null; |
| 380 | m_sourceLabel.setText(""); | 377 | m_sourceLabel.setText(""); |
| 381 | } else { | 378 | } else { |
| 382 | m_obfSourceEntry = obfEntry; | 379 | m_obfSourceEntry = obfEntry; |
| @@ -386,7 +383,7 @@ public class MemberMatchingGui<T extends Entry> { | |||
| 386 | 383 | ||
| 387 | private void setDest(T obfEntry) { | 384 | private void setDest(T obfEntry) { |
| 388 | if (obfEntry == null) { | 385 | if (obfEntry == null) { |
| 389 | m_obfDestEntry = obfEntry; | 386 | m_obfDestEntry = null; |
| 390 | m_destLabel.setText(""); | 387 | m_destLabel.setText(""); |
| 391 | } else { | 388 | } else { |
| 392 | m_obfDestEntry = obfEntry; | 389 | m_obfDestEntry = obfEntry; |
diff --git a/src/main/java/cuchaz/enigma/gui/elements/PopupMenuBar.java b/src/main/java/cuchaz/enigma/gui/elements/PopupMenuBar.java index 07c8a32d..2b06342b 100644 --- a/src/main/java/cuchaz/enigma/gui/elements/PopupMenuBar.java +++ b/src/main/java/cuchaz/enigma/gui/elements/PopupMenuBar.java | |||
| @@ -10,8 +10,6 @@ import cuchaz.enigma.gui.Gui; | |||
| 10 | 10 | ||
| 11 | public class PopupMenuBar extends JPopupMenu { | 11 | public class PopupMenuBar extends JPopupMenu { |
| 12 | 12 | ||
| 13 | private final Gui gui; | ||
| 14 | |||
| 15 | public final JMenuItem renameMenu; | 13 | public final JMenuItem renameMenu; |
| 16 | public final JMenuItem showInheritanceMenu; | 14 | public final JMenuItem showInheritanceMenu; |
| 17 | public final JMenuItem showImplementationsMenu; | 15 | public final JMenuItem showImplementationsMenu; |
| @@ -21,7 +19,6 @@ public class PopupMenuBar extends JPopupMenu { | |||
| 21 | public final JMenuItem toggleMappingMenu; | 19 | public final JMenuItem toggleMappingMenu; |
| 22 | 20 | ||
| 23 | public PopupMenuBar(Gui gui) { | 21 | public PopupMenuBar(Gui gui) { |
| 24 | this.gui = gui; | ||
| 25 | { | 22 | { |
| 26 | JMenuItem menu = new JMenuItem("Rename"); | 23 | JMenuItem menu = new JMenuItem("Rename"); |
| 27 | menu.addActionListener(event -> gui.startRename()); | 24 | menu.addActionListener(event -> gui.startRename()); |
| @@ -73,7 +70,7 @@ public class PopupMenuBar extends JPopupMenu { | |||
| 73 | { | 70 | { |
| 74 | JMenuItem menu = new JMenuItem("Mark as deobfuscated"); | 71 | JMenuItem menu = new JMenuItem("Mark as deobfuscated"); |
| 75 | menu.addActionListener(event -> gui.toggleMapping()); | 72 | menu.addActionListener(event -> gui.toggleMapping()); |
| 76 | menu.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_T, 0)); | 73 | menu.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, 0)); |
| 77 | menu.setEnabled(false); | 74 | menu.setEnabled(false); |
| 78 | this.add(menu); | 75 | this.add(menu); |
| 79 | this.toggleMappingMenu = menu; | 76 | this.toggleMappingMenu = menu; |
diff --git a/src/main/java/cuchaz/enigma/mapping/EntryPair.java b/src/main/java/cuchaz/enigma/mapping/EntryPair.java deleted file mode 100644 index 1c93d532..00000000 --- a/src/main/java/cuchaz/enigma/mapping/EntryPair.java +++ /dev/null | |||
| @@ -1,22 +0,0 @@ | |||
| 1 | /******************************************************************************* | ||
| 2 | * Copyright (c) 2015 Jeff Martin. | ||
| 3 | * All rights reserved. This program and the accompanying materials | ||
| 4 | * are made available under the terms of the GNU Lesser General Public | ||
| 5 | * License v3.0 which accompanies this distribution, and is available at | ||
| 6 | * http://www.gnu.org/licenses/lgpl.html | ||
| 7 | * <p> | ||
| 8 | * Contributors: | ||
| 9 | * Jeff Martin - initial API and implementation | ||
| 10 | ******************************************************************************/ | ||
| 11 | package cuchaz.enigma.mapping; | ||
| 12 | |||
| 13 | public class EntryPair<T extends Entry> { | ||
| 14 | |||
| 15 | public T obf; | ||
| 16 | public T deobf; | ||
| 17 | |||
| 18 | public EntryPair(T obf, T deobf) { | ||
| 19 | this.obf = obf; | ||
| 20 | this.deobf = deobf; | ||
| 21 | } | ||
| 22 | } | ||
diff --git a/src/main/java/cuchaz/enigma/mapping/MappingsRenamer.java b/src/main/java/cuchaz/enigma/mapping/MappingsRenamer.java index 7c6c8318..e35ef3e8 100644 --- a/src/main/java/cuchaz/enigma/mapping/MappingsRenamer.java +++ b/src/main/java/cuchaz/enigma/mapping/MappingsRenamer.java | |||
| @@ -13,6 +13,7 @@ package cuchaz.enigma.mapping; | |||
| 13 | import java.io.IOException; | 13 | import java.io.IOException; |
| 14 | import java.io.ObjectOutputStream; | 14 | import java.io.ObjectOutputStream; |
| 15 | import java.io.OutputStream; | 15 | import java.io.OutputStream; |
| 16 | import java.io.Serializable; | ||
| 16 | import java.util.List; | 17 | import java.util.List; |
| 17 | import java.util.Set; | 18 | import java.util.Set; |
| 18 | import java.util.zip.GZIPOutputStream; | 19 | import java.util.zip.GZIPOutputStream; |
diff --git a/src/main/java/cuchaz/enigma/mapping/NameValidator.java b/src/main/java/cuchaz/enigma/mapping/NameValidator.java index 7be83c7f..6925b72a 100644 --- a/src/main/java/cuchaz/enigma/mapping/NameValidator.java +++ b/src/main/java/cuchaz/enigma/mapping/NameValidator.java | |||
| @@ -30,19 +30,6 @@ public class NameValidator { | |||
| 30 | ); | 30 | ); |
| 31 | 31 | ||
| 32 | static { | 32 | static { |
| 33 | |||
| 34 | // java allows all kinds of weird characters... | ||
| 35 | StringBuilder startChars = new StringBuilder(); | ||
| 36 | StringBuilder partChars = new StringBuilder(); | ||
| 37 | for (int i = Character.MIN_CODE_POINT; i <= Character.MAX_CODE_POINT; i++) { | ||
| 38 | if (Character.isJavaIdentifierStart(i)) { | ||
| 39 | startChars.appendCodePoint(i); | ||
| 40 | } | ||
| 41 | if (Character.isJavaIdentifierPart(i)) { | ||
| 42 | partChars.appendCodePoint(i); | ||
| 43 | } | ||
| 44 | } | ||
| 45 | |||
| 46 | String identifierRegex = "[A-Za-z_<][A-Za-z0-9_>]*"; | 33 | String identifierRegex = "[A-Za-z_<][A-Za-z0-9_>]*"; |
| 47 | IdentifierPattern = Pattern.compile(identifierRegex); | 34 | IdentifierPattern = Pattern.compile(identifierRegex); |
| 48 | ClassPattern = Pattern.compile(String.format("^(%s(\\.|/))*(%s)$", identifierRegex, identifierRegex)); | 35 | ClassPattern = Pattern.compile(String.format("^(%s(\\.|/))*(%s)$", identifierRegex, identifierRegex)); |