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


Java ResourceValueFrame.getStatus方法代码示例

本文整理汇总了Java中edu.umd.cs.findbugs.ba.ResourceValueFrame.getStatus方法的典型用法代码示例。如果您正苦于以下问题:Java ResourceValueFrame.getStatus方法的具体用法?Java ResourceValueFrame.getStatus怎么用?Java ResourceValueFrame.getStatus使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在edu.umd.cs.findbugs.ba.ResourceValueFrame的用法示例。


在下文中一共展示了ResourceValueFrame.getStatus方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: inspectResult

import edu.umd.cs.findbugs.ba.ResourceValueFrame; //导入方法依赖的package包/类
@Override
public void inspectResult(ClassContext classContext, MethodGen methodGen, CFG cfg,
        Dataflow<ResourceValueFrame, ResourceValueAnalysis<Lock>> dataflow, Lock resource) {

    JavaClass javaClass = classContext.getJavaClass();

    ResourceValueFrame exitFrame = dataflow.getResultFact(cfg.getExit());
    if (DEBUG) {
        System.out.println("Resource value at exit: " + exitFrame);
    }
    int exitStatus = exitFrame.getStatus();

    if (exitStatus == ResourceValueFrame.OPEN || exitStatus == ResourceValueFrame.OPEN_ON_EXCEPTION_PATH) {
        String bugType;
        int priority;
        if (exitStatus == ResourceValueFrame.OPEN) {
            bugType = "UL_UNRELEASED_LOCK";
            priority = HIGH_PRIORITY;
        } else {
            bugType = "UL_UNRELEASED_LOCK_EXCEPTION_PATH";
            priority = NORMAL_PRIORITY;
        }

        String sourceFile = javaClass.getSourceFileName();
        Location location = resource.getLocation();
        InstructionHandle handle = location.getHandle();
        InstructionHandle nextInstruction = handle.getNext();
        if (nextInstruction.getInstruction() instanceof RETURN)
            return; // don't report as error; intentional
        bugAccumulator.accumulateBug(new BugInstance(this, bugType, priority).addClassAndMethod(methodGen, sourceFile),
                SourceLineAnnotation.fromVisitedInstruction(classContext, methodGen, sourceFile, handle));
    }
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:34,代码来源:FindUnreleasedLock.java

示例2: inspectResult

import edu.umd.cs.findbugs.ba.ResourceValueFrame; //导入方法依赖的package包/类
@Override
public void inspectResult(ClassContext classContext, MethodGen methodGen, CFG cfg,
        Dataflow<ResourceValueFrame, ResourceValueAnalysis<Stream>> dataflow, Stream stream) {

    if (DEBUG) {
        System.out.printf("Result for %s in %s%n", stream, methodGen);
        dataflow.dumpDataflow(dataflow.getAnalysis());
        
    }
    ResourceValueFrame exitFrame = dataflow.getResultFact(cfg.getExit());

    int exitStatus = exitFrame.getStatus();
    if (exitStatus == ResourceValueFrame.OPEN || exitStatus == ResourceValueFrame.OPEN_ON_EXCEPTION_PATH) {

        // FIXME: Stream object should be queried for the
        // priority.

        String bugType = stream.getBugType();
        int priority = NORMAL_PRIORITY;
        if (exitStatus == ResourceValueFrame.OPEN_ON_EXCEPTION_PATH) {
            bugType += "_EXCEPTION_PATH";
            priority = LOW_PRIORITY;
        }

        potentialOpenStreamList.add(new PotentialOpenStream(bugType, priority, stream));
    } else if (exitStatus == ResourceValueFrame.CLOSED) {
        // Remember that this stream was closed on all paths.
        // Later, we will mark all of the streams in its equivalence class
        // as having been closed.
        stream.setClosed();
    }
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:33,代码来源:FindOpenStream.java


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