Package edu.umd.cs.findbugs.OpcodeStack

Examples of edu.umd.cs.findbugs.OpcodeStack.Item


            }

            String name = getNameConstantOperand();
            String sig = getSigConstantOperand();
            if ((name.startsWith("set") || name.startsWith("update")) || sig.endsWith(")V")) {
                Item invokedOn = stack.getItemMethodInvokedOn(this);
                if (invokedOn.isInitialParameter() && invokedOn.getRegisterNumber() == 0) {
                    updates++;
                }
                if (inferredMethod != null) {
                    inferredMethod.addCalledMethod(this);
                }
View Full Code Here


            }

            FieldSummary fieldSummary = AnalysisContext
                    .currentAnalysisContext().getFieldSummary();
            if (fieldSummary != null) {
                Item summary = fieldSummary.getSummary(xfield);
                if (summary != null) {
                    if (xfield.isFinal() && summary.isNull()) {
                        return TypeFrame.getNullType();
                    }
                    if (!summary.getSignature().equals("Ljava/lang/Object;")) {
                        loadType = (ReferenceType) Type.getType(summary
                                .getSignature());
                    }
                }
            }
        }
View Full Code Here

        if (checkForKnownValue(obj)) {
            return;
        }
        XField field = XFactory.createXField(obj, cpg);
        if (field.isFinal()) {
            Item summary = AnalysisContext.currentAnalysisContext().getFieldSummary().getSummary(field);
            if (summary.isNull()) {
                produce(IsNullValue.nullValue());
                return;
            }
        }
        if (field.getClassName().equals("java.util.logging.Level") && field.getName().equals("SEVERE")
View Full Code Here

        }

        OpcodeStack.Item oldSummary = summary.get(fieldOperand);
        if (oldSummary != null) {
            Item newValue = OpcodeStack.Item.merge(mergeValue, oldSummary);
            newValue.clearNewlyAllocated();
            summary.put(fieldOperand, newValue);
        } else {
            if (mergeValue.isNewlyAllocated()) {
                mergeValue = new OpcodeStack.Item(mergeValue);
                mergeValue.clearNewlyAllocated();
View Full Code Here

                    removed++;
                    continue;
                }
                OpcodeStack.Item defaultItem = new OpcodeStack.Item(f.getSignature());
                fields++;
                Item value = entry.getValue();
                value.makeCrossMethod();
                if (defaultItem.equals(value)) {
                    i.remove();
                    removed++;
                } else {
                    retained++;
View Full Code Here

            }
        }
         */

        if (seen >= IALOAD && seen <= SALOAD || seen >= IASTORE && seen <= SASTORE) {
            Item index = stack.getStackItem(0);
            if (index.getSpecialKind() == Item.AVERAGE_COMPUTED_USING_DIVISION) {
                SourceLineAnnotation where;
                if (index.getPC() >= 0) {
                    where = SourceLineAnnotation.fromVisitedInstruction(this, index.getPC());
                } else {
                    where = SourceLineAnnotation.fromVisitedInstruction(this);
                }
                bugAccumulator.accumulateBug(
                        new BugInstance(this, "IM_AVERAGE_COMPUTATION_COULD_OVERFLOW", NORMAL_PRIORITY).addClassAndMethod(this),
View Full Code Here

        public void visitGETSTATIC(GETSTATIC obj) {
            Type type = obj.getType(getCPG());
            XField xf = XFactory.createXField(obj, cpg);
            if (xf.isFinal()) {
                FieldSummary fieldSummary = AnalysisContext.currentAnalysisContext().getFieldSummary();
                Item summary = fieldSummary.getSummary(xf);
                if (summary.isNull()) {
                    pushValue(TypeFrame.getNullType());
                    return;
                }

                String slashedClassName = ClassName.fromFieldSignature(type.getSignature());
View Full Code Here

                handleLoad(obj);
            } else {
                XField xf = XFactory.createXField(obj, cpg);
                if (xf.isFinal()) {
                    FieldSummary fieldSummary = AnalysisContext.currentAnalysisContext().getFieldSummary();
                    Item summary = fieldSummary.getSummary(xf);
                    if (summary.isNull()) {
                        consumeStack(obj);
                        pushValue(TypeFrame.getNullType());
                        return;
                    }
View Full Code Here

            String signature = getSigConstantOperand();

            int numberArguments = PreorderVisitor.getNumberArguments(signature);

            for (int i = 0; i < numberArguments; i++) {
                Item item = stack.getStackItem(numberArguments - 1 - i);
                if (item.getSpecialKind() == OpcodeStack.Item.RESULT_OF_I2L) {
                    ParameterProperty property = database.getProperty(getMethodDescriptorOperand());
                    if (property != null && property.hasProperty(i)) {
                        int priority = NORMAL_PRIORITY;

                        if (getPrevOpcode(1) == I2L && getPrevOpcode(2) == IMUL && getPrevOpcode(3) == SIPUSH
View Full Code Here

            }
        }

        if ((seen == INVOKEINTERFACE || seen == INVOKEVIRTUAL) && getNameConstantOperand().equals("compare")
                && stack.getStackDepth() >= 2) {
            Item left = stack.getStackItem(1);
            Item right = stack.getStackItem(0);
            if (left.getRegisterNumber() + right.getRegisterNumber() == 1) {
                sawCompare = true;
            }
        }
        dangerDanger = false;

        if (seen == INVOKEVIRTUAL && getClassConstantOperand().equals("java/lang/Class")
                && getNameConstantOperand().equals("getName") && getSigConstantOperand().equals("()Ljava/lang/String;")
                && stack.getStackDepth() >= 2) {
            Item left = stack.getStackItem(1);
            XMethod leftM = left.getReturnValueOf();
            Item right = stack.getStackItem(0);
            XMethod rightM = right.getReturnValueOf();
            if (leftM != null && rightM != null && leftM.getName().equals("getName") && rightM.getName().equals("getClass")) {
                dangerDanger = true;
            }

        }
View Full Code Here

TOP

Related Classes of edu.umd.cs.findbugs.OpcodeStack.Item

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.