Package edu.umd.cs.findbugs.OpcodeStack

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


    /**
     *
     */
    private void checkForComparingClasses() {
        if (stack.getStackDepth() >= 2) {
            Item left = stack.getStackItem(1);
            XMethod leftM = left.getReturnValueOf();
            Item right = stack.getStackItem(0);
            XMethod rightM = right.getReturnValueOf();
            if (left.getSignature().equals("Ljava/lang/Class;") && right.getSignature().equals("Ljava/lang/Class;")) {
                boolean leftMatch = leftM != null && leftM.getName().equals("getClass");
                boolean rightMatch = rightM != null && rightM.getName().equals("getClass");
                if (leftMatch && rightMatch) {
                    sawGoodEqualsClass = true;
                } else {
                    if (getClassName().equals(left.getConstant()) && rightMatch || leftMatch
                            && getClassName().equals(right.getConstant())) {
                        if (getThisClass().isFinal()) {
                            sawGoodEqualsClass = true;
                        } else {
                            sawBadEqualsClass = true;
                            if (AnalysisContext.currentAnalysisContext().isApplicationClass(getThisClass())) {
View Full Code Here


    @Override
    public void sawOpcode(int seen) {
        if (seen == PUTFIELD) {
            XField xField = getXFieldOperand();
            if (xField != null && xField.getClassDescriptor().equals(getClassDescriptor())) {
                Item first = stack.getStackItem(0);

                boolean isPutOfDefaultValue = first.isNull(); // huh?? ||
                // first.isInitialParameter();
                if (!isPutOfDefaultValue && first.getConstant() != null) {
                    Object constant = first.getConstant();
                    if (constant instanceof Number && ((Number) constant).intValue() == 0 || constant.equals(Boolean.FALSE)) {
                        isPutOfDefaultValue = true;
                    }
                }

                if (isPutOfDefaultValue) {
                    if (getMethodName().equals("<init>")) {
                        transientFieldsSetToDefaultValueInConstructor.add(xField);
                    }
                } else {
                    String nameOfField = getNameConstantOperand();

                    if (transientFieldsUpdates.containsKey(xField)) {
                        if (getMethodName().equals("<init>")) {
                            transientFieldsSetInConstructor.add(xField);
                        } else {
                            transientFieldsUpdates.put(xField, transientFieldsUpdates.get(xField) + 1);
                        }
                    } else if (fieldsThatMightBeAProblem.containsKey(nameOfField)) {
                        try {

                            JavaClass classStored = first.getJavaClass();
                            if (classStored == null) {
                                return;
                            }
                            double isSerializable = DeepSubtypeAnalysis.isDeepSerializable(classStored);
                            if (isSerializable <= 0.2) {
View Full Code Here

        String genericSignature = obj.getGenericSignature();
        if (genericSignature != null && genericSignature.startsWith("T")) {
            return;
        }
        FieldSummary fieldSummary = AnalysisContext.currentAnalysisContext().getFieldSummary();
        Item summary = fieldSummary.getSummary(getXField());
        String fieldSig = summary.getSignature();

        if (isEjbImplClass) {
            ClassDescriptor fieldType = DescriptorFactory.createClassDescriptorFromFieldSignature(fieldSig);
            if (fieldType != null) {
                if (Subtypes2.instanceOf(fieldType, "javax.ejb.SessionContext")
View Full Code Here

                }
                if (possibleMatch == null) {
                    String signature = stack.getLVValue(registerNumber).getSignature();
                    for (int i = 0; i < stack.getNumLocalValues(); i++) {
                        if (i != register) {
                            Item lvValue = stack.getLVValue(i);
                            if (lvValue != null && lvValue.getSignature().equals(signature)) {
                                priority--;
                                break;
                            }
                        }
                    }
View Full Code Here

    static  List<Item>  getInitialLocals(MethodDescriptor descriptor) {
        List<Item> locals = new ArrayList<Item>();
        Type[] argTypes = Type.getArgumentTypes(descriptor.getSignature());
        int reg = 0;
        if (!descriptor.isStatic()) {
            Item it = Item.typeOnly("L" + descriptor.getSlashedClassName() + ";");
            locals.add(it);
            reg += it.getSize();
        }
        for (Type argType : argTypes) {
            Item it = Item.typeOnly(argType.getSignature());
            locals.add(it);
            reg += it.getSize();
            if (it.usesTwoSlots()) {
                locals.add(null);
            }
        }
        return locals;
    }
View Full Code Here

                addStack(stack, e.getTypesOfStackItems());
                break;
            case CHOP_FRAME :
                stack.clear();
                for(int i = 0; i < e.getNumberOfLocals(); i++) {
                    Item it = locals.remove(locals.size()-1);
                    if (it == null) {
                        it = locals.remove(locals.size()-1);
                        assert it.usesTwoSlots();
                    }
                }
                break;

            case APPEND_FRAME:
View Full Code Here

            return  Item.typeOnly("J");
        case Constants.ITEM_Bogus:
        case Constants.ITEM_NewObject:
            return Item.typeOnly("Ljava/lang/Object;");
        case Constants.ITEM_Null:
            Item it = new Item();
            it.setSpecialKind(Item.TYPE_ONLY);
            return it;
        case Constants.ITEM_InitObject:
            return Item.typeOnly("Ljava/lang/Object;");
        case Constants.ITEM_Object:
            int index = t.getIndex();
View Full Code Here

        }
    }
    static private void addLocals(List<Item> lst, StackMapType[] typesOfStackItems) {
        for(StackMapType t : typesOfStackItems) {
            Item item = getItem(t);
            lst.add(item);
            if (item.usesTwoSlots()) {
                lst.add(null);
            }
        }

    }
View Full Code Here

        }

    }
    static private void addStack(List<Item> lst, StackMapType[] typesOfStackItems) {
        for(StackMapType t : typesOfStackItems) {
            Item item = getItem(t);
            lst.add(item);
        }

    }
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.