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


Java ValueNumberDataflow类代码示例

本文整理汇总了Java中edu.umd.cs.findbugs.ba.vna.ValueNumberDataflow的典型用法代码示例。如果您正苦于以下问题:Java ValueNumberDataflow类的具体用法?Java ValueNumberDataflow怎么用?Java ValueNumberDataflow使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ValueNumberDataflow类属于edu.umd.cs.findbugs.ba.vna包,在下文中一共展示了ValueNumberDataflow类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getDataflow

import edu.umd.cs.findbugs.ba.vna.ValueNumberDataflow; //导入依赖的package包/类
@Override
protected BackwardTypeQualifierDataflow getDataflow(DepthFirstSearch dfs, XMethod xmethod, CFG cfg,
        ValueNumberDataflow vnaDataflow, ConstantPoolGen cpg, IAnalysisCache analysisCache,
        MethodDescriptor methodDescriptor, TypeQualifierValue typeQualifierValue) throws CheckedAnalysisException {
    ReverseDepthFirstSearch rdfs = analysisCache.getMethodAnalysis(ReverseDepthFirstSearch.class, methodDescriptor);

    BackwardTypeQualifierDataflowAnalysis analysis = new BackwardTypeQualifierDataflowAnalysis(dfs, rdfs, xmethod, cfg,
            vnaDataflow, cpg, typeQualifierValue);

    // Get the corresponding forward dataflow.
    // We use it to halt tracking of backwards values once we know
    // that they encounter a conflicting forward value.
    ForwardTypeQualifierDataflowFactory forwardFactory = analysisCache.getMethodAnalysis(
            ForwardTypeQualifierDataflowFactory.class, methodDescriptor);
    ForwardTypeQualifierDataflow forwardDataflow = forwardFactory.getDataflow(typeQualifierValue);
    analysis.setForwardTypeQualifierDataflow(forwardDataflow);
    analysis.registerSourceSinkLocations();

    BackwardTypeQualifierDataflow dataflow = new BackwardTypeQualifierDataflow(cfg, analysis);

    dataflow.execute();
    if (ClassContext.DUMP_DATAFLOW_ANALYSIS) {
        dataflow.dumpDataflow(analysis);
    }
    return dataflow;
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:27,代码来源:BackwardTypeQualifierDataflowFactory.java

示例2: IsNullValueAnalysis

import edu.umd.cs.findbugs.ba.vna.ValueNumberDataflow; //导入依赖的package包/类
public IsNullValueAnalysis(MethodDescriptor descriptor, MethodGen methodGen, CFG cfg, ValueNumberDataflow vnaDataflow,
        TypeDataflow typeDataflow, DepthFirstSearch dfs, AssertionMethods assertionMethods) {
    super(dfs);

    this.trackValueNumbers = AnalysisContext.currentAnalysisContext().getBoolProperty(
            AnalysisFeatures.TRACK_VALUE_NUMBERS_IN_NULL_POINTER_ANALYSIS);

    this.methodGen = methodGen;
    this.visitor = new IsNullValueFrameModelingVisitor(methodGen.getConstantPool(), assertionMethods, vnaDataflow,
            typeDataflow, trackValueNumbers);
    this.vnaDataflow = vnaDataflow;
    this.cfg = cfg;
    this.locationWhereValueBecomesNullSet = new HashSet<LocationWhereValueBecomesNull>();
    this.pointerEqualityCheck = getForPointerEqualityCheck(cfg, vnaDataflow);

    if (DEBUG) {
        System.out.println("IsNullValueAnalysis for " + methodGen.getClassName() + "." + methodGen.getName() + " : "
                + methodGen.getSignature());
    }
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:21,代码来源:IsNullValueAnalysis.java

示例3: getDataflow

import edu.umd.cs.findbugs.ba.vna.ValueNumberDataflow; //导入依赖的package包/类
@Override
protected BackwardTypeQualifierDataflow getDataflow(DepthFirstSearch dfs, XMethod xmethod, CFG cfg,
        ValueNumberDataflow vnaDataflow, ConstantPoolGen cpg, IAnalysisCache analysisCache,
        MethodDescriptor methodDescriptor, TypeQualifierValue<?> typeQualifierValue) throws CheckedAnalysisException {
    ReverseDepthFirstSearch rdfs = analysisCache.getMethodAnalysis(ReverseDepthFirstSearch.class, methodDescriptor);

    BackwardTypeQualifierDataflowAnalysis analysis = new BackwardTypeQualifierDataflowAnalysis(dfs, rdfs, xmethod, cfg,
            vnaDataflow, cpg, typeQualifierValue);

    // Get the corresponding forward dataflow.
    // We use it to halt tracking of backwards values once we know
    // that they encounter a conflicting forward value.
    ForwardTypeQualifierDataflowFactory forwardFactory = analysisCache.getMethodAnalysis(
            ForwardTypeQualifierDataflowFactory.class, methodDescriptor);
    ForwardTypeQualifierDataflow forwardDataflow = forwardFactory.getDataflow(typeQualifierValue);
    analysis.setForwardTypeQualifierDataflow(forwardDataflow);
    analysis.registerSourceSinkLocations();

    BackwardTypeQualifierDataflow dataflow = new BackwardTypeQualifierDataflow(cfg, analysis);

    dataflow.execute();
    if (ClassContext.DUMP_DATAFLOW_ANALYSIS) {
        dataflow.dumpDataflow(analysis);
    }
    return dataflow;
}
 
开发者ID:OpenNTF,项目名称:FindBug-for-Domino-Designer,代码行数:27,代码来源:BackwardTypeQualifierDataflowFactory.java

示例4: findPreviouslyDeadBlocks

import edu.umd.cs.findbugs.ba.vna.ValueNumberDataflow; //导入依赖的package包/类
/**
 * Find set of blocks which were known to be dead before doing the null
 * pointer analysis.
 * 
 * @return set of previously dead blocks, indexed by block id
 * @throws CFGBuilderException
 * @throws DataflowAnalysisException
 */
private BitSet findPreviouslyDeadBlocks() throws DataflowAnalysisException, CFGBuilderException {
    BitSet deadBlocks = new BitSet();
    ValueNumberDataflow vnaDataflow = classContext.getValueNumberDataflow(method);
    for (Iterator<BasicBlock> i = vnaDataflow.getCFG().blockIterator(); i.hasNext();) {
        BasicBlock block = i.next();
        ValueNumberFrame vnaFrame = vnaDataflow.getStartFact(block);
        if (vnaFrame.isTop()) {
            deadBlocks.set(block.getLabel());
        }
    }

    return deadBlocks;
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:22,代码来源:NoiseNullDeref.java

示例5: LockFrameModelingVisitor

import edu.umd.cs.findbugs.ba.vna.ValueNumberDataflow; //导入依赖的package包/类
public LockFrameModelingVisitor(ConstantPoolGen cpg, LockResourceTracker resourceTracker, Lock lock,
        ValueNumberDataflow vnaDataflow, IsNullValueDataflow isNullDataflow) {
    super(cpg);
    this.resourceTracker = resourceTracker;
    this.lock = lock;
    this.vnaDataflow = vnaDataflow;
    // this.isNullDataflow = isNullDataflow;
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:9,代码来源:FindUnreleasedLock.java

示例6: LockResourceTracker

import edu.umd.cs.findbugs.ba.vna.ValueNumberDataflow; //导入依赖的package包/类
public LockResourceTracker(RepositoryLookupFailureCallback lookupFailureCallback, CFG cfg,
        ValueNumberDataflow vnaDataflow, IsNullValueDataflow isNullDataflow) {
    this.lookupFailureCallback = lookupFailureCallback;
    this.cfg = cfg;
    this.vnaDataflow = vnaDataflow;
    this.isNullDataflow = isNullDataflow;
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:8,代码来源:FindUnreleasedLock.java

示例7: getParameterValueNumbers

import edu.umd.cs.findbugs.ba.vna.ValueNumberDataflow; //导入依赖的package包/类
private Set<ValueNumber> getParameterValueNumbers(ClassContext classContext, Method method, CFG cfg)
        throws DataflowAnalysisException, CFGBuilderException {
    ValueNumberDataflow vnaDataflow = classContext.getValueNumberDataflow(method);
    ValueNumberFrame vnaFrameAtEntry = vnaDataflow.getStartFact(cfg.getEntry());
    Set<ValueNumber> paramValueNumberSet = new HashSet<ValueNumber>();
    int firstParam = method.isStatic() ? 0 : 1;
    for (int i = firstParam; i < vnaFrameAtEntry.getNumLocals(); ++i) {
        paramValueNumberSet.add(vnaFrameAtEntry.getValue(i));
    }
    return paramValueNumberSet;
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:12,代码来源:FindBadCast2.java

示例8: findPreviouslyDeadBlocks

import edu.umd.cs.findbugs.ba.vna.ValueNumberDataflow; //导入依赖的package包/类
/**
 * Find set of blocks which were known to be dead before doing the null
 * pointer analysis.
 *
 * @return set of previously dead blocks, indexed by block id
 * @throws CFGBuilderException
 * @throws DataflowAnalysisException
 */
private BitSet findPreviouslyDeadBlocks() throws DataflowAnalysisException, CFGBuilderException {
    BitSet deadBlocks = new BitSet();
    ValueNumberDataflow vnaDataflow = classContext.getValueNumberDataflow(method);
    for (Iterator<BasicBlock> i = vnaDataflow.getCFG().blockIterator(); i.hasNext();) {
        BasicBlock block = i.next();
        ValueNumberFrame vnaFrame = vnaDataflow.getStartFact(block);
        if (vnaFrame.isTop()) {
            deadBlocks.set(block.getLabel());
        }
    }

    return deadBlocks;
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:22,代码来源:FindNullDeref.java

示例9: analyze

import edu.umd.cs.findbugs.ba.vna.ValueNumberDataflow; //导入依赖的package包/类
public IsNullValueDataflow analyze(IAnalysisCache analysisCache, MethodDescriptor descriptor) throws CheckedAnalysisException {
    MethodGen methodGen = getMethodGen(analysisCache, descriptor);
    if (methodGen == null) {
        throw new MethodUnprofitableException(descriptor);
    }
    CFG cfg = getCFG(analysisCache, descriptor);
    ValueNumberDataflow vnaDataflow = getValueNumberDataflow(analysisCache, descriptor);
    DepthFirstSearch dfs = getDepthFirstSearch(analysisCache, descriptor);
    AssertionMethods assertionMethods = getAssertionMethods(analysisCache, descriptor.getClassDescriptor());
    TypeDataflow typeDataflow = getTypeDataflow(analysisCache, descriptor);

    IsNullValueAnalysis invAnalysis = new IsNullValueAnalysis(descriptor, methodGen, cfg, vnaDataflow, typeDataflow, dfs,
            assertionMethods);

    // Set return value and parameter databases

    invAnalysis.setClassAndMethod(new JavaClassAndMethod(getJavaClass(analysisCache, descriptor.getClassDescriptor()),
            getMethod(analysisCache, descriptor)));

    IsNullValueDataflow invDataflow = new IsNullValueDataflow(cfg, invAnalysis);
    invDataflow.execute();
    if (ClassContext.DUMP_DATAFLOW_ANALYSIS) {
        invDataflow.dumpDataflow(invAnalysis);
    }
    return invDataflow;

}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:28,代码来源:IsNullValueDataflowFactory.java

示例10: analyze

import edu.umd.cs.findbugs.ba.vna.ValueNumberDataflow; //导入依赖的package包/类
public UnconditionalValueDerefDataflow analyze(IAnalysisCache analysisCache, MethodDescriptor descriptor)
        throws CheckedAnalysisException {
    MethodGen methodGen = getMethodGen(analysisCache, descriptor);
    if (methodGen == null) {
        throw new MethodUnprofitableException(descriptor);
    }

    CFG cfg = getCFG(analysisCache, descriptor);

    ValueNumberDataflow vnd = getValueNumberDataflow(analysisCache, descriptor);

    UnconditionalValueDerefAnalysis analysis = new UnconditionalValueDerefAnalysis(getReverseDepthFirstSearch(analysisCache,
            descriptor), getDepthFirstSearch(analysisCache, descriptor), cfg, getMethod(analysisCache, descriptor),
            methodGen, vnd, getAssertionMethods(analysisCache, descriptor.getClassDescriptor()));

    IsNullValueDataflow inv = getIsNullValueDataflow(analysisCache, descriptor);
    // XXX: hack to clear derefs on not-null branches
    analysis.clearDerefsOnNonNullBranches(inv);

    TypeDataflow typeDataflow = getTypeDataflow(analysisCache, descriptor);
    // XXX: type analysis is needed to resolve method calls for
    // checking whether call targets unconditionally dereference parameters
    analysis.setTypeDataflow(typeDataflow);

    UnconditionalValueDerefDataflow dataflow = new UnconditionalValueDerefDataflow(cfg, analysis);
    dataflow.execute();
    if (ClassContext.DUMP_DATAFLOW_ANALYSIS) {
        dataflow.dumpDataflow(analysis);
    }
    if (UnconditionalValueDerefAnalysis.DEBUG) {
        ClassContext.dumpDataflowInformation(getMethod(analysisCache, descriptor), cfg, vnd, inv, dataflow, typeDataflow);
    }

    return dataflow;
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:36,代码来源:UnconditionalValueDerefDataflowFactory.java

示例11: analyze

import edu.umd.cs.findbugs.ba.vna.ValueNumberDataflow; //导入依赖的package包/类
public LockDataflow analyze(IAnalysisCache analysisCache, MethodDescriptor descriptor) throws CheckedAnalysisException {
    MethodGen methodGen = getMethodGen(analysisCache, descriptor);
    if (methodGen == null) {
        throw new MethodUnprofitableException(descriptor);
    }
    ValueNumberDataflow vnaDataflow = getValueNumberDataflow(analysisCache, descriptor);
    DepthFirstSearch dfs = getDepthFirstSearch(analysisCache, descriptor);
    CFG cfg = getCFG(analysisCache, descriptor);

    LockAnalysis analysis = new LockAnalysis(methodGen, vnaDataflow, dfs);
    LockDataflow dataflow = new LockDataflow(cfg, analysis);
    dataflow.execute();
    return dataflow;

}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:16,代码来源:LockDataflowFactory.java

示例12: getObjectMap

import edu.umd.cs.findbugs.ba.vna.ValueNumberDataflow; //导入依赖的package包/类
public Map<MethodDescriptor, Object> getObjectMap(Class<?> analysisClass) {
    Map<MethodDescriptor, Object> objectMap = methodAnalysisObjectMap.get(analysisClass);
    if (objectMap == null) {
        if (analysisClass == ValueNumberDataflow.class)
            objectMap = new MapCache<MethodDescriptor, Object>(300);
        else if (Dataflow.class.isAssignableFrom(analysisClass))
            objectMap = new MapCache<MethodDescriptor, Object>(500);
        else
            objectMap = new HashMap<MethodDescriptor, Object>();
        methodAnalysisObjectMap.put(analysisClass, objectMap);
    }
    return objectMap;
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:14,代码来源:ClassContext.java

示例13: populateDatabase

import edu.umd.cs.findbugs.ba.vna.ValueNumberDataflow; //导入依赖的package包/类
@Override
protected void populateDatabase(BackwardTypeQualifierDataflow dataflow, ValueNumberDataflow vnaDataflow, XMethod xmethod,
        TypeQualifierValue tqv) throws CheckedAnalysisException {
    assert TypeQualifierDatabase.USE_DATABASE;

    // Get the dataflow fact that propagated
    // back to the entry of the method.
    // This will contain the effective type qualifier
    // annotations on the method parameters.
    if (xmethod.isIdentity())
        return;

    BasicBlock entry = dataflow.getCFG().getEntry();
    TypeQualifierValueSet entryFact = dataflow.getAnalysis().getResultFact(entry);

    for (int i = 0; i < xmethod.getNumParams(); i++) {
        if (TypeQualifierApplications.getEffectiveTypeQualifierAnnotation(xmethod, i, tqv) != null) {
            // this parameter already has an explicit annotation
            continue;
        }

        // Get the value number for this parameter
        ValueNumber paramVN = vnaDataflow.getAnalysis().getEntryValueForParameter(i);

        FlowValue paramFlowValue = entryFact.getValue(paramVN);
        if (paramFlowValue == FlowValue.ALWAYS || paramFlowValue == FlowValue.NEVER) {
            TypeQualifierDatabase tqdb = Global.getAnalysisCache().getDatabase(TypeQualifierDatabase.class);
            TypeQualifierAnnotation tqa = TypeQualifierAnnotation.getValue(tqv,
                    paramFlowValue == FlowValue.ALWAYS ? When.ALWAYS : When.NEVER);
            tqdb.setParameter(xmethod.getMethodDescriptor(), i, tqv, tqa);
        }
    }
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:34,代码来源:BackwardTypeQualifierDataflowFactory.java

示例14: getDataflow

import edu.umd.cs.findbugs.ba.vna.ValueNumberDataflow; //导入依赖的package包/类
@Override
protected ForwardTypeQualifierDataflow getDataflow(DepthFirstSearch dfs, XMethod xmethod, CFG cfg,
        ValueNumberDataflow vnaDataflow, ConstantPoolGen cpg, IAnalysisCache analysisCache,
        MethodDescriptor methodDescriptor, TypeQualifierValue typeQualifierValue) throws DataflowAnalysisException {
    ForwardTypeQualifierDataflowAnalysis analysis = new ForwardTypeQualifierDataflowAnalysis(dfs, xmethod, cfg, vnaDataflow,
            cpg, typeQualifierValue);
    analysis.registerSourceSinkLocations();

    ForwardTypeQualifierDataflow dataflow = new ForwardTypeQualifierDataflow(cfg, analysis);
    dataflow.execute();
    if (ClassContext.DUMP_DATAFLOW_ANALYSIS) {
        dataflow.dumpDataflow(analysis);
    }
    return dataflow;
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:16,代码来源:ForwardTypeQualifierDataflowFactory.java

示例15: get

import edu.umd.cs.findbugs.ba.vna.ValueNumberDataflow; //导入依赖的package包/类
public @CheckForNull
PointerUsageRequiringNonNullValue get(Location loc, ValueNumber vn, ValueNumberDataflow vnaDataflow) {
    // PointerUsageRequiringNonNullValue secondBest = null;
    MergeTree mergeTree = vnaDataflow.getAnalysis().getMergeTree();
    for (Pair p : map.get(loc.getHandle().getPosition())) {
        if (p.vn.equals(vn))
            return p.pu;
        if (!p.vn.hasFlag(ValueNumber.PHI_NODE))
            continue;
        BitSet inputs = mergeTree.getTransitiveInputSet(p.vn);
        if (inputs.get(vn.getNumber()))
            return p.pu;
    }
    return null;
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:16,代码来源:UsagesRequiringNonNullValues.java


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