本文整理汇总了Java中edu.umd.cs.findbugs.ba.ResourceValueFrame.setStatus方法的典型用法代码示例。如果您正苦于以下问题:Java ResourceValueFrame.setStatus方法的具体用法?Java ResourceValueFrame.setStatus怎么用?Java ResourceValueFrame.setStatus使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类edu.umd.cs.findbugs.ba.ResourceValueFrame
的用法示例。
在下文中一共展示了ResourceValueFrame.setStatus方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: transferInstruction
import edu.umd.cs.findbugs.ba.ResourceValueFrame; //导入方法依赖的package包/类
@Override
public void transferInstruction(InstructionHandle handle, BasicBlock basicBlock) throws DataflowAnalysisException {
final Instruction ins = handle.getInstruction();
final ConstantPoolGen cpg = getCPG();
final ResourceValueFrame frame = getFrame();
int status = -1;
if (DEBUG)
System.out.println("PC : " + handle.getPosition() + " " + ins);
if (DEBUG && ins instanceof InvokeInstruction) {
InvokeInstruction iins = (InvokeInstruction) ins;
System.out.println(" " + ins.toString(cpg.getConstantPool()));
}
if (DEBUG)
System.out.println("resource frame before instruction: " + frame.toString());
// Is a lock acquired or released by this instruction?
Location creationPoint = lock.getLocation();
if (handle == creationPoint.getHandle() && basicBlock == creationPoint.getBasicBlock()) {
status = ResourceValueFrame.OPEN;
if (DEBUG)
System.out.println("OPEN");
} else if (resourceTracker.isResourceClose(basicBlock, handle, cpg, lock, frame)) {
status = ResourceValueFrame.CLOSED;
if (DEBUG)
System.out.println("CLOSE");
}
// Model use of instance values in frame slots
analyzeInstruction(ins);
final int updatedNumSlots = frame.getNumSlots();
// Mark any appearances of the lock value in the ResourceValueFrame.
ValueNumberFrame vnaFrame = vnaDataflow.getFactAfterLocation(new Location(handle, basicBlock));
if (DEBUG) {
System.out.println("vna frame after instruction: " + vnaFrame.toString());
System.out.println("Lock value number: " + lock.getLockValue());
if (lock.getLockValue().hasFlag(ValueNumber.RETURN_VALUE))
System.out.println("is return value");
}
for (int i = 0; i < updatedNumSlots; ++i) {
if (DEBUG) {
System.out.println("Slot " + i);
System.out.println(" Lock value number: " + vnaFrame.getValue(i));
if (vnaFrame.getValue(i).hasFlag(ValueNumber.RETURN_VALUE))
System.out.println(" is return value");
}
if (vnaFrame.fuzzyMatch(lock.getLockValue(), vnaFrame.getValue(i))) {
if (DEBUG)
System.out.println("Saw lock value!");
frame.setValue(i, ResourceValue.instance());
}
}
// If needed, update frame status
if (status != -1) {
frame.setStatus(status);
}
if (DEBUG)
System.out.println("resource frame after instruction: " + frame.toString());
}
示例2: transferInstruction
import edu.umd.cs.findbugs.ba.ResourceValueFrame; //导入方法依赖的package包/类
@Override
public void transferInstruction(InstructionHandle handle, BasicBlock basicBlock) throws DataflowAnalysisException {
// Record what Location we are analyzing
this.location = new Location(handle, basicBlock);
final Instruction ins = handle.getInstruction();
final ResourceValueFrame frame = getFrame();
int status = -1;
boolean created = false;
// Is a resource created, opened, or closed by this instruction?
Location creationPoint = stream.getLocation();
if (handle == creationPoint.getHandle() && basicBlock == creationPoint.getBasicBlock()) {
// Resource creation
if (stream.isOpenOnCreation()) {
status = ResourceValueFrame.OPEN;
stream.setOpenLocation(location);
resourceTracker.addStreamOpenLocation(location, stream);
} else {
status = ResourceValueFrame.CREATED;
}
created = true;
} else if (resourceTracker.isResourceOpen(basicBlock, handle, cpg, stream, frame)) {
// Resource opened
status = ResourceValueFrame.OPEN;
stream.setOpenLocation(location);
resourceTracker.addStreamOpenLocation(location, stream);
} else if (resourceTracker.isResourceClose(basicBlock, handle, cpg, stream, frame)) {
// Resource closed
status = ResourceValueFrame.CLOSED;
}
// Model use of instance values in frame slots
analyzeInstruction(ins);
// If needed, update frame status
if (status != -1) {
frame.setStatus(status);
if (created)
frame.setValue(frame.getNumSlots() - 1, ResourceValue.instance());
}
}