Skip to content

Commit

Permalink
move default to the end of switch-case
Browse files Browse the repository at this point in the history
  • Loading branch information
JuditKnoll committed Dec 3, 2024
1 parent 5e08fc5 commit 755b093
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,6 @@ public void visit(Code code) {
@Override
public void sawOpcode(int seen) {
switch (seen) {
default:
break;
case Const.IF_ICMPEQ:
case Const.IF_ICMPNE:
OpcodeStack.Item left = stack.getStackItem(1);
Expand All @@ -114,6 +112,8 @@ public void sawOpcode(int seen) {
.addString("Just check the sign of the result of compare or compareTo, not specific values such as 1 or -1"), this);
}
break;
default:
break;
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,6 @@ private void analyzeMethod(ClassContext classContext, Method method, Path classD
BasicBlock src = edge.getSource();
BasicBlock tgt = edge.getTarget();
switch (edge.getType()) {
default:
out.println(" Node" + src.getLabel() + " -> Node" + tgt.getLabel() + ";");
break;
case IFCMP_EDGE:
out.println(" Node" + src.getLabel() + " -> Node" + tgt.getLabel() +
" [shape=plaintext label=\" True branch\"];");
Expand Down Expand Up @@ -161,6 +158,9 @@ private void analyzeMethod(ClassContext classContext, Method method, Path classD
out.println(" Node" + src.getLabel() + " -> Node" + tgt.getLabel() +
" [shape=plaintext label=\" GOTO statement\"];");
break;
default:
out.println(" Node" + src.getLabel() + " -> Node" + tgt.getLabel() + ";");
break;
}
}
out.println("}");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,14 +200,13 @@ public ClassDescriptor getClassDescriptorOperand() {

public boolean isMethodCall() {
switch (opcode) {
default:
return false;
case Const.INVOKEINTERFACE:
case Const.INVOKESPECIAL:
case Const.INVOKEVIRTUAL:
case Const.INVOKESTATIC:
return true;

default:
return false;
}
}

Expand Down

0 comments on commit 755b093

Please sign in to comment.