• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java SourceLineAnnotation类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: visit

import edu.umd.cs.findbugs.SourceLineAnnotation; //导入依赖的package包/类
@Override
public void visit(Code obj) {
    found.clear();
    // Solution to sourceforge bug 1765925; returning null is the
    // convention used by java.io.File.listFiles()
    if (getMethodName().equals("listFiles")) {
        return;
    }
    String returnType = getMethodSig().substring(getMethodSig().indexOf(")") + 1);
    if (returnType.startsWith("[")) {
        nullOnTOS = false;
        super.visit(obj);
        if (!found.isEmpty()) {
            BugInstance bug = new BugInstance(this, "PZLA_PREFER_ZERO_LENGTH_ARRAYS", LOW_PRIORITY).addClassAndMethod(this);
            for (SourceLineAnnotation s : found)
                bug.add(s);
            bugReporter.reportBug(bug);
            found.clear();
        }
    }
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:22,代码来源:PreferZeroLengthArrays.java


示例2: sawOpcode

import edu.umd.cs.findbugs.SourceLineAnnotation; //导入依赖的package包/类
@Override
public void sawOpcode(int seen) {

    switch (seen) {
    case ACONST_NULL:
        nullOnTOS = true;
        return;
    case ARETURN:
        if (nullOnTOS) {
            SourceLineAnnotation sourceLineAnnotation = SourceLineAnnotation.fromVisitedInstruction(getClassContext(), this,
                    getPC());
            if (sourceLineAnnotation != null)
                found.add(sourceLineAnnotation);
        }

        break;
    }
    nullOnTOS = false;
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:20,代码来源:PreferZeroLengthArrays.java


示例3: suppressWarningsIfOneLiveStoreOnLine

import edu.umd.cs.findbugs.SourceLineAnnotation; //导入依赖的package包/类
/**
 * If feature is enabled, suppress warnings where there is at least one live
 * store on the line where the warning would be reported.
 * 
 * @param accumulator
 *            BugAccumulator containing warnings for method
 * @param liveStoreSourceLineSet
 *            bitset of lines where at least one live store was seen
 */
private void suppressWarningsIfOneLiveStoreOnLine(BugAccumulator accumulator, BitSet liveStoreSourceLineSet) {
    if (!SUPPRESS_IF_AT_LEAST_ONE_LIVE_STORE_ON_LINE) {
        return;
    }

    // Eliminate any accumulated warnings for instructions
    // that (due to inlining) *can* be live stores.
    entryLoop: for (Iterator<? extends BugInstance> i = accumulator.uniqueBugs().iterator(); i.hasNext();) {

        for (SourceLineAnnotation annotation : accumulator.locations(i.next())) {
            if (liveStoreSourceLineSet.get(annotation.getStartLine())) {
                // This instruction can be a live store; don't report
                // it as a warning.
                i.remove();
                continue entryLoop;
            }
        }
    }
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:29,代码来源:FindDeadLocalStores.java


示例4: visit

import edu.umd.cs.findbugs.SourceLineAnnotation; //导入依赖的package包/类
@Override
public void visit(Code obj) {
    found.clear();
    priority = LOW_PRIORITY;

    state = SAW_NOTHING;

    super.visit(obj);
    bugAccumulator.reportAccumulatedBugs();
    if (!found.isEmpty()) {
        BugInstance bug = new BugInstance(this, "FE_FLOATING_POINT_EQUALITY", priority).addClassAndMethod(this);

        boolean first = true;
        for (SourceLineAnnotation s : found) {
            bug.add(s);
            if (first)
                first = false;
            else
                bug.describe(SourceLineAnnotation.ROLE_ANOTHER_INSTANCE);
        }

        bugReporter.reportBug(bug);

        found.clear();
    }
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:27,代码来源:FindFloatEquality.java


示例5: visit

import edu.umd.cs.findbugs.SourceLineAnnotation; //导入依赖的package包/类
@Override
public void visit(Code obj) {
    if (DEBUG)
        System.out.printf("%nVisiting %s%n", getMethodDescriptor());
    reachable = false;
    lastPC = 0;
    biggestJumpTarget = -1;
    found.clear();
    switchHdlr = new SwitchHandler();
    clearAllDeadStores();
    deadStore = null;
    priority = NORMAL_PRIORITY;
    fallthroughDistance = 1000;
    enumType = null;
    super.visit(obj);
    enumType = null;
    if (!found.isEmpty()) {
        if (found.size() >= 4 && priority == NORMAL_PRIORITY)
            priority = LOW_PRIORITY;
        for (SourceLineAnnotation s : found)
            bugAccumulator.accumulateBug(new BugInstance(this, "SF_SWITCH_FALLTHROUGH", priority).addClassAndMethod(this), s);
    }

    bugAccumulator.reportAccumulatedBugs();
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:26,代码来源:SwitchFallthrough.java


示例6: foundSwitchNoDefault

import edu.umd.cs.findbugs.SourceLineAnnotation; //导入依赖的package包/类
private void foundSwitchNoDefault(SourceLineAnnotation s) {
    LineNumberTable table = getCode().getLineNumberTable();

    if (table != null) {
        int startLine = s.getStartLine();
        int prev = Integer.MIN_VALUE;
        for (LineNumber ln : table.getLineNumberTable()) {
            int thisLineNumber = ln.getLineNumber();
            if (thisLineNumber < startLine && thisLineNumber > prev && ln.getStartPC() < s.getStartBytecode())
                prev = thisLineNumber;
        }
        int diff = startLine - prev;
        if (diff > 5)
            return;

        bugAccumulator.accumulateBug(new BugInstance(this, "SF_SWITCH_NO_DEFAULT", NORMAL_PRIORITY).addClassAndMethod(this),
                s);
    }

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


示例7: findSource0

import edu.umd.cs.findbugs.SourceLineAnnotation; //导入依赖的package包/类
public boolean findSource0(SourceLineAnnotation srcLine) {
    if (srcLine == null)
        return false;
    String cName = srcLine.getClassName();
    if (sourceFound.contains(cName))
        return true;
    if (sourceNotFound.contains(cName))
        return false;

    try {
        InputStream in = sourceFinder.openSource(srcLine);
        in.close();
        sourceFound.add(cName);
        return true;
    } catch (IOException e1) {
        sourceNotFound.add(cName);
        return false;
    }
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:20,代码来源:SourceSearcher.java


示例8: lookupSourceFile

import edu.umd.cs.findbugs.SourceLineAnnotation; //导入依赖的package包/类
/**
 * Lookup a class's source file
 *
 * @param dottedClassName
 *            the name of the class
 * @return the source file for the class, or
 *         {@link SourceLineAnnotation#UNKNOWN_SOURCE_FILE} if unable to
 *         determine
 */
public final String lookupSourceFile(@Nonnull @DottedClassName String dottedClassName) {
    if (dottedClassName == null)
        throw new IllegalArgumentException("className is null");
    try {
        XClass xClass = Global.getAnalysisCache().getClassAnalysis(XClass.class,
                DescriptorFactory.createClassDescriptorFromDottedClassName(dottedClassName));
        String name = xClass.getSource();
        if (name == null) {
            return SourceLineAnnotation.UNKNOWN_SOURCE_FILE;
        }
        return name;
    } catch (CheckedAnalysisException e) {
        return SourceLineAnnotation.UNKNOWN_SOURCE_FILE;
    }
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:25,代码来源:AnalysisContext.java


示例9: suppressWarningsIfOneLiveStoreOnLine

import edu.umd.cs.findbugs.SourceLineAnnotation; //导入依赖的package包/类
/**
 * If feature is enabled, suppress warnings where there is at least one live
 * store on the line where the warning would be reported.
 *
 * @param accumulator
 *            BugAccumulator containing warnings for method
 * @param liveStoreSourceLineSet
 *            bitset of lines where at least one live store was seen
 */
private void suppressWarningsIfOneLiveStoreOnLine(BugAccumulator accumulator, BitSet liveStoreSourceLineSet) {
    if (!SUPPRESS_IF_AT_LEAST_ONE_LIVE_STORE_ON_LINE) {
        return;
    }

    // Eliminate any accumulated warnings for instructions
    // that (due to inlining) *can* be live stores.
    entryLoop: for (Iterator<? extends BugInstance> i = accumulator.uniqueBugs().iterator(); i.hasNext();) {

        for (SourceLineAnnotation annotation : accumulator.locations(i.next())) {
            if (liveStoreSourceLineSet.get(annotation.getStartLine())) {
                // This instruction can be a live store; don't report
                // it as a warning.
                i.remove();
                continue entryLoop;
            }
        }
    }
}
 
开发者ID:OpenNTF,项目名称:FindBug-for-Domino-Designer,代码行数:29,代码来源:FindDeadLocalStores.java


示例10: WarningWithProperties

import edu.umd.cs.findbugs.SourceLineAnnotation; //导入依赖的package包/类
WarningWithProperties(BugInstance warning, WarningPropertySet<WarningProperty> propertySet,
        SourceLineAnnotation sourceLine, Location location) {
    this.instance = warning;
    this.propertySet = propertySet;
    this.sourceLine = sourceLine;
    this.location = location;
}
 
开发者ID:OpenNTF,项目名称:FindBug-for-Domino-Designer,代码行数:8,代码来源:FindRefComparison.java


示例11: addLines

import edu.umd.cs.findbugs.SourceLineAnnotation; //导入依赖的package包/类
/**
 * Adds lines with tainted source or path for reporting
 * 
 * @param locations collection of locations used to extract lines
 */
public void addLines(Collection<TaintLocation> locations) {
    Objects.requireNonNull(detector, "locations");
    for (TaintLocation location : locations) {
        lines.add(SourceLineAnnotation.fromVisitedInstruction(
            location.getMethodDescriptor(), location.getPosition()));
    }
}
 
开发者ID:blackarbiter,项目名称:Android_Code_Arbiter,代码行数:13,代码来源:InjectionSink.java


示例12: accumulateBug

import edu.umd.cs.findbugs.SourceLineAnnotation; //导入依赖的package包/类
/**
 *
 */
private void accumulateBug() {
    if (pendingBug == null)
        return;
    bugAccumulator.accumulateBug(pendingBug, SourceLineAnnotation.fromVisitedInstruction(this, monitorEnterPC));
    pendingBug = null;
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:10,代码来源:SynchronizationOnSharedBuiltinConstant.java


示例13: inspectResult

import edu.umd.cs.findbugs.SourceLineAnnotation; //导入依赖的package包/类
@Override
public void inspectResult(ClassContext classContext, MethodGen methodGen, CFG cfg,
        Dataflow<ResourceValueFrame, ResourceValueAnalysis<Lock>> dataflow, Lock resource) {

    JavaClass javaClass = classContext.getJavaClass();

    ResourceValueFrame exitFrame = dataflow.getResultFact(cfg.getExit());
    if (DEBUG) {
        System.out.println("Resource value at exit: " + exitFrame);
    }
    int exitStatus = exitFrame.getStatus();

    if (exitStatus == ResourceValueFrame.OPEN || exitStatus == ResourceValueFrame.OPEN_ON_EXCEPTION_PATH) {
        String bugType;
        int priority;
        if (exitStatus == ResourceValueFrame.OPEN) {
            bugType = "UL_UNRELEASED_LOCK";
            priority = HIGH_PRIORITY;
        } else {
            bugType = "UL_UNRELEASED_LOCK_EXCEPTION_PATH";
            priority = NORMAL_PRIORITY;
        }

        String sourceFile = javaClass.getSourceFileName();
        Location location = resource.getLocation();
        InstructionHandle handle = location.getHandle();
        InstructionHandle nextInstruction = handle.getNext();
        if (nextInstruction.getInstruction() instanceof RETURN)
            return; // don't report as error; intentional
        bugAccumulator.accumulateBug(new BugInstance(this, bugType, priority).addClassAndMethod(methodGen, sourceFile),
                SourceLineAnnotation.fromVisitedInstruction(classContext, methodGen, sourceFile, handle));
    }
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:34,代码来源:FindUnreleasedLock.java


示例14: visit

import edu.umd.cs.findbugs.SourceLineAnnotation; //导入依赖的package包/类
@Override
public void visit(LocalVariable obj) {
    if (isReservedName(obj.getName())) {
        LocalVariableAnnotation var = new LocalVariableAnnotation(obj.getName(), obj.getIndex(), obj.getStartPC());
        SourceLineAnnotation source = SourceLineAnnotation.fromVisitedInstruction(getClassContext(), this, obj.getStartPC());
        BugInstance bug = new BugInstance(this, "NM_FUTURE_KEYWORD_USED_AS_IDENTIFIER", NORMAL_PRIORITY)
                .addClassAndMethod(this).add(var).add(source);
        bugReporter.reportBug(bug);
    }
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:11,代码来源:DontUseEnum.java


示例15: sawOpcode

import edu.umd.cs.findbugs.SourceLineAnnotation; //导入依赖的package包/类
@Override
public void sawOpcode(int seen) {

    if (DEBUG)
        System.out.println("Saw opcode " + OPCODE_NAMES[seen] + " " + pendingIdivCastToDivBugLocation);

    if ((prevOpCode == I2D || prevOpCode == L2D) && seen == INVOKESTATIC && ClassName.isMathClass(getClassConstantOperand())
            && getNameConstantOperand().equals("ceil")) {
        bugAccumulator
                .accumulateBug(new BugInstance(this, "ICAST_INT_CAST_TO_DOUBLE_PASSED_TO_CEIL", HIGH_PRIORITY)
                        .addClassAndMethod(this), this);
        pendingIdivCastToDivBugLocation = null;
    } else if ((prevOpCode == I2F || prevOpCode == L2F) && seen == INVOKESTATIC
            && ClassName.isMathClass(getClassConstantOperand()) && getNameConstantOperand().equals("round")) {
        bugAccumulator.accumulateBug(
                new BugInstance(this, "ICAST_INT_CAST_TO_FLOAT_PASSED_TO_ROUND", NORMAL_PRIORITY).addClassAndMethod(this),
                this);
        pendingIdivCastToDivBugLocation = null;
    } else if (pendingIdivCastToDivBugLocation != null) {
        bugAccumulator.accumulateBug(
                new BugInstance(this, "ICAST_IDIV_CAST_TO_DOUBLE", NORMAL_PRIORITY).addClassAndMethod(this),
                pendingIdivCastToDivBugLocation);
        pendingIdivCastToDivBugLocation = null;
    }

    if (prevOpCode == IDIV && (seen == I2D || seen == I2F) || prevOpCode == LDIV && (seen == L2D || seen == L2F))
        pendingIdivCastToDivBugLocation = SourceLineAnnotation.fromVisitedInstruction(this);
    prevOpCode = seen;
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:30,代码来源:IDivResultCastToDouble.java


示例16: handleSuspiciousRefComparison

import edu.umd.cs.findbugs.SourceLineAnnotation; //导入依赖的package包/类
private void handleSuspiciousRefComparison(JavaClass jclass, Method method, MethodGen methodGen,
        List<WarningWithProperties> refComparisonList, Location location, String lhs, ReferenceType lhsType,
        ReferenceType rhsType) {
    XField xf = null;
    if (lhsType instanceof FinalConstant)
        xf = ((FinalConstant) lhsType).getXField();
    else if (rhsType instanceof FinalConstant)
        xf = ((FinalConstant) rhsType).getXField();
    String sourceFile = jclass.getSourceFileName();
    String bugPattern = "RC_REF_COMPARISON";
    int priority = Priorities.HIGH_PRIORITY;
    if (lhs.equals("java.lang.Boolean")) {
        bugPattern = "RC_REF_COMPARISON_BAD_PRACTICE_BOOLEAN";
        priority = Priorities.NORMAL_PRIORITY;
    } else if (xf != null && xf.isStatic() && xf.isFinal()) {
        bugPattern = "RC_REF_COMPARISON_BAD_PRACTICE";
        if (xf.isPublic() || !methodGen.isPublic())
            priority = Priorities.NORMAL_PRIORITY;
    }
    BugInstance instance = new BugInstance(this, bugPattern, priority).addClassAndMethod(methodGen, sourceFile)
            .addType("L" + lhs.replace('.', '/') + ";").describe(TypeAnnotation.FOUND_ROLE);
    if (xf != null)
        instance.addField(xf).describe(FieldAnnotation.LOADED_FROM_ROLE);
    else
        instance.addSomeSourceForTopTwoStackValues(classContext, method, location);
    SourceLineAnnotation sourceLineAnnotation = SourceLineAnnotation.fromVisitedInstruction(classContext, methodGen,
            sourceFile, location.getHandle());
    if (sourceLineAnnotation != null)
        refComparisonList.add(new WarningWithProperties(instance, new WarningPropertySet<WarningProperty>(),
                sourceLineAnnotation, location));
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:32,代码来源:FindRefComparison.java


示例17: countWarnings

import edu.umd.cs.findbugs.SourceLineAnnotation; //导入依赖的package包/类
private static Collection<SourceLineAnnotation> countWarnings( Collection<BugInstance> warnings,
        @CheckForNull String bugCode,
        int desiredPriority, int rank) {
    Collection<SourceLineAnnotation> matching = new HashSet<SourceLineAnnotation>();
    DetectorFactoryCollection i18n = DetectorFactoryCollection.instance();
    boolean matchPattern = false;
    try {
        i18n.getBugCode(bugCode);
    } catch (IllegalArgumentException e) {
        matchPattern = true;
    }

    if (warnings != null) {
        for (BugInstance warning : warnings) {
            if (warning.getPriority() > desiredPriority)
                continue;
            if (warning.getBugRank() > rank)
                continue;
            if (bugCode == null) {
                matching.add(warning.getPrimarySourceLineAnnotation());
                continue;
            }
            BugPattern pattern = warning.getBugPattern();
            String match;
            if (matchPattern)
                match = pattern.getType();
            else
                match = pattern.getAbbrev();
            if (match.equals(bugCode)) {
                matching.add(warning.getPrimarySourceLineAnnotation());
            }
        }
    }
    return matching;
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:36,代码来源:CheckExpectedWarnings.java


示例18: sawMethodCallWithIgnoredReturnValue

import edu.umd.cs.findbugs.SourceLineAnnotation; //导入依赖的package包/类
/**
 *
 */
private void sawMethodCallWithIgnoredReturnValue() {
    {
        CheckReturnValueAnnotation annotation = checkReturnAnnotationDatabase.getResolvedAnnotation(callSeen, false);
        if (annotation == null) {
            XFactory xFactory = AnalysisContext.currentXFactory();
            
            if (xFactory.isFunctionshatMightBeMistakenForProcedures(callSeen.getMethodDescriptor())) {
                annotation = CheckReturnValueAnnotation.CHECK_RETURN_VALUE_INFERRED;
            }
        }
        if (annotation != null && annotation.getPriority() <= LOW_PRIORITY) {
            int popPC = getPC();
            if (DEBUG)
                System.out.println("Saw POP @" + popPC);
            int catchSize = getSizeOfSurroundingTryBlock(popPC);

            int priority = annotation.getPriority();
            if (catchSize <= 1)
                priority += 2;
            else if (catchSize <= 2)
                priority += 1;
            if (!checkReturnAnnotationDatabase.annotationIsDirect(callSeen)
                    && !callSeen.getSignature().endsWith(callSeen.getClassName().replace('.', '/') + ";"))
                priority++;
            if (callSeen.isPrivate())
                priority++;
            if (callSeen.getName().equals("clone") || callSeen.getName().startsWith("get"))
                priority++;
            String pattern = annotation.getPattern();
            if (callSeen.getName().equals("<init>")
                    && (callSeen.getClassName().endsWith("Exception") || callSeen.getClassName().endsWith("Error")))
                pattern = "RV_EXCEPTION_NOT_THROWN";
            BugInstance warning = new BugInstance(this, pattern, priority).addClassAndMethod(this).addMethod(callSeen)
                    .describe(MethodAnnotation.METHOD_CALLED);
            bugAccumulator.accumulateBug(warning, SourceLineAnnotation.fromVisitedInstruction(this, callPC));
        }
        state = SCAN;
    }
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:43,代码来源:MethodReturnCheck.java


示例19: examineReturnInstruction

import edu.umd.cs.findbugs.SourceLineAnnotation; //导入依赖的package包/类
private void examineReturnInstruction(Location location) throws DataflowAnalysisException, CFGBuilderException {
    if (DEBUG_NULLRETURN) {
        System.out.println("Checking null return at " + location);
    }

    IsNullValueDataflow invDataflow = classContext.getIsNullValueDataflow(method);
    IsNullValueFrame frame = invDataflow.getFactAtLocation(location);
    ValueNumberFrame vnaFrame = classContext.getValueNumberDataflow(method).getFactAtLocation(location);
    if (!vnaFrame.isValid())
        return;
    ValueNumber valueNumber = vnaFrame.getTopValue();
    if (!frame.isValid())
        return;
    IsNullValue tos = frame.getTopValue();
    if (tos.isDefinitelyNull()) {
        BugAnnotation variable = ValueNumberSourceInfo.findAnnotationFromValueNumber(method, location, valueNumber, vnaFrame,
                "VALUE_OF");

        String bugPattern = "NP_NONNULL_RETURN_VIOLATION";
        int priority = NORMAL_PRIORITY;
        if (tos.isDefinitelyNull() && !tos.isException())
            priority = HIGH_PRIORITY;
        String methodName = method.getName();
        if (methodName.equals("clone")) {
            bugPattern = "NP_CLONE_COULD_RETURN_NULL";
            priority = NORMAL_PRIORITY;
        } else if (methodName.equals("toString")) {
            bugPattern = "NP_TOSTRING_COULD_RETURN_NULL";
            priority = NORMAL_PRIORITY;
        }
        BugInstance warning = new BugInstance(this, bugPattern, priority).addClassAndMethod(classContext.getJavaClass(),
                method).addOptionalAnnotation(variable);
        bugAccumulator.accumulateBug(warning, SourceLineAnnotation.fromVisitedInstruction(classContext, method, location));
    }
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:36,代码来源:FindNullDeref.java


示例20: FileBugHash

import edu.umd.cs.findbugs.SourceLineAnnotation; //导入依赖的package包/类
FileBugHash(BugCollection bugs) {

        for (PackageStats pStat : bugs.getProjectStats().getPackageStats())
            for (ClassStats cStat : pStat.getSortedClassStats()) {
                String path = cStat.getName();
                if (path.indexOf('.') == -1)
                    path = cStat.getSourceFile();
                else
                    path = path.substring(0, path.lastIndexOf('.') + 1).replace('.', '/') + cStat.getSourceFile();
                counts.put(path, 0);
                Integer size = sizes.get(path);
                if (size == null)
                    size = 0;
                sizes.put(path, size + cStat.size());
            }
        for (BugInstance bug : bugs.getCollection()) {
            SourceLineAnnotation source = bug.getPrimarySourceLineAnnotation();

            String packagePath = source.getPackageName().replace('.', '/');
            String key;
            if (packagePath.length() == 0)
                key = source.getSourceFile();
            else
                key = packagePath + "/" + source.getSourceFile();
            StringBuilder buf = hashes.get(key);
            if (buf == null) {
                buf = new StringBuilder();
                hashes.put(key, buf);
            }
            buf.append(bug.getInstanceKey()).append("-").append(source.getStartLine()).append(".")
                    .append(source.getStartBytecode()).append(" ");
            Integer count = counts.get(key);
            if (count == null)
                counts.put(key, 1);
            else
                counts.put(key, 1 + count);
        }
    }
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:39,代码来源:FileBugHash.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java TubelineassemblyMessages类代码示例发布时间:2022-05-23
下一篇:
Java FocusBehavior类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap