diff --git a/core/src/main/java/org/teavm/parsing/ProgramParser.java b/core/src/main/java/org/teavm/parsing/ProgramParser.java index 3addd6f11..27a0e1825 100644 --- a/core/src/main/java/org/teavm/parsing/ProgramParser.java +++ b/core/src/main/java/org/teavm/parsing/ProgramParser.java @@ -28,10 +28,10 @@ import org.teavm.model.util.ProgramUtils; * @author Alexey Andreev */ public class ProgramParser implements VariableDebugInformation { - static final byte ROOT = 0; - static final byte SINGLE = 1; - static final byte DOUBLE_FIRST_HALF = 2; - static final byte DOUBLE_SECOND_HALF = 3; + private static final byte ROOT = 0; + private static final byte SINGLE = 1; + private static final byte DOUBLE_FIRST_HALF = 2; + private static final byte DOUBLE_SECOND_HALF = 3; private String fileName; private StackFrame[] stackBefore; private StackFrame[] stackAfter; @@ -60,17 +60,17 @@ public class ProgramParser implements VariableDebugInformation { } private static class StackFrame { - public final StackFrame next; - public final byte type; - public final int depth; + final StackFrame next; + final byte type; + final int depth; - public StackFrame(int depth) { + StackFrame(int depth) { this.next = null; this.type = ROOT; this.depth = depth; } - public StackFrame(StackFrame next, byte type) { + StackFrame(StackFrame next, byte type) { this.next = next; this.type = type; this.depth = next != null ? next.depth + 1 : 0; @@ -162,7 +162,7 @@ public class ProgramParser implements VariableDebugInformation { @Override public Map getDebugNames(Instruction insn) { Map map = variableDebugNames.get(insn); - return map != null ? Collections.unmodifiableMap(map) : Collections.emptyMap(); + return map != null ? Collections.unmodifiableMap(map) : Collections.emptyMap(); } private void prepare(MethodNode method) { @@ -513,8 +513,8 @@ public class ProgramParser implements VariableDebugInformation { } insn.setMethod(new MethodDescriptor(name, MethodDescriptor.parseSignature(desc))); - for (int i = 0; i < bsmArgs.length; ++i) { - insn.getBootstrapArguments().add(convertConstant(bsmArgs[i])); + for (Object bsmArg : bsmArgs) { + insn.getBootstrapArguments().add(convertConstant(bsmArg)); } addInstruction(insn); @@ -1200,8 +1200,9 @@ public class ProgramParser implements VariableDebugInformation { case Opcodes.SWAP: { int b = popSingle(); int a = popSingle(); - int tmp = pushSingle(); pushSingle(); + pushSingle(); + int tmp = b + 1; emitAssignInsn(a, tmp); emitAssignInsn(b, a); emitAssignInsn(tmp, b); @@ -1726,7 +1727,7 @@ public class ProgramParser implements VariableDebugInformation { } }; - static MethodHandle parseHandle(Handle handle) { + private static MethodHandle parseHandle(Handle handle) { switch (handle.getTag()) { case Opcodes.H_GETFIELD: return MethodHandle.fieldGetter(handle.getOwner().replace('/', '.'), handle.getName(),