.addClassAndMethod(methodGen, sourceFile).addFoundAndExpectedType(refType, castType) .addSourceLine(sourceLineAnnotation)); if (!isCast) { accumulator.accumulateBug(new BugInstance(this, "BC_VACUOUS_INSTANCEOF", NORMAL_PRIORITY) .addClassAndMethod(methodGen, sourceFile).addFoundAndExpectedType(refType, castType), sourceLineAnnotation); .addFoundAndExpectedType(refType, castType).addOptionalUniqueAnnotations(valueSource, source) .addSourceLine(sourceLineAnnotation)); } else if (isCast && rank < 0.9 .addClassAndMethod(methodGen, sourceFile).addFoundAndExpectedType(refType, castType) .addOptionalAnnotation(valueSource); bugReporter.reportBug(new BugInstance(this, "BC_IMPOSSIBLE_DOWNCAST_OF_TOARRAY", HIGH_PRIORITY) .addClassAndMethod(methodGen, sourceFile) .addFoundAndExpectedType(refType, castType).addOptionalUniqueAnnotations(valueSource, source) .addSourceLine(sourceLineAnnotation));
.addClassAndMethod(methodGen, sourceFile) .addString("Calling assertSame with two distinct objects") .addFoundAndExpectedType(rhsType, lhsType) .addSomeSourceForTopTwoStackValues(classContext, method, location), SourceLineAnnotation.fromVisitedInstruction(classContext, methodGen, sourceFile, handle)); bugAccumulator.accumulateBug( new BugInstance(this, "EC_UNRELATED_TYPES_USING_POINTER_EQUALITY", result.getPriority()) .addClassAndMethod(methodGen, sourceFile).addFoundAndExpectedType(rhsType, lhsType) .addSomeSourceForTopTwoStackValues(classContext, method, location), SourceLineAnnotation.fromVisitedInstruction(classContext, methodGen, sourceFile, handle));
.addFoundAndExpectedType(valueItem.getSignature(), arraySignature) .addSourceLine(this).addValueSource(valueItem, this); if(field != null) { .addFoundAndExpectedType(valueSignature, 'L'+arrayClass+';') .addSourceLine(this) .addValueSource(valueItem, this)
.addMethod(m).addClass(m2.getClassName()).describe(ClassAnnotation.SUPERCLASS_ROLE) .addMethod(m2).describe(MethodAnnotation.METHOD_DID_YOU_MEAN_TO_OVERRIDE) .addFoundAndExpectedType(p, p2); if (m3 != null) { bug.addMethod(m3).describe(MethodAnnotation.METHOD_OVERRIDDEN);
.addFoundAndExpectedType(actualType, expectedType) .addCalledMethod(methodGen, (InvokeInstruction) ins) .addOptionalAnnotation(
.addFoundAndExpectedType(rhsType_, lhsType_) .addSomeSourceForTopTwoStackValues(classContext, method, location) .addOptionalAnnotation(calledMethodAnnotation, MethodAnnotation.METHOD_CALLED), .addClassAndMethod(methodGen, sourceFile).addFoundAndExpectedType(rhsType_, lhsType_) .addSomeSourceForTopTwoStackValues(classContext, method, location) .addOptionalAnnotation(calledMethodAnnotation, MethodAnnotation.METHOD_CALLED), bugAccumulator.accumulateBug( new BugInstance(this, "EC_UNRELATED_TYPES", priority) .addClassAndMethod(methodGen, sourceFile).addFoundAndExpectedType(rhsType_, lhsType_) .addSomeSourceForTopTwoStackValues(classContext, method, location).addEqualsMethodUsed(targets) .addOptionalAnnotation(calledMethodAnnotation, MethodAnnotation.METHOD_CALLED), bugAccumulator.accumulateBug( new BugInstance(this, "EC_UNRELATED_CLASS_AND_INTERFACE", result.getPriority() + priorityModifier) .addClassAndMethod(methodGen, sourceFile).addFoundAndExpectedType(rhsType_, lhsType_) .addSomeSourceForTopTwoStackValues(classContext, method, location) .addEqualsMethodUsed(DescriptorFactory.createClassDescriptorFromSignature(lhsType_.getSignature())) bugAccumulator.accumulateBug( new BugInstance(this, "EC_UNRELATED_INTERFACES", result.getPriority() + priorityModifier) .addClassAndMethod(methodGen, sourceFile).addFoundAndExpectedType(rhsType_, lhsType_) .addSomeSourceForTopTwoStackValues(classContext, method, location) .addEqualsMethodUsed(DescriptorFactory.createClassDescriptorFromSignature(lhsType_.getSignature())) } else if (result != IncompatibleTypes.UNCHECKED && result.getPriority() <= Priorities.LOW_PRIORITY) { bugAccumulator.accumulateBug(new BugInstance(this, "EC_UNRELATED_TYPES", result.getPriority() + priorityModifier) .addClassAndMethod(methodGen, sourceFile).addFoundAndExpectedType(rhsType_, lhsType_)
.addClassAndMethod(methodGen, sourceFile).addFoundAndExpectedType(refType, castType) .addSourceLine(sourceLineAnnotation)); if (!isCast) { accumulator.accumulateBug(new BugInstance(this, "BC_VACUOUS_INSTANCEOF", NORMAL_PRIORITY) .addClassAndMethod(methodGen, sourceFile).addFoundAndExpectedType(refType, castType), sourceLineAnnotation); .addFoundAndExpectedType(refType, castType).addOptionalUniqueAnnotations(valueSource, source) .addSourceLine(sourceLineAnnotation)); } else if (isCast && rank < 0.9 .addClassAndMethod(methodGen, sourceFile).addFoundAndExpectedType(refType, castType) .addOptionalAnnotation(valueSource); bugReporter.reportBug(new BugInstance(this, "BC_IMPOSSIBLE_DOWNCAST_OF_TOARRAY", HIGH_PRIORITY) .addClassAndMethod(methodGen, sourceFile) .addFoundAndExpectedType(refType, castType).addOptionalUniqueAnnotations(valueSource, source) .addSourceLine(sourceLineAnnotation));
.addFoundAndExpectedType(valueItem.getSignature(), arraySignature) .addSourceLine(this).addValueSource(valueItem, this); if(field != null) { .addFoundAndExpectedType(valueSignature, 'L'+arrayClass+';') .addSourceLine(this) .addValueSource(valueItem, this)
.addClassAndMethod(methodGen, sourceFile) .addString("Calling assertSame with two distinct objects") .addFoundAndExpectedType(rhsType, lhsType) .addSomeSourceForTopTwoStackValues(classContext, method, location), SourceLineAnnotation.fromVisitedInstruction(classContext, methodGen, sourceFile, handle)); bugAccumulator.accumulateBug( new BugInstance(this, "EC_UNRELATED_TYPES_USING_POINTER_EQUALITY", result.getPriority()) .addClassAndMethod(methodGen, sourceFile).addFoundAndExpectedType(rhsType, lhsType) .addSomeSourceForTopTwoStackValues(classContext, method, location), SourceLineAnnotation.fromVisitedInstruction(classContext, methodGen, sourceFile, handle));
.addMethod(m).addClass(m2.getClassName()).describe(ClassAnnotation.SUPERCLASS_ROLE) .addMethod(m2).describe(MethodAnnotation.METHOD_DID_YOU_MEAN_TO_OVERRIDE) .addFoundAndExpectedType(p, p2); if (m3 != null) { bug.addMethod(m3).describe(MethodAnnotation.METHOD_OVERRIDDEN);
.addFoundAndExpectedType(actualType, expectedType) .addCalledMethod(methodGen, (InvokeInstruction) ins) .addOptionalAnnotation(
.addFoundAndExpectedType(rhsType_, lhsType_) .addSomeSourceForTopTwoStackValues(classContext, method, location) .addOptionalAnnotation(calledMethodAnnotation, MethodAnnotation.METHOD_CALLED), .addClassAndMethod(methodGen, sourceFile).addFoundAndExpectedType(rhsType_, lhsType_) .addSomeSourceForTopTwoStackValues(classContext, method, location) .addOptionalAnnotation(calledMethodAnnotation, MethodAnnotation.METHOD_CALLED), bugAccumulator.accumulateBug( new BugInstance(this, "EC_UNRELATED_TYPES", priority) .addClassAndMethod(methodGen, sourceFile).addFoundAndExpectedType(rhsType_, lhsType_) .addSomeSourceForTopTwoStackValues(classContext, method, location).addEqualsMethodUsed(targets) .addOptionalAnnotation(calledMethodAnnotation, MethodAnnotation.METHOD_CALLED), bugAccumulator.accumulateBug( new BugInstance(this, "EC_UNRELATED_CLASS_AND_INTERFACE", result.getPriority() + priorityModifier) .addClassAndMethod(methodGen, sourceFile).addFoundAndExpectedType(rhsType_, lhsType_) .addSomeSourceForTopTwoStackValues(classContext, method, location) .addEqualsMethodUsed(DescriptorFactory.createClassDescriptorFromSignature(lhsType_.getSignature())) bugAccumulator.accumulateBug( new BugInstance(this, "EC_UNRELATED_INTERFACES", result.getPriority() + priorityModifier) .addClassAndMethod(methodGen, sourceFile).addFoundAndExpectedType(rhsType_, lhsType_) .addSomeSourceForTopTwoStackValues(classContext, method, location) .addEqualsMethodUsed(DescriptorFactory.createClassDescriptorFromSignature(lhsType_.getSignature())) } else if (result != IncompatibleTypes.UNCHECKED && result.getPriority() <= Priorities.LOW_PRIORITY) { bugAccumulator.accumulateBug(new BugInstance(this, "EC_UNRELATED_TYPES", result.getPriority() + priorityModifier) .addClassAndMethod(methodGen, sourceFile).addFoundAndExpectedType(rhsType_, lhsType_)