@Override
public void sawOpcode(int seen) {
if (isMethodCall()) {
MethodDescriptor called = getMethodDescriptorOperand();
if (previousMethodCall != null && !stack.isJumpTarget(getPC())) {
if (called.getName().equals("toString")
&& called.getClassDescriptor().getClassName().equals("java/lang/Integer")
&& previousMethodCall.getName().equals("valueOf")
&& previousMethodCall.getSignature().equals("(I)Ljava/lang/Integer;")
) {
MethodAnnotation preferred = new MethodAnnotation("java.lang.Integer", "toString", "(I)Ljava/lang/String;", true);
BugInstance bug = new BugInstance(this, "DM_BOXED_PRIMITIVE_TOSTRING", HIGH_PRIORITY).addClassAndMethod(this)
.addCalledMethod(this).addMethod(preferred).describe(MethodAnnotation.SHOULD_CALL);
accumulator.accumulateBug(bug, this);
} else if (called.getName().equals("intValue")
&& called.getClassDescriptor().getClassName().equals("java/lang/Integer")
&& previousMethodCall.getSlashedClassName().equals("java/lang/Integer")
&& (previousMethodCall.getName().equals("<init>")
&& previousMethodCall.getSignature().equals("(Ljava/lang/String;)V")
|| previousMethodCall.getName().equals("valueOf")
&& previousMethodCall.getSignature().equals("(Ljava/lang/String;)Ljava/lang/Integer;")
)) {
MethodAnnotation preferred = new MethodAnnotation("java.lang.Integer", "parseInt", "(Ljava/lang/String;)I", true);
BugInstance bug = new BugInstance(this, "DM_BOXED_PRIMITIVE_FOR_PARSING", HIGH_PRIORITY).addClassAndMethod(this)
.addCalledMethod(this).addMethod(preferred).describe(MethodAnnotation.SHOULD_CALL);
accumulator.accumulateBug(bug, this);
} else if (called.getName().equals("longValue")
&& called.getClassDescriptor().getClassName().equals("java/lang/Long")
&& previousMethodCall.getSlashedClassName().equals("java/lang/Long")
&& ( previousMethodCall.getName().equals("<init>")
&& previousMethodCall.getSignature().equals("(Ljava/lang/String;)V")
|| previousMethodCall.getName().equals("valueOf")
&& previousMethodCall.getSignature().equals("(Ljava/lang/String;)Ljava/lang/Long;"))