當前位置: 首頁>>代碼示例>>Java>>正文


Java UnconditionalValueDerefSet類代碼示例

本文整理匯總了Java中edu.umd.cs.findbugs.ba.deref.UnconditionalValueDerefSet的典型用法代碼示例。如果您正苦於以下問題:Java UnconditionalValueDerefSet類的具體用法?Java UnconditionalValueDerefSet怎麽用?Java UnconditionalValueDerefSet使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


UnconditionalValueDerefSet類屬於edu.umd.cs.findbugs.ba.deref包,在下文中一共展示了UnconditionalValueDerefSet類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: isCaught

import edu.umd.cs.findbugs.ba.deref.UnconditionalValueDerefSet; //導入依賴的package包/類
/**
 * @param classContext
 * @param method
 * @param entryFact
 * @param paramVN
 * @return
 */
public boolean isCaught(ClassContext classContext, Method method, UnconditionalValueDerefSet entryFact, ValueNumber paramVN) {
    boolean caught = true;

    Set<Location> dereferenceSites
      = entryFact.getDerefLocationSet(paramVN);
    if (dereferenceSites != null && !dereferenceSites.isEmpty()) {
        ConstantPool cp = classContext.getJavaClass().getConstantPool();

        for(Location loc : dereferenceSites) {
            if (!FindNullDeref.catchesNull(cp, method.getCode(), loc))
                caught = false;
        }

    }
    return caught;
}
 
開發者ID:ytus,項目名稱:findbugs-all-the-bugs,代碼行數:24,代碼來源:BuildUnconditionalParamDerefDatabase.java

示例2: getFactOnEdge

import edu.umd.cs.findbugs.ba.deref.UnconditionalValueDerefSet; //導入依賴的package包/類
/**
 * Get the fact that is true on the given control edge,
 * <em>after applying the edge transfer function</em> (if any).
 *
 * @param edge
 *            the edge
 * @return the fact that is true after applying the edge transfer function
 * @throws DataflowAnalysisException
 */
public/* final */Fact getFactOnEdge(Edge edge) throws DataflowAnalysisException {
    BasicBlock block = isForwards() ? edge.getSource() : edge.getTarget();

    Fact predFact = createFact();
    copy(getResultFact(block), predFact);

    edgeTransfer(edge, predFact);

    Fact result = createFact();
    makeFactTop(result);
    if (this instanceof UnconditionalValueDerefAnalysis)
        ((UnconditionalValueDerefAnalysis)this).meetInto((UnconditionalValueDerefSet)predFact,
                edge, (UnconditionalValueDerefSet)result, true);
    else
        meetInto(predFact, edge, result);


    return result;
}
 
開發者ID:ytus,項目名稱:findbugs-all-the-bugs,代碼行數:29,代碼來源:BasicAbstractDataflowAnalysis.java

示例3: noteUnconditionallyDereferencedNullValue

import edu.umd.cs.findbugs.ba.deref.UnconditionalValueDerefSet; //導入依賴的package包/類
/**
 * Note the locations where a known-null value is unconditionally
 * dereferenced.
 *
 * @param thisLocation
 *            TODO
 * @param bugLocations
 *            TODO
 * @param nullValueGuaranteedDerefMap
 *            map of null values to sets of Locations where they are derefed
 * @param derefSet
 *            set of values known to be unconditionally dereferenced
 * @param isNullValue
 *            the null value
 * @param valueNumber
 *            the value number of the null value
 */
private void noteUnconditionallyDereferencedNullValue(Location thisLocation,
        Map<ValueNumber, SortedSet<Location>> bugLocations,
        Map<ValueNumber, NullValueUnconditionalDeref> nullValueGuaranteedDerefMap, UnconditionalValueDerefSet derefSet,
        IsNullValue isNullValue, ValueNumber valueNumber) {
    if (DEBUG) {
        System.out.println("%%% HIT for value number " + valueNumber + " @ " + thisLocation);
    }
    Set<Location> unconditionalDerefLocationSet = derefSet.getUnconditionalDerefLocationSet(valueNumber);
    if (unconditionalDerefLocationSet.isEmpty()) {
        AnalysisContext.logError("empty set of unconditionally dereferenced locations at "
                + thisLocation.getHandle().getPosition() + " in " + classContext.getClassDescriptor() + "."
                + method.getName() + method.getSignature());
        return;
    }

    // OK, we have a null value that is unconditionally
    // derferenced. Make a note of the locations where it
    // will be dereferenced.
    NullValueUnconditionalDeref thisNullValueDeref = nullValueGuaranteedDerefMap.get(valueNumber);
    if (thisNullValueDeref == null) {
        thisNullValueDeref = new NullValueUnconditionalDeref();
        nullValueGuaranteedDerefMap.put(valueNumber, thisNullValueDeref);
    }
    thisNullValueDeref.add(isNullValue, unconditionalDerefLocationSet);

    if (thisLocation != null) {
        SortedSet<Location> locationsForThisBug = bugLocations.get(valueNumber);

        if (locationsForThisBug == null) {
            locationsForThisBug = new TreeSet<Location>();
            bugLocations.put(valueNumber, locationsForThisBug);
        }
        locationsForThisBug.add(thisLocation);
    }
}
 
開發者ID:ytus,項目名稱:findbugs-all-the-bugs,代碼行數:53,代碼來源:NullDerefAndRedundantComparisonFinder.java


注:本文中的edu.umd.cs.findbugs.ba.deref.UnconditionalValueDerefSet類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。