From ccccfa1786d783867daf91fbfa522d4a5c55dfdb Mon Sep 17 00:00:00 2001 From: liach Date: Thu, 2 Apr 2020 10:36:27 -0500 Subject: Support java 9+ and gradle 6+ (#206) * Support java 9+ and gradle 6+ * Update asm Signed-off-by: liach * Use asm 8 and move that to a constant * Bump version * fix version format Co-authored-by: liach --- src/main/java/cuchaz/enigma/analysis/BuiltinPlugin.java | 3 ++- src/main/java/cuchaz/enigma/analysis/ClassCache.java | 3 ++- src/main/java/cuchaz/enigma/analysis/IndexSimpleVerifier.java | 3 ++- src/main/java/cuchaz/enigma/analysis/InterpreterPair.java | 3 ++- src/main/java/cuchaz/enigma/analysis/index/JarIndex.java | 5 +++-- 5 files changed, 11 insertions(+), 6 deletions(-) (limited to 'src/main/java/cuchaz/enigma/analysis') diff --git a/src/main/java/cuchaz/enigma/analysis/BuiltinPlugin.java b/src/main/java/cuchaz/enigma/analysis/BuiltinPlugin.java index fddd9a8..dc3f553 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; import cuchaz.enigma.translation.representation.entry.Entry; import cuchaz.enigma.translation.representation.entry.FieldEntry; import cuchaz.enigma.utils.Pair; +import cuchaz.enigma.utils.Utils; import org.objectweb.asm.ClassReader; import org.objectweb.asm.ClassVisitor; import org.objectweb.asm.FieldVisitor; @@ -69,7 +70,7 @@ public final class BuiltinPlugin implements EnigmaPlugin { private final List classInits = new ArrayList<>(); EnumFieldNameFindingVisitor(Map, String> mappings) { - super(Opcodes.ASM7); + super(Utils.ASM_VERSION); this.mappings = mappings; } diff --git a/src/main/java/cuchaz/enigma/analysis/ClassCache.java b/src/main/java/cuchaz/enigma/analysis/ClassCache.java index d97b204..f694bf3 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; import cuchaz.enigma.ProgressListener; import cuchaz.enigma.analysis.index.JarIndex; import cuchaz.enigma.bytecode.translators.LocalVariableFixVisitor; +import cuchaz.enigma.utils.Utils; import org.objectweb.asm.ClassReader; import org.objectweb.asm.ClassVisitor; import org.objectweb.asm.Opcodes; @@ -77,7 +78,7 @@ public final class ClassCache implements AutoCloseable, ClassProvider { ClassNode node = new ClassNode(); - LocalVariableFixVisitor visitor = new LocalVariableFixVisitor(Opcodes.ASM5, node); + LocalVariableFixVisitor visitor = new LocalVariableFixVisitor(Utils.ASM_VERSION, node); reader.accept(visitor, 0); return node; diff --git a/src/main/java/cuchaz/enigma/analysis/IndexSimpleVerifier.java b/src/main/java/cuchaz/enigma/analysis/IndexSimpleVerifier.java index da2b5ef..80a7154 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; import cuchaz.enigma.translation.representation.AccessFlags; import cuchaz.enigma.translation.representation.entry.ClassDefEntry; import cuchaz.enigma.translation.representation.entry.ClassEntry; +import cuchaz.enigma.utils.Utils; import org.objectweb.asm.Type; import org.objectweb.asm.tree.analysis.BasicValue; import org.objectweb.asm.tree.analysis.SimpleVerifier; @@ -17,7 +18,7 @@ public class IndexSimpleVerifier extends SimpleVerifier { private final InheritanceIndex inheritanceIndex; public IndexSimpleVerifier(EntryIndex entryIndex, InheritanceIndex inheritanceIndex) { - super(ASM7, null, null, null, false); + super(Utils.ASM_VERSION, null, null, null, false); this.entryIndex = entryIndex; this.inheritanceIndex = inheritanceIndex; } diff --git a/src/main/java/cuchaz/enigma/analysis/InterpreterPair.java b/src/main/java/cuchaz/enigma/analysis/InterpreterPair.java index af74c85..f260729 100644 --- a/src/main/java/cuchaz/enigma/analysis/InterpreterPair.java +++ b/src/main/java/cuchaz/enigma/analysis/InterpreterPair.java @@ -1,5 +1,6 @@ package cuchaz.enigma.analysis; +import cuchaz.enigma.utils.Utils; import org.objectweb.asm.Opcodes; import org.objectweb.asm.Type; import org.objectweb.asm.tree.AbstractInsnNode; @@ -16,7 +17,7 @@ public class InterpreterPair extends Interpret private final Interpreter right; public InterpreterPair(Interpreter left, Interpreter right) { - super(Opcodes.ASM7); + super(Utils.ASM_VERSION); this.left = left; this.right = right; } diff --git a/src/main/java/cuchaz/enigma/analysis/index/JarIndex.java b/src/main/java/cuchaz/enigma/analysis/index/JarIndex.java index c96e774..e401c2f 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; import cuchaz.enigma.translation.representation.entry.*; import cuchaz.enigma.utils.I18n; +import cuchaz.enigma.utils.Utils; import org.objectweb.asm.ClassReader; import org.objectweb.asm.Opcodes; @@ -63,10 +64,10 @@ public class JarIndex implements JarIndexer { progress.init(4, I18n.translate("progress.jar.indexing")); progress.step(1, I18n.translate("progress.jar.indexing.entries")); - classCache.visit(() -> new IndexClassVisitor(this, Opcodes.ASM5), ClassReader.SKIP_CODE); + classCache.visit(() -> new IndexClassVisitor(this, Utils.ASM_VERSION), ClassReader.SKIP_CODE); progress.step(2, I18n.translate("progress.jar.indexing.references")); - classCache.visit(() -> new IndexReferenceVisitor(this, entryIndex, inheritanceIndex, Opcodes.ASM5), 0); + classCache.visit(() -> new IndexReferenceVisitor(this, entryIndex, inheritanceIndex, Utils.ASM_VERSION), 0); progress.step(3, I18n.translate("progress.jar.indexing.methods")); bridgeMethodIndex.findBridgeMethods(); -- cgit v1.2.3