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


Java ObligationFactory类代码示例

本文整理汇总了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");
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:27,代码来源:FindUnsatisfiedObligation.java

示例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;
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:34,代码来源:ObligationDataflowFactory.java


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