本文整理汇总了Java中edu.umd.cs.findbugs.ba.obl.StateSet类的典型用法代码示例。如果您正苦于以下问题:Java StateSet类的具体用法?Java StateSet怎么用?Java StateSet使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
StateSet类属于edu.umd.cs.findbugs.ba.obl包,在下文中一共展示了StateSet类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTransferState
import edu.umd.cs.findbugs.ba.obl.StateSet; //导入依赖的package包/类
private State getTransferState(InstructionHandle handle) {
StateSet stateSet;
try {
stateSet = dataflow.getFactAtLocation(new Location(handle, curBlock));
} catch (DataflowAnalysisException e) {
bugReporter.logError("Error checking obligation state at " + handle, e);
return null;
}
List<State> prefixes = stateSet.getPrefixStates(state.getPath());
if (prefixes.size() != 1) {
// Could this happen?
if (DEBUG_FP) {
System.out.println("at " + handle + " in " + xmethod + " found " + prefixes.size()
+ " states which are prefixes of error state");
}
return null;
}
return prefixes.get(0);
}
示例2: reportWarning
import edu.umd.cs.findbugs.ba.obl.StateSet; //导入依赖的package包/类
private void reportWarning(Obligation obligation, State state, StateSet factAtExit) {
String className = obligation.getClassName();
if (methodDescriptor.isStatic() && methodDescriptor.getName().equals("main")
&& methodDescriptor.getSignature().equals("([Ljava/lang/String;)V")
&& (className.contains("InputStream") || className.contains("Reader") || factAtExit.isOnExceptionPath())) {
// Don't report unclosed input streams and readers in main()
// methods
return;
}
String bugPattern = factAtExit.isOnExceptionPath() ? "OBL_UNSATISFIED_OBLIGATION_EXCEPTION_EDGE" : "OBL_UNSATISFIED_OBLIGATION";
BugInstance bugInstance = new BugInstance(FindUnsatisfiedObligation.this, bugPattern,
NORMAL_PRIORITY).addClassAndMethod(methodDescriptor).addClass(className).describe("CLASS_REFTYPE");
// Report how many instances of the obligation are remaining
bugInstance.addInt(state.getObligationSet().getCount(obligation.getId())).describe(
IntAnnotation.INT_OBLIGATIONS_REMAINING);
// Add source line information
annotateWarningWithSourceLineInformation(state, obligation, bugInstance);
if (REPORT_OBLIGATION_SET) {
bugInstance.addString(state.getObligationSet().toString()).describe(StringAnnotation.REMAINING_OBLIGATIONS_ROLE);
}
bugReporter.reportBug(bugInstance);
}