Package edu.umd.cs.findbugs

Examples of edu.umd.cs.findbugs.LocalVariableAnnotation


            catchSize = Util.getSizeOfSurroundingTryBlock(getConstantPool(), getCode(), "java/lang/NoSuchElementException",
                    getPC());
            if (catchSize < Integer.MAX_VALUE) {
                bug.lowerPriorityALot();
            } else {
                LocalVariableAnnotation lv = bug.getPrimaryLocalVariableAnnotation();
                if (lv == null && getMethodName().equals("run")) {
                    bug.lowerPriority();
                }
            }
        }
View Full Code Here


            int nextOpcode = 0xff & codeBytes[getPC() + 3];
            if (nextOpcode != POP && !initializedFields.contains(f) && declaredFields.contains(f) && !containerFields.contains(f)
                    && !unreadFields.isContainerField(xField)) {
                // System.out.println("Next opcode: " +
                // OPCODE_NAMES[nextOpcode]);
                LocalVariableAnnotation possibleTarget = LocalVariableAnnotation.findMatchingIgnoredParameter(getClassContext(),
                        getMethod(), getNameConstantOperand(), xField.getSignature());
                if (possibleTarget == null) {
                    possibleTarget = LocalVariableAnnotation.findUniqueBestMatchingParameter(getClassContext(), getMethod(),
                            getNameConstantOperand(), getSigConstantOperand());
                }
View Full Code Here

                }
                bugAccumulator.accumulateBug(bug, this);
            }

            else if (opCode == IXOR && item0.equals(item1)) {
                LocalVariableAnnotation localVariableAnnotation = LocalVariableAnnotation.getLocalVariableAnnotation(this, item0);
                if (localVariableAnnotation != null) {
                    bugAccumulator.accumulateBug(
                            new BugInstance(this, "SA_LOCAL_SELF_" + op, linesDifference > 1 ? NORMAL_PRIORITY : HIGH_PRIORITY).addClassAndMethod(this).add(
                                    localVariableAnnotation), this);
                }
View Full Code Here

        BugInstance bugInstance = new BugInstance(this, type, priority).addClassAndMethod(classContext.getJavaClass(), method);
        if (variable != null) {
            bugInstance.add(variable);
        } else {
            bugInstance.add(new LocalVariableAnnotation("?", -1, -1));
        }
        bugInstance.addSourceLine(classContext, method, location).describe("SOURCE_LINE_DEREF");

        if (FindBugsAnalysisFeatures.isRelaxedMode()) {
            WarningPropertyUtil.addPropertiesForDataMining(propertySet, classContext, method, location);
View Full Code Here

                    return;
                }
                variableAnnotation = ValueNumberSourceInfo.findAnnotationFromValueNumber(method, location, valueNumber, vnaFrame,
                        "VALUE_OF");
                if (variableAnnotation instanceof LocalVariableAnnotation) {
                    LocalVariableAnnotation local = (LocalVariableAnnotation) variableAnnotation;
                    if (!local.isNamed()) {
                        if (warning.equals("RCN_REDUNDANT_NULLCHECK_OF_NULL_VALUE")) {
                            return;
                        }
                        priority++;
                    }
                }

            }
        } catch (DataflowAnalysisException e) {
            // ignore
        } catch (CFGBuilderException e) {
            // ignore
        }

        BugInstance bugInstance = new BugInstance(this, warning, priority).addClassAndMethod(classContext.getJavaClass(), method);
        LocalVariableAnnotation fallback = new LocalVariableAnnotation("?", -1, -1);
        boolean foundSource =  bugInstance.tryAddingOptionalUniqueAnnotations(variableAnnotation,
                BugInstance.getFieldOrMethodValueSource(item1), BugInstance.getFieldOrMethodValueSource(item2));

        if (!foundSource) {
            if (warning.equals("RCN_REDUNDANT_NULLCHECK_OF_NULL_VALUE")) {
View Full Code Here

                            return;
                        }
                        variableAnnotation = ValueNumberSourceInfo.findAnnotationFromValueNumber(method, location, valueNumber, vnaFrame,
                                "VALUE_OF");
                        if (variableAnnotation instanceof LocalVariableAnnotation) {
                            LocalVariableAnnotation local = (LocalVariableAnnotation) variableAnnotation;
                            if (!local.isNamed()) {
                                priority++;
                            }
                        }

                    }
View Full Code Here

                    fieldAnnotation = FieldAnnotation.fromXField(field);
                    fieldAnnotation.setDescription(FieldAnnotation.LOADED_FROM_ROLE);
                }

                if (reg != -1) {
                    LocalVariableAnnotation lva = LocalVariableAnnotation.getLocalVariableAnnotation(getMethod(), reg, getPC(),
                            getPC() - 1);
                    if (lva.isNamed()) {
                        as.add(lva);
                        if (fieldAnnotation != null) {
                            as.add(fieldAnnotation);
                        }
                    } else {
View Full Code Here

    }

    @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);
        }
View Full Code Here

        if (location.getHandle().getInstruction() instanceof ACONST_NULL) {
            StringAnnotation nullConstant = new StringAnnotation("null");
            nullConstant.setDescription(StringAnnotation.STRING_NONSTRING_CONSTANT_ROLE);
            return nullConstant;
        }
        LocalVariableAnnotation ann = ValueNumberSourceInfo.findLocalAnnotationFromValueNumber(method, location, valueNumber,
                vnaFrame);
        if (ann != null && partialRole != null) {
            ann.setDescription("LOCAL_VARIABLE_" + partialRole);
        }

        if (ann != null && ann.isSignificant()) {
            return ann;
        }
        FieldAnnotation field = ValueNumberSourceInfo.findFieldAnnotationFromValueNumber(method, location, valueNumber, vnaFrame);
        if (field != null) {
            if (partialRole != null) {
View Full Code Here

            ValueNumberFrame vnaFrame, @CheckForNull String partialRole) {
        BugAnnotation result = findAnnotationFromValueNumber(method, location, valueNumber, vnaFrame, partialRole);
        if (result != null) {
            return result;
        }
        return new LocalVariableAnnotation("?", -1, location.getHandle().getPosition());
    }
View Full Code Here

TOP

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

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.