本文整理汇总了Java中edu.umd.cs.findbugs.ba.npe.NullDerefAndRedundantComparisonFinder类的典型用法代码示例。如果您正苦于以下问题:Java NullDerefAndRedundantComparisonFinder类的具体用法?Java NullDerefAndRedundantComparisonFinder怎么用?Java NullDerefAndRedundantComparisonFinder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
NullDerefAndRedundantComparisonFinder类属于edu.umd.cs.findbugs.ba.npe包,在下文中一共展示了NullDerefAndRedundantComparisonFinder类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: analyzeMethod
import edu.umd.cs.findbugs.ba.npe.NullDerefAndRedundantComparisonFinder; //导入依赖的package包/类
private void analyzeMethod(ClassContext classContext, Method method) throws DataflowAnalysisException, CFGBuilderException
{
if (DEBUG || DEBUG_NULLARG)
System.out.println("Pre FND ");
MethodGen methodGen = classContext.getMethodGen(method);
if (methodGen == null)
return;
// UsagesRequiringNonNullValues uses =
// classContext.getUsagesRequiringNonNullValues(method);
this.method = method;
if (DEBUG || DEBUG_NULLARG)
System.out.println("FND: " + SignatureConverter.convertMethodSignature(methodGen));
findPreviouslyDeadBlocks();
vnaDataflow = classContext.getValueNumberDataflow(method);
// Create a NullDerefAndRedundantComparisonFinder object to do the
// actual
// work. It will call back to report null derefs and redundant null
// comparisons
// through the NullDerefAndRedundantComparisonCollector interface we
// implement.
NullDerefAndRedundantComparisonFinder worker = new NullDerefAndRedundantComparisonFinder(classContext, method, this);
worker.execute();
}
示例2: analyzeMethod
import edu.umd.cs.findbugs.ba.npe.NullDerefAndRedundantComparisonFinder; //导入依赖的package包/类
private void analyzeMethod(ClassContext classContext, Method method) throws DataflowAnalysisException, CFGBuilderException
{
if (DEBUG || DEBUG_NULLARG)
System.out.println("Pre FND ");
if ((method.getAccessFlags() & Constants.ACC_VOLATILE) != 0)
return;
MethodGen methodGen = classContext.getMethodGen(method);
if (methodGen == null)
return;
if (!checkedDatabases) {
checkDatabases();
checkedDatabases = true;
}
XMethod xMethod = XFactory.createXMethod(classContext.getJavaClass(), method);
ClassDescriptor junitTestAnnotation = DescriptorFactory.createClassDescriptor("org/junit/Test");
AnnotationValue av = xMethod.getAnnotation(junitTestAnnotation);
if (av != null) {
Object value = av.getValue("expected");
if (value instanceof Type) {
String className = ((Type) value).getClassName();
if (className.equals("java.lang.NullPointerException"))
return;
}
}
// UsagesRequiringNonNullValues uses =
// classContext.getUsagesRequiringNonNullValues(method);
this.method = method;
this.methodAnnotation = getMethodNullnessAnnotation();
if (DEBUG || DEBUG_NULLARG)
System.out.println("FND: " + SignatureConverter.convertMethodSignature(methodGen));
this.previouslyDeadBlocks = findPreviouslyDeadBlocks();
// Get the IsNullValueDataflow for the method from the ClassContext
invDataflow = classContext.getIsNullValueDataflow(method);
vnaDataflow = classContext.getValueNumberDataflow(method);
// Create a NullDerefAndRedundantComparisonFinder object to do the
// actual
// work. It will call back to report null derefs and redundant null
// comparisons
// through the NullDerefAndRedundantComparisonCollector interface we
// implement.
NullDerefAndRedundantComparisonFinder worker = new NullDerefAndRedundantComparisonFinder(classContext, method, this);
worker.execute();
checkCallSitesAndReturnInstructions();
}