// Method takes no arguments, or takes no reference arguments
return;
}
// See if any null arguments are passed
IsNullValueFrame frame = classContext.getIsNullValueDataflow(method).getFactAtLocation(location);
if (!frame.isValid()) {
return;
}
/*
if (false && methodName.equals("checkNotNull")
&& invokeInstruction.getClassName(cpg).equals("com.google.common.base.Preconditions")) {
SignatureParser sigParser = new SignatureParser(signature);
int numParameters = sigParser.getNumParameters();
IsNullValue value = frame.getArgument(invokeInstruction, cpg, 0, sigParser);
if (value.isDefinitelyNotNull()) {
TypeFrame typeFrame = typeDataflow.getFactAtLocation(location);
int priority = NORMAL_PRIORITY;
String pattern = "RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE";
ValueNumberFrame vnFrame = vnaDataflow.getFactAtLocation(location);
ValueNumber valueNumber = vnFrame.getArgument(invokeInstruction, cpg, 0, sigParser);
org.apache.bcel.generic.Type typeOfFirstArgument = typeFrame.getArgument(invokeInstruction, cpg, 0, sigParser);
String signature2 = typeOfFirstArgument.getSignature();
boolean constantStringForFirstArgument = signature2.equals("Ljava/lang/String;")
&& valueNumber.hasFlag(ValueNumber.CONSTANT_VALUE);
@CheckForNull
BugAnnotation annotation = BugInstance.getSourceForStackValue(classContext, method, location, numParameters - 1);
if (value.wouldHaveBeenAKaboom()) {
pattern = "RCN_REDUNDANT_NULLCHECK_WOULD_HAVE_BEEN_A_NPE";
priority = HIGH_PRIORITY;
} else if (constantStringForFirstArgument) {
annotation = null;
priority = HIGH_PRIORITY;
if (numParameters == 2) {
IsNullValue secondValue = frame.getArgument(invokeInstruction, cpg, 1, sigParser);
if (!secondValue.isDefinitelyNotNull()) {
pattern = "DMI_ARGUMENTS_WRONG_ORDER";
priority = NORMAL_PRIORITY;
}
}
}
BugInstance warning = new BugInstance(this, pattern, priority)
.addClassAndMethod(classContext.getJavaClass(), method).addOptionalAnnotation(annotation)
.addCalledMethod(cpg, invokeInstruction).addSourceLine(classContext, method, location);
bugReporter.reportBug(warning);
}
}
*/
BitSet nullArgSet = frame.getArgumentSet(invokeInstruction, cpg, new DataflowValueChooser<IsNullValue>() {
@Override
public boolean choose(IsNullValue value) {
// Only choose non-exception values.
// Values null on an exception path might be due to
// infeasible control flow.
return value.mightBeNull() && !value.isException() && !value.isReturnValue();
}
});
BitSet definitelyNullArgSet = frame.getArgumentSet(invokeInstruction, cpg, new DataflowValueChooser<IsNullValue>() {
@Override
public boolean choose(IsNullValue value) {
return value.isDefinitelyNull();
}
});
nullArgSet.and(definitelyNullArgSet);
if (nullArgSet.isEmpty()) {
return;
}
if (DEBUG_NULLARG) {
System.out.println("Null arguments passed: " + nullArgSet);
System.out.println("Frame is: " + frame);
System.out.println("# arguments: " + frame.getNumArguments(invokeInstruction, cpg));
XMethod xm = XFactory.createXMethod(invokeInstruction, cpg);
System.out.print("Signature: " + xm.getSignature());
}
if (unconditionalDerefParamDatabase != null) {