diff options
| author | 2020-04-02 10:36:27 -0500 | |
|---|---|---|
| committer | 2020-04-02 16:36:27 +0100 | |
| commit | ccccfa1786d783867daf91fbfa522d4a5c55dfdb (patch) | |
| tree | b09cbde37e4757c993d59dfd70bfee81fbbd5e63 /src/main | |
| parent | Merge pull request #203 from Runemoro/fix-cfr (diff) | |
| download | enigma-ccccfa1786d783867daf91fbfa522d4a5c55dfdb.tar.gz enigma-ccccfa1786d783867daf91fbfa522d4a5c55dfdb.tar.xz enigma-ccccfa1786d783867daf91fbfa522d4a5c55dfdb.zip | |
Support java 9+ and gradle 6+ (#206)
* Support java 9+ and gradle 6+
* Update asm
Signed-off-by: liach <liach@users.noreply.github.com>
* Use asm 8 and move that to a constant
* Bump version
* fix version format
Co-authored-by: liach <liach@users.noreply.github.com>
Diffstat (limited to 'src/main')
9 files changed, 19 insertions, 9 deletions
diff --git a/src/main/java/cuchaz/enigma/EnigmaProject.java b/src/main/java/cuchaz/enigma/EnigmaProject.java index 78b49b57..852bfc49 100644 --- a/src/main/java/cuchaz/enigma/EnigmaProject.java +++ b/src/main/java/cuchaz/enigma/EnigmaProject.java | |||
| @@ -18,6 +18,7 @@ import cuchaz.enigma.translation.representation.entry.LocalVariableEntry; | |||
| 18 | import cuchaz.enigma.translation.representation.entry.MethodEntry; | 18 | import cuchaz.enigma.translation.representation.entry.MethodEntry; |
| 19 | import cuchaz.enigma.utils.I18n; | 19 | import cuchaz.enigma.utils.I18n; |
| 20 | 20 | ||
| 21 | import cuchaz.enigma.utils.Utils; | ||
| 21 | import org.objectweb.asm.ClassWriter; | 22 | import org.objectweb.asm.ClassWriter; |
| 22 | import org.objectweb.asm.Opcodes; | 23 | import org.objectweb.asm.Opcodes; |
| 23 | import org.objectweb.asm.tree.ClassNode; | 24 | import org.objectweb.asm.tree.ClassNode; |
| @@ -152,7 +153,7 @@ public class EnigmaProject { | |||
| 152 | ClassNode node = classCache.getClassNode(entry.getFullName()); | 153 | ClassNode node = classCache.getClassNode(entry.getFullName()); |
| 153 | if (node != null) { | 154 | if (node != null) { |
| 154 | ClassNode translatedNode = new ClassNode(); | 155 | ClassNode translatedNode = new ClassNode(); |
| 155 | node.accept(new TranslationClassVisitor(deobfuscator, Opcodes.ASM5, new SourceFixVisitor(Opcodes.ASM5, translatedNode, jarIndex))); | 156 | node.accept(new TranslationClassVisitor(deobfuscator, Utils.ASM_VERSION, new SourceFixVisitor(Utils.ASM_VERSION, translatedNode, jarIndex))); |
| 156 | return translatedNode; | 157 | return translatedNode; |
| 157 | } | 158 | } |
| 158 | 159 | ||
diff --git a/src/main/java/cuchaz/enigma/analysis/BuiltinPlugin.java b/src/main/java/cuchaz/enigma/analysis/BuiltinPlugin.java index fddd9a8e..dc3f5535 100644 --- a/src/main/java/cuchaz/enigma/analysis/BuiltinPlugin.java +++ b/src/main/java/cuchaz/enigma/analysis/BuiltinPlugin.java | |||
| @@ -12,6 +12,7 @@ import cuchaz.enigma.translation.representation.entry.ClassEntry; | |||
| 12 | import cuchaz.enigma.translation.representation.entry.Entry; | 12 | import cuchaz.enigma.translation.representation.entry.Entry; |
| 13 | import cuchaz.enigma.translation.representation.entry.FieldEntry; | 13 | import cuchaz.enigma.translation.representation.entry.FieldEntry; |
| 14 | import cuchaz.enigma.utils.Pair; | 14 | import cuchaz.enigma.utils.Pair; |
| 15 | import cuchaz.enigma.utils.Utils; | ||
| 15 | import org.objectweb.asm.ClassReader; | 16 | import org.objectweb.asm.ClassReader; |
| 16 | import org.objectweb.asm.ClassVisitor; | 17 | import org.objectweb.asm.ClassVisitor; |
| 17 | import org.objectweb.asm.FieldVisitor; | 18 | import org.objectweb.asm.FieldVisitor; |
| @@ -69,7 +70,7 @@ public final class BuiltinPlugin implements EnigmaPlugin { | |||
| 69 | private final List<MethodNode> classInits = new ArrayList<>(); | 70 | private final List<MethodNode> classInits = new ArrayList<>(); |
| 70 | 71 | ||
| 71 | EnumFieldNameFindingVisitor(Map<Entry<?>, String> mappings) { | 72 | EnumFieldNameFindingVisitor(Map<Entry<?>, String> mappings) { |
| 72 | super(Opcodes.ASM7); | 73 | super(Utils.ASM_VERSION); |
| 73 | this.mappings = mappings; | 74 | this.mappings = mappings; |
| 74 | } | 75 | } |
| 75 | 76 | ||
diff --git a/src/main/java/cuchaz/enigma/analysis/ClassCache.java b/src/main/java/cuchaz/enigma/analysis/ClassCache.java index d97b2041..f694bf35 100644 --- a/src/main/java/cuchaz/enigma/analysis/ClassCache.java +++ b/src/main/java/cuchaz/enigma/analysis/ClassCache.java | |||
| @@ -7,6 +7,7 @@ import cuchaz.enigma.ClassProvider; | |||
| 7 | import cuchaz.enigma.ProgressListener; | 7 | import cuchaz.enigma.ProgressListener; |
| 8 | import cuchaz.enigma.analysis.index.JarIndex; | 8 | import cuchaz.enigma.analysis.index.JarIndex; |
| 9 | import cuchaz.enigma.bytecode.translators.LocalVariableFixVisitor; | 9 | import cuchaz.enigma.bytecode.translators.LocalVariableFixVisitor; |
| 10 | import cuchaz.enigma.utils.Utils; | ||
| 10 | import org.objectweb.asm.ClassReader; | 11 | import org.objectweb.asm.ClassReader; |
| 11 | import org.objectweb.asm.ClassVisitor; | 12 | import org.objectweb.asm.ClassVisitor; |
| 12 | import org.objectweb.asm.Opcodes; | 13 | import org.objectweb.asm.Opcodes; |
| @@ -77,7 +78,7 @@ public final class ClassCache implements AutoCloseable, ClassProvider { | |||
| 77 | 78 | ||
| 78 | ClassNode node = new ClassNode(); | 79 | ClassNode node = new ClassNode(); |
| 79 | 80 | ||
| 80 | LocalVariableFixVisitor visitor = new LocalVariableFixVisitor(Opcodes.ASM5, node); | 81 | LocalVariableFixVisitor visitor = new LocalVariableFixVisitor(Utils.ASM_VERSION, node); |
| 81 | reader.accept(visitor, 0); | 82 | reader.accept(visitor, 0); |
| 82 | 83 | ||
| 83 | return node; | 84 | return node; |
diff --git a/src/main/java/cuchaz/enigma/analysis/IndexSimpleVerifier.java b/src/main/java/cuchaz/enigma/analysis/IndexSimpleVerifier.java index da2b5efe..80a71546 100644 --- a/src/main/java/cuchaz/enigma/analysis/IndexSimpleVerifier.java +++ b/src/main/java/cuchaz/enigma/analysis/IndexSimpleVerifier.java | |||
| @@ -5,6 +5,7 @@ import cuchaz.enigma.analysis.index.InheritanceIndex; | |||
| 5 | import cuchaz.enigma.translation.representation.AccessFlags; | 5 | import cuchaz.enigma.translation.representation.AccessFlags; |
| 6 | import cuchaz.enigma.translation.representation.entry.ClassDefEntry; | 6 | import cuchaz.enigma.translation.representation.entry.ClassDefEntry; |
| 7 | import cuchaz.enigma.translation.representation.entry.ClassEntry; | 7 | import cuchaz.enigma.translation.representation.entry.ClassEntry; |
| 8 | import cuchaz.enigma.utils.Utils; | ||
| 8 | import org.objectweb.asm.Type; | 9 | import org.objectweb.asm.Type; |
| 9 | import org.objectweb.asm.tree.analysis.BasicValue; | 10 | import org.objectweb.asm.tree.analysis.BasicValue; |
| 10 | import org.objectweb.asm.tree.analysis.SimpleVerifier; | 11 | import org.objectweb.asm.tree.analysis.SimpleVerifier; |
| @@ -17,7 +18,7 @@ public class IndexSimpleVerifier extends SimpleVerifier { | |||
| 17 | private final InheritanceIndex inheritanceIndex; | 18 | private final InheritanceIndex inheritanceIndex; |
| 18 | 19 | ||
| 19 | public IndexSimpleVerifier(EntryIndex entryIndex, InheritanceIndex inheritanceIndex) { | 20 | public IndexSimpleVerifier(EntryIndex entryIndex, InheritanceIndex inheritanceIndex) { |
| 20 | super(ASM7, null, null, null, false); | 21 | super(Utils.ASM_VERSION, null, null, null, false); |
| 21 | this.entryIndex = entryIndex; | 22 | this.entryIndex = entryIndex; |
| 22 | this.inheritanceIndex = inheritanceIndex; | 23 | this.inheritanceIndex = inheritanceIndex; |
| 23 | } | 24 | } |
diff --git a/src/main/java/cuchaz/enigma/analysis/InterpreterPair.java b/src/main/java/cuchaz/enigma/analysis/InterpreterPair.java index af74c854..f2607291 100644 --- a/src/main/java/cuchaz/enigma/analysis/InterpreterPair.java +++ b/src/main/java/cuchaz/enigma/analysis/InterpreterPair.java | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | package cuchaz.enigma.analysis; | 1 | package cuchaz.enigma.analysis; |
| 2 | 2 | ||
| 3 | import cuchaz.enigma.utils.Utils; | ||
| 3 | import org.objectweb.asm.Opcodes; | 4 | import org.objectweb.asm.Opcodes; |
| 4 | import org.objectweb.asm.Type; | 5 | import org.objectweb.asm.Type; |
| 5 | import org.objectweb.asm.tree.AbstractInsnNode; | 6 | import org.objectweb.asm.tree.AbstractInsnNode; |
| @@ -16,7 +17,7 @@ public class InterpreterPair<V extends Value, W extends Value> extends Interpret | |||
| 16 | private final Interpreter<W> right; | 17 | private final Interpreter<W> right; |
| 17 | 18 | ||
| 18 | public InterpreterPair(Interpreter<V> left, Interpreter<W> right) { | 19 | public InterpreterPair(Interpreter<V> left, Interpreter<W> right) { |
| 19 | super(Opcodes.ASM7); | 20 | super(Utils.ASM_VERSION); |
| 20 | this.left = left; | 21 | this.left = left; |
| 21 | this.right = right; | 22 | this.right = right; |
| 22 | } | 23 | } |
diff --git a/src/main/java/cuchaz/enigma/analysis/index/JarIndex.java b/src/main/java/cuchaz/enigma/analysis/index/JarIndex.java index c96e7747..e401c2f7 100644 --- a/src/main/java/cuchaz/enigma/analysis/index/JarIndex.java +++ b/src/main/java/cuchaz/enigma/analysis/index/JarIndex.java | |||
| @@ -22,6 +22,7 @@ import cuchaz.enigma.translation.representation.Lambda; | |||
| 22 | import cuchaz.enigma.translation.representation.entry.*; | 22 | import cuchaz.enigma.translation.representation.entry.*; |
| 23 | import cuchaz.enigma.utils.I18n; | 23 | import cuchaz.enigma.utils.I18n; |
| 24 | 24 | ||
| 25 | import cuchaz.enigma.utils.Utils; | ||
| 25 | import org.objectweb.asm.ClassReader; | 26 | import org.objectweb.asm.ClassReader; |
| 26 | import org.objectweb.asm.Opcodes; | 27 | import org.objectweb.asm.Opcodes; |
| 27 | 28 | ||
| @@ -63,10 +64,10 @@ public class JarIndex implements JarIndexer { | |||
| 63 | progress.init(4, I18n.translate("progress.jar.indexing")); | 64 | progress.init(4, I18n.translate("progress.jar.indexing")); |
| 64 | 65 | ||
| 65 | progress.step(1, I18n.translate("progress.jar.indexing.entries")); | 66 | progress.step(1, I18n.translate("progress.jar.indexing.entries")); |
| 66 | classCache.visit(() -> new IndexClassVisitor(this, Opcodes.ASM5), ClassReader.SKIP_CODE); | 67 | classCache.visit(() -> new IndexClassVisitor(this, Utils.ASM_VERSION), ClassReader.SKIP_CODE); |
| 67 | 68 | ||
| 68 | progress.step(2, I18n.translate("progress.jar.indexing.references")); | 69 | progress.step(2, I18n.translate("progress.jar.indexing.references")); |
| 69 | classCache.visit(() -> new IndexReferenceVisitor(this, entryIndex, inheritanceIndex, Opcodes.ASM5), 0); | 70 | classCache.visit(() -> new IndexReferenceVisitor(this, entryIndex, inheritanceIndex, Utils.ASM_VERSION), 0); |
| 70 | 71 | ||
| 71 | progress.step(3, I18n.translate("progress.jar.indexing.methods")); | 72 | progress.step(3, I18n.translate("progress.jar.indexing.methods")); |
| 72 | bridgeMethodIndex.findBridgeMethods(); | 73 | bridgeMethodIndex.findBridgeMethods(); |
diff --git a/src/main/java/cuchaz/enigma/bytecode/translators/TranslationSignatureVisitor.java b/src/main/java/cuchaz/enigma/bytecode/translators/TranslationSignatureVisitor.java index e66b085f..8e7780e6 100644 --- a/src/main/java/cuchaz/enigma/bytecode/translators/TranslationSignatureVisitor.java +++ b/src/main/java/cuchaz/enigma/bytecode/translators/TranslationSignatureVisitor.java | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | package cuchaz.enigma.bytecode.translators; | 1 | package cuchaz.enigma.bytecode.translators; |
| 2 | 2 | ||
| 3 | import cuchaz.enigma.utils.Utils; | ||
| 3 | import org.objectweb.asm.Opcodes; | 4 | import org.objectweb.asm.Opcodes; |
| 4 | import org.objectweb.asm.signature.SignatureVisitor; | 5 | import org.objectweb.asm.signature.SignatureVisitor; |
| 5 | 6 | ||
| @@ -13,7 +14,7 @@ public class TranslationSignatureVisitor extends SignatureVisitor { | |||
| 13 | private final Stack<String> classStack = new Stack<>(); | 14 | private final Stack<String> classStack = new Stack<>(); |
| 14 | 15 | ||
| 15 | public TranslationSignatureVisitor(Function<String, String> remapper, SignatureVisitor sv) { | 16 | public TranslationSignatureVisitor(Function<String, String> remapper, SignatureVisitor sv) { |
| 16 | super(Opcodes.ASM5); | 17 | super(Utils.ASM_VERSION); |
| 17 | this.remapper = remapper; | 18 | this.remapper = remapper; |
| 18 | this.sv = sv; | 19 | this.sv = sv; |
| 19 | } | 20 | } |
diff --git a/src/main/java/cuchaz/enigma/gui/GuiController.java b/src/main/java/cuchaz/enigma/gui/GuiController.java index 17c81dde..261238b7 100644 --- a/src/main/java/cuchaz/enigma/gui/GuiController.java +++ b/src/main/java/cuchaz/enigma/gui/GuiController.java | |||
| @@ -111,7 +111,7 @@ public class GuiController { | |||
| 111 | } | 111 | } |
| 112 | 112 | ||
| 113 | ClassNode fixedNode = new ClassNode(); | 113 | ClassNode fixedNode = new ClassNode(); |
| 114 | node.accept(new SourceFixVisitor(Opcodes.ASM7, fixedNode, project.getJarIndex())); | 114 | node.accept(new SourceFixVisitor(Utils.ASM_VERSION, fixedNode, project.getJarIndex())); |
| 115 | return fixedNode; | 115 | return fixedNode; |
| 116 | }, new SourceSettings(true, true)); | 116 | }, new SourceSettings(true, true)); |
| 117 | } | 117 | } |
diff --git a/src/main/java/cuchaz/enigma/utils/Utils.java b/src/main/java/cuchaz/enigma/utils/Utils.java index 17f6fb8f..b8f2ec23 100644 --- a/src/main/java/cuchaz/enigma/utils/Utils.java +++ b/src/main/java/cuchaz/enigma/utils/Utils.java | |||
| @@ -12,6 +12,7 @@ | |||
| 12 | package cuchaz.enigma.utils; | 12 | package cuchaz.enigma.utils; |
| 13 | 13 | ||
| 14 | import com.google.common.io.CharStreams; | 14 | import com.google.common.io.CharStreams; |
| 15 | import org.objectweb.asm.Opcodes; | ||
| 15 | 16 | ||
| 16 | import javax.swing.*; | 17 | import javax.swing.*; |
| 17 | import java.awt.*; | 18 | import java.awt.*; |
| @@ -30,6 +31,8 @@ import java.util.StringJoiner; | |||
| 30 | import java.util.stream.Collectors; | 31 | import java.util.stream.Collectors; |
| 31 | 32 | ||
| 32 | public class Utils { | 33 | public class Utils { |
| 34 | |||
| 35 | public static final int ASM_VERSION = Opcodes.ASM8; | ||
| 33 | 36 | ||
| 34 | public static int combineHashesOrdered(Object... objs) { | 37 | public static int combineHashesOrdered(Object... objs) { |
| 35 | final int prime = 67; | 38 | final int prime = 67; |