Package edu.umd.cs.findbugs

Examples of edu.umd.cs.findbugs.BugAnnotation


                //                }
                assignedNullLocationSet = Collections.<Location> emptySet();
            }
            SortedSet<Location> knownNullAndDoomedAt = bugLocationMap.get(valueNumber);

            BugAnnotation variableAnnotation = null;
            try {
                for (Location loc : derefLocationSet) {
                    variableAnnotation = ValueNumberSourceInfo.findAnnotationFromValueNumber(method, loc, valueNumber,
                            vnaDataflow.getFactAtLocation(loc), "VALUE_OF");
                    if (variableAnnotation != null) {
View Full Code Here


        Set<String> classSet = new HashSet<String>();

        for (Iterator<BugInstance> i = bugCollection.iterator(); i.hasNext();) {
            BugInstance warning = i.next();
            for (Iterator<BugAnnotation> j = warning.annotationIterator(); j.hasNext();) {
                BugAnnotation annotation = j.next();
                if (!(annotation instanceof ClassAnnotation)) {
                    continue;
                }
                classSet.add(((ClassAnnotation) annotation).getClassName());
            }
View Full Code Here

            ValueNumberFrame vFrame = vnaDataflow.getFactAtLocation(location);
            if (paramValueNumberSet == null) {
                paramValueNumberSet = getParameterValueNumbers(classContext, method, cfg);
            }
            ValueNumber valueNumber = vFrame.getTopValue();
            BugAnnotation valueSource = ValueNumberSourceInfo.findAnnotationFromValueNumber(method, location, valueNumber, vFrame,
                    "VALUE_OF");
            // XXX call below causes 86% of all OpcodeStackDetector.EarlyExitException (getPC() == targetPC) thrown (13000 on java* JDK7 classes)
            BugAnnotation source = BugInstance.getSourceForTopStackValue(classContext, method, location);
            boolean isParameter = paramValueNumberSet.contains(valueNumber) && source instanceof LocalVariableAnnotation;

            try {
                JavaClass castJavaClass = Repository.lookupClass(castName);
                JavaClass refJavaClass = Repository.lookupClass(refName);
View Full Code Here

        boolean onExceptionPath = refValue.isException();
        if (onExceptionPath) {
            propertySet.addProperty(GeneralWarningProperty.ON_EXCEPTION_PATH);
        }
        BugAnnotation variable = ValueNumberSourceInfo.findAnnotationFromValueNumber(method, location, valueNumber, vnaFrame,
                "VALUE_OF");
        addPropertiesForDereferenceLocations(propertySet, Collections.singleton(location));
        Instruction ins = location.getHandle().getInstruction();
        BugAnnotation cause;
        final ConstantPoolGen cpg = classContext.getConstantPoolGen();

        if (ins instanceof InvokeInstruction) {
            InvokeInstruction iins = (InvokeInstruction) ins;
            XMethod invokedMethod = XFactory.createXMethod((InvokeInstruction) ins, cpg);
            cause = MethodAnnotation.fromXMethod(invokedMethod);
            cause.setDescription(MethodAnnotation.METHOD_CALLED);

            if (iins.getMethodName(cpg).equals("close") && iins.getSignature(cpg).equals("()V")) {
                propertySet.addProperty(NullDerefProperty.CLOSING_NULL);
            }
        } else if (ins instanceof FieldInstruction) {
View Full Code Here

        int priority = HIGH_PRIORITY;
        if (opcode == ISUB || opcode == LSUB || opcode == INVOKEINTERFACE || opcode == INVOKEVIRTUAL) {
            priority = NORMAL_PRIORITY;
        }
        XField field = ValueNumberSourceInfo.findXFieldFromValueNumber(method, location, v0, frame);
        BugAnnotation annotation;
        String prefix;
        if (field != null) {
            if (field.isVolatile()) {
                return;
            }
View Full Code Here

                }

                if (unconditionalDeref.isUnconditionallyDereferenced(value)) {
                    SourceLineAnnotation tested = SourceLineAnnotation.fromVisitedInstruction(getClassContext(), getMethod(),
                            produced);
                    BugAnnotation variableAnnotation = ValueNumberSourceInfo.findAnnotationFromValueNumber(getMethod(), produced,
                            value, valueNumberFact, "VALUE_OF");
                    Set<Location> unconditionalDerefLocationSet = unconditionalDeref.getUnconditionalDerefLocationSet(value);

                    BugInstance bug;
                    if (unconditionalDerefLocationSet.size() > 1) {
View Full Code Here

                            int locals = vna.getNumLocals();
                            //                            boolean isRetained = false;
                            for (int pos = 0; pos < locals; pos++) {
                                if (vna.getValue(pos).equals(vn) && live.get(pos)) {
                                    BugAnnotation ba = ValueNumberSourceInfo.findAnnotationFromValueNumber(method, location, vn,
                                            vnaDataflow.getFactAtLocation(location), "VALUE_OF");
                                    if (ba == null) {
                                        continue;
                                    }
                                    String pattern = "RV_RETURN_VALUE_OF_PUTIFABSENT_IGNORED";
View Full Code Here

                this.myDocument = src;
                src.getHighlightInformation().clear();
                String primaryKind = mySourceLine.getDescription();
                // Display myBug and mySourceLine
                for (Iterator<BugAnnotation> i = myBug.annotationIterator(); i.hasNext();) {
                    BugAnnotation annotation = i.next();
                    if (annotation instanceof SourceLineAnnotation) {
                        SourceLineAnnotation sourceAnnotation = (SourceLineAnnotation) annotation;
                        if (sourceAnnotation == mySourceLine) {
                            continue;
                        }
View Full Code Here

            int originLine = (startLine + endLine) / 2;
            LinkedList<Integer> otherLines = new LinkedList<Integer>();
            // show(frame.getSourceCodeTextPane(), document,
            // thisSource);
            for (Iterator<BugAnnotation> i = myBug.annotationIterator(); i.hasNext();) {
                BugAnnotation annotation = i.next();
                if (annotation instanceof SourceLineAnnotation) {
                    SourceLineAnnotation sourceAnnotation = (SourceLineAnnotation) annotation;
                    if (sourceAnnotation != mySourceLine) {
                        // show(frame.getSourceCodeTextPane(),
                        // document, sourceAnnotation);
View Full Code Here

            if (!looksLikeTestCase) {

                try {
                    IsNullValueDataflow isNullDataflow = classContext.getIsNullValueDataflow(method);
                    IsNullValueFrame isNullFrame = isNullDataflow.getFactAtLocation(location);
                    BugAnnotation a = BugInstance.getSourceForTopStackValue(classContext, method, location);
                    int priority = NORMAL_PRIORITY;
                    if (a instanceof FieldAnnotation && ((FieldAnnotation) a).isStatic()) {
                        priority = LOW_PRIORITY;
                    }
                    if (isNullFrame.isValid() && isNullFrame.getTopValue().isDefinitelyNull()) {
View Full Code Here

TOP

Related Classes of edu.umd.cs.findbugs.BugAnnotation

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.