本文整理汇总了Java中edu.umd.cs.findbugs.ba.obl.ObligationFactory类的典型用法代码示例。如果您正苦于以下问题:Java ObligationFactory类的具体用法?Java ObligationFactory怎么用?Java ObligationFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ObligationFactory类属于edu.umd.cs.findbugs.ba.obl包,在下文中一共展示了ObligationFactory类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visitClass
import edu.umd.cs.findbugs.ba.obl.ObligationFactory; //导入依赖的package包/类
@Override
public void visitClass(ClassDescriptor classDescriptor) throws CheckedAnalysisException {
IAnalysisCache analysisCache = Global.getAnalysisCache();
ObligationFactory factory = database.getFactory();
JavaClass jclass = analysisCache.getClassAnalysis(JavaClass.class, classDescriptor);
for (Constant c : jclass.getConstantPool().getConstantPool()) {
if (c instanceof ConstantNameAndType) {
ConstantNameAndType cnt = (ConstantNameAndType) c;
String signature = cnt.getSignature(jclass.getConstantPool());
if (factory.signatureInvolvesObligations(signature)) {
super.visitClass(classDescriptor);
return;
}
} else if (c instanceof ConstantClass) {
String className = ((ConstantClass) c).getBytes(jclass.getConstantPool());
if (factory.signatureInvolvesObligations(className)) {
super.visitClass(classDescriptor);
return;
}
}
}
if (DEBUG)
System.out.println(classDescriptor + " isn't interesting for obligation analysis");
}
示例2: analyze
import edu.umd.cs.findbugs.ba.obl.ObligationFactory; //导入依赖的package包/类
public ObligationDataflow analyze(IAnalysisCache analysisCache, MethodDescriptor methodDescriptor)
throws CheckedAnalysisException {
CFG cfg = analysisCache.getMethodAnalysis(CFG.class, methodDescriptor);
DepthFirstSearch dfs = analysisCache.getMethodAnalysis(DepthFirstSearch.class, methodDescriptor);
XMethod xmethod = XFactory.createXMethod(methodDescriptor);
ConstantPoolGen cpg = analysisCache.getClassAnalysis(ConstantPoolGen.class, methodDescriptor.getClassDescriptor());
ObligationPolicyDatabase database = analysisCache.getDatabase(ObligationPolicyDatabase.class);
TypeDataflow typeDataflow = analysisCache.getMethodAnalysis(TypeDataflow.class, methodDescriptor);
IsNullValueDataflow invDataflow = analysisCache.getMethodAnalysis(IsNullValueDataflow.class, methodDescriptor);
ObligationFactory factory = database.getFactory();
ObligationAnalysis analysis = new ObligationAnalysis(dfs, xmethod, cpg, factory, database, typeDataflow, invDataflow,
analysisCache.getErrorLogger());
ObligationDataflow dataflow = new ObligationDataflow(cfg, analysis);
Profiler profiler = analysisCache.getProfiler();
profiler.start(analysis.getClass());
try {
dataflow.execute();
} finally {
profiler.end(analysis.getClass());
}
if (DEBUG_PRINTCFG) {
System.out.println("Dataflow CFG:");
DataflowCFGPrinter.printCFG(dataflow, System.out);
}
return dataflow;
}