public void visitJumpInsn(final int opcode, final Label label) {
if (opcode == Opcodes.GOTO) {
recorder.add(new Runnable() {
public void run() {
block.addOp(new Transform(lineNumber, "GOTO", null, null, null));
block.unconditionalGoto(label);
}
});
} else if (opcode == Opcodes.JSR) {
recorder.add(new Runnable() {
public void run() {
block.jumpSubroutine(label, lineNumber);
}
});
} else {
recorder.add(new Runnable() {
public void run() {
cyclomaticComplexity.add(lineNumber);
switch (opcode) {
case Opcodes.IFEQ :
if1("IFEQ");
break;
case Opcodes.IFNE :
if1("IFNE");
break;
case Opcodes.IFLT :
if1("IFLT");
break;
case Opcodes.IFGE :
if1("IFGE");
break;
case Opcodes.IFGT :
if1("IFGT");
break;
case Opcodes.IFLE :
if1("IFLE");
break;
case Opcodes.IFNONNULL :
if1("IFNONNULL");
break;
case Opcodes.IFNULL :
if1("IFNULL");
break;
case Opcodes.IF_ACMPEQ :
if2("IF_ACMPEQ");
break;
case Opcodes.IF_ACMPNE :
if2("IF_ACMPNE");
break;
case Opcodes.IF_ICMPEQ :
if2("IF_ICMPEQ");
break;
case Opcodes.IF_ICMPGE :
if2("IF_ICMPGE");
break;
case Opcodes.IF_ICMPGT :
if2("IF_ICMPGT");
break;
case Opcodes.IF_ICMPLE :
if2("IF_ICMPLE");
break;
case Opcodes.IF_ICMPLT :
if2("IF_ICMPLT");
break;
case Opcodes.IF_ICMPNE :
if2("IF_ICMPNE");
break;
default :
throw new UnsupportedOperationException("" + opcode);
}
block.conditionalGoto(label);
}
private void if1(String name) {
block.addOp(new Transform(lineNumber, name, JavaType.INT, null, null));
}
private void if2(String name) {
block.addOp(new Transform(lineNumber, name, JavaType.INT, JavaType.INT, null));
}
});
}
}