当前位置: 首页>>代码示例>>Java>>正文


Java NullDerefAndRedundantComparisonFinder类代码示例

本文整理汇总了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();

    }
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:32,代码来源:NoiseNullDeref.java

示例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();

    }
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:60,代码来源:FindNullDeref.java


注:本文中的edu.umd.cs.findbugs.ba.npe.NullDerefAndRedundantComparisonFinder类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。