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