diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/impl/JCLComparisonVisitor.java b/teavm-classlib/src/main/java/org/teavm/classlib/impl/JCLComparisonVisitor.java index 58ff4f64a..54aa85b63 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/impl/JCLComparisonVisitor.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/impl/JCLComparisonVisitor.java @@ -24,7 +24,7 @@ import org.teavm.model.ClassReader; * * @author Alexey Andreev */ -class JCLComparisonVisitor implements ClassVisitor { +class JCLComparisonVisitor extends ClassVisitor { private Map packageMap; private ClassReaderSource classSource; private ClassReader classReader; @@ -32,6 +32,7 @@ class JCLComparisonVisitor implements ClassVisitor { private JCLClass jclClass; public JCLComparisonVisitor(ClassReaderSource classSource, Map packageMap) { + super(Opcodes.ASM4); this.classSource = classSource; this.packageMap = packageMap; } diff --git a/teavm-core/pom.xml b/teavm-core/pom.xml index b0423ce65..b081e90f7 100644 --- a/teavm-core/pom.xml +++ b/teavm-core/pom.xml @@ -37,9 +37,9 @@ 2.4 - asm + org.ow2.asm asm-debug-all - 3.3.1 + 4.2 diff --git a/teavm-core/src/main/java/org/teavm/parsing/Parser.java b/teavm-core/src/main/java/org/teavm/parsing/Parser.java index e12c76590..fb1ac25b7 100644 --- a/teavm-core/src/main/java/org/teavm/parsing/Parser.java +++ b/teavm-core/src/main/java/org/teavm/parsing/Parser.java @@ -41,7 +41,7 @@ public final class Parser { SSATransformer ssaProducer = new SSATransformer(); ssaProducer.transformToSSA(program, method.getParameterTypes()); method.setProgram(program); - parseAnnotations(method.getAnnotations(), node); + parseAnnotations(method.getAnnotations(), node.visibleAnnotations, node.invisibleAnnotations); while (program.variableCount() <= method.parameterCount()) { program.createVariable(); } @@ -75,7 +75,7 @@ public final class Parser { cls.setOwnerName(node.name.substring(0, lastIndex).replace('/', '.')); } } - parseAnnotations(cls.getAnnotations(), node); + parseAnnotations(cls.getAnnotations(), node.visibleAnnotations, node.invisibleAnnotations); return cls; } @@ -84,7 +84,7 @@ public final class Parser { field.setType(ValueType.parse(node.desc)); field.setInitialValue(node.value); parseModifiers(node.access, field); - parseAnnotations(field.getAnnotations(), node); + parseAnnotations(field.getAnnotations(), node.visibleAnnotations, node.invisibleAnnotations); return field; } @@ -147,14 +147,14 @@ public final class Parser { } } - @SuppressWarnings("unchecked") - private static void parseAnnotations(AnnotationContainer annotations, MemberNode node) { + private static void parseAnnotations(AnnotationContainer annotations, List visibleAnnotations, + List invisibleAnnotations) { List annotNodes = new ArrayList<>(); - if (node.visibleAnnotations != null) { - annotNodes.addAll(node.visibleAnnotations); + if (visibleAnnotations != null) { + annotNodes.addAll(visibleAnnotations); } - if (node.invisibleAnnotations != null) { - annotNodes.addAll(node.invisibleAnnotations); + if (invisibleAnnotations != null) { + annotNodes.addAll(invisibleAnnotations); } for (Object obj : annotNodes) { AnnotationNode annotNode = (AnnotationNode)obj; @@ -180,7 +180,6 @@ public final class Parser { } } - @SuppressWarnings("unchecked") private static AnnotationValue parseAnnotationValue(Object value) { if (value instanceof String[]) { String[] enumInfo = (String[])value; diff --git a/teavm-core/src/main/java/org/teavm/parsing/ProgramParser.java b/teavm-core/src/main/java/org/teavm/parsing/ProgramParser.java index 0fa2d575b..84bcb90d1 100644 --- a/teavm-core/src/main/java/org/teavm/parsing/ProgramParser.java +++ b/teavm-core/src/main/java/org/teavm/parsing/ProgramParser.java @@ -296,7 +296,8 @@ public class ProgramParser { return local; } - private MethodVisitor methodVisitor = new MethodVisitor() { + // TODO: invokedynamic support (a great task, involving not only parser, but every layer of TeaVM) + private MethodVisitor methodVisitor = new MethodVisitor(Opcodes.ASM4) { @Override public void visitVarInsn(int opcode, int local) { switch (opcode) { @@ -373,7 +374,7 @@ public class ProgramParser { } @Override - public void visitTableSwitchInsn(int min, int max, Label dflt, Label[] labels) { + public void visitTableSwitchInsn(int min, int max, Label dflt, Label... labels) { SwitchTableEntry[] table = new SwitchTableEntry[labels.length]; nextIndexes = new int[labels.length + 1]; for (int i = 0; i < labels.length; ++i) {