Package edu.umd.cs.findbugs.ba.type

Examples of edu.umd.cs.findbugs.ba.type.TypeFrame


                    definitelyNullArgSet.clear(i);
                }

            }
        }
        TypeFrame typeFrame = typeDataflow.getFactAtLocation(location);
        Set<JavaClassAndMethod> targetMethodSet = Hierarchy.resolveMethodCallTargets(invokeInstruction, typeFrame, cpg);
        if (DEBUG_NULLARG) {
            System.out.println("Possibly called methods: " + targetMethodSet);
        }
View Full Code Here


            handleNormalInstruction(obj);
        } else {
            // Special case: some special value is pushed on the stack for the
            // return value
            IsNullValue result = null;
            TypeFrame typeFrame;
            try {
                typeFrame = typeDataflow.getFactAtLocation(location);

                Set<XMethod> targetSet = Hierarchy2.resolveMethodCallTargets(obj, typeFrame, cpg);
View Full Code Here

            String cName = invoke.getClassName(cpg);
            if (!cName.equals("javax.servlet.http.HttpSession")) {
                continue;
            }

            TypeFrame frame = typeDataflow.getFactAtLocation(location);
            if (!frame.isValid()) {
                // This basic block is probably dead
                continue;
            }
            Type operandType = frame.getTopValue();

            if (operandType.equals(TopType.instance())) {
                // unreachable
                continue;
            }
View Full Code Here

            for (Iterator<Location> i = cfg.locationIterator(); i.hasNext();) {
                Location location = i.next();
                InstructionHandle handle = location.getHandle();
                Instruction ins = handle.getInstruction();
                ValueNumberFrame valueNumberFrame = vna.getFactAtLocation(location);
                TypeFrame typeFrame = typeDataflow.getFactAtLocation(location);
                if (ins instanceof InvokeInstruction) {
                    InvokeInstruction inv = (InvokeInstruction) ins;
                    XMethod m = XFactory.createXMethod(inv, cpg);
                    SignatureParser sigParser = new SignatureParser(m.getSignature());
                    int numParams = sigParser.getNumParameters();
View Full Code Here

        }
        Type type = null;
        if ((opcode == Constants.IFNULL && edge.getType() == EdgeTypes.IFCMP_EDGE)
                || (opcode == Constants.IFNONNULL && edge.getType() == EdgeTypes.FALL_THROUGH_EDGE)) {
            Location location = new Location(last, sourceBlock);
            TypeFrame typeFrame = typeDataflow.getFactAtLocation(location);
            if (typeFrame.isValid()) {
                type = typeFrame.getTopValue();
                if (DEBUG_NULL_CHECK) {
                    System.out.println("ifnull comparison of " + type + " to null at " + last);
                }
            }
        }
View Full Code Here

            //
            // Check nullness and type of the top two stack values.
            //
            Location location = new Location(last, sourceBlock);
            IsNullValueFrame invFrame = invDataflow.getFactAtLocation(location);
            TypeFrame typeFrame = typeDataflow.getFactAtLocation(location);
            if (invFrame.isValid() && typeFrame.isValid()) {
                //
                // See if exactly one of the top two stack values is definitely
                // null
                //
                boolean leftIsNull = invFrame.getStackValue(1).isDefinitelyNull();
                boolean rightIsNull = invFrame.getStackValue(0).isDefinitelyNull();

                if ((leftIsNull || rightIsNull) && !(leftIsNull && rightIsNull)) {
                    //
                    // Now we can determine what type was compared to null.
                    //
                    type = typeFrame.getStackValue(leftIsNull ? 0 : 1);
                    if (DEBUG_NULL_CHECK) {
                        System.out.println("acmp comparison of " + type + " to null at " + last);
                    }
                }
            }
View Full Code Here

                    database.getActions(receiverType, methodName, signature, isStatic, actionList);

                    if (actionList.isEmpty()) {

                        try {
                            TypeFrame factAtLocation = null;
                            SignatureParser sigParser = new SignatureParser(signature);
                            //                        int startIndex = 0;
                            //                        if (!xmethod.isStatic())
                            //                            startIndex = 1;
                            Iterator<String> signatureIterator = sigParser.parameterSignatureIterator();
                            int parameters = sigParser.getNumParameters();
                            for (int i = 0; i < parameters; i++) {
                                String sig = signatureIterator.next();
                                Collection<ClassDescriptor> annotations = invokedMethod.getParameterAnnotationDescriptors(i);
                                if (annotations.contains(WILL_CLOSE) || sig.equals("Ljava/io/Closeable;") || methodName.startsWith("close")) {
                                    // closing this value
                                    if (factAtLocation == null) {
                                        factAtLocation = typeDataflow.getFactAtLocation( new Location(handle, block));
                                    }

                                    Type argumentType = factAtLocation.getArgument(inv, cpg, i, sigParser);
                                    if (argumentType instanceof ObjectType) {
                                        Obligation obligation = database.getFactory().getObligationByType((ObjectType) argumentType);
                                        if (obligation != null) {
                                            actionList.add(new ObligationPolicyDatabaseAction(ObligationPolicyDatabaseActionType.DEL, obligation));
                                        }

                                    }

                                }
                            }

                        } catch (CheckedAnalysisException e) {
                            AnalysisContext.logError("Error checking " + invokedMethod, e);
                        } catch (ClassNotFoundException e) {
                            AnalysisContext.reportMissingClass(e);
                        } finally { }


                    }
                    if (DEBUG_LOOKUP && !actionList.isEmpty()) {
                        System.out.println("  At " + handle + ": " + actionList);
                    }
                }
            } else if (ins instanceof PUTFIELD || ins instanceof PUTSTATIC || ins instanceof ARETURN) {
                Location loc = new Location(handle, block);
                try {
                    TypeFrame typeFrame = typeDataflow.getFactAtLocation(loc);
                    if (typeFrame.isValid()) {
                        Type tosType = typeFrame.getTopValue();
                        if (tosType instanceof ObjectType) {
                            ObligationFactory factory = database.getFactory();
                            Obligation obligation = factory.getObligationByType((ObjectType) tosType);
                            if (obligation != null) {
                                if (obligation.getClassName().equals("java.sql.ResultSet")) {
View Full Code Here

                // don't report this case; it might be infeasible due to
                // inlining
                continue;
            }

            TypeFrame frame = typeDataflow.getFactAtLocation(location);
            if (!frame.isValid()) {
                // This basic block is probably dead
                continue;
            }

            Type operandType = frame.getTopValue();
            if (operandType.equals(TopType.instance())) {
                // unreachable
                continue;
            }
            boolean operandTypeIsExact = frame.isExact(frame.getStackLocation(0));
            final Type castType = ((TypedInstruction) ins).getType(cpg);

            if (!(castType instanceof ReferenceType)) {
                // This shouldn't happen either
                continue;
View Full Code Here

                continue;
            }

            // The top value on the stack is the one which will be stored
            // into the field
            TypeFrame frame = typeDataflow.getFactAtLocation(location);
            if (!frame.isValid()) {
                continue;
            }
            Type storeType = frame.getTopValue();
            if (!(storeType instanceof ReferenceType)) {
                continue;
            }

            // Get or create the field store type set
View Full Code Here

            String cName = invoke.getClassName(cpg);
            if (!cName.equals("java.io.ObjectOutput") && !cName.equals("java.io.ObjectOutputStream")) {
                continue;
            }

            TypeFrame frame = typeDataflow.getFactAtLocation(location);
            if (!frame.isValid()) {
                // This basic block is probably dead
                continue;
            }
            Type operandType = frame.getTopValue();

            if (operandType.equals(TopType.instance())) {
                // unreachable
                continue;
            }
View Full Code Here

TOP

Related Classes of edu.umd.cs.findbugs.ba.type.TypeFrame

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.