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


Java StateSet类代码示例

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

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


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