Package edu.umd.cs.findbugs.ba.interproc

Examples of edu.umd.cs.findbugs.ba.interproc.ParameterProperty


        JavaClass jclass = classContext.getJavaClass();

        for (Method method : jclass.getMethods()) {
            XMethod xmethod = XFactory.createXMethod(classContext.getJavaClass(), method);
            ParameterProperty nonnullParameters = AnalysisContext.currentAnalysisContext().getUnconditionalDerefParamDatabase()
                    .getProperty(xmethod.getMethodDescriptor());
            if (nonnullParameters != null) {
                for (int p : nonnullParameters.iterable()) {
                    TypeQualifierAnnotation directTypeQualifierAnnotation = TypeQualifierApplications
                            .getDirectTypeQualifierAnnotation(xmethod, p, nonnullTypeQualifierValue);
                    if (directTypeQualifierAnnotation != null && directTypeQualifierAnnotation.when == When.UNKNOWN) {
                        //
                        // The LocalVariableAnnotation is constructed using the
View Full Code Here


        for (JavaClassAndMethod targetMethod : targetMethodSet) {
            if (DEBUG_NULLARG) {
                System.out.println("For target method " + targetMethod);
            }

            ParameterProperty property = unconditionalDerefParamDatabase.getProperty(targetMethod.toMethodDescriptor());
            if (property == null) {
                continue;
            }
            if (DEBUG_NULLARG) {
                System.out.println("\tUnconditionally dereferenced params: " + property);
            }

            BitSet targetUnconditionallyDereferencedNullArgSet = property.getMatchingParameters(nullArgSet);

            if (targetUnconditionallyDereferencedNullArgSet.isEmpty()) {
                continue;
            }

            dangerousCallTargetList.add(targetMethod);

            unconditionallyDereferencedNullArgSet.or(targetUnconditionallyDereferencedNullArgSet);

            if (!property.getMatchingParameters(definitelyNullArgSet).isEmpty()) {
                veryDangerousCallTargetList.add(targetMethod);
            }
        }

        if (dangerousCallTargetList.isEmpty()) {
View Full Code Here

    @Override
    protected ParameterProperty decodeProperty(String propStr) throws PropertyDatabaseFormatException {
        try {
            int unconditionalDerefSet = Integer.parseInt(propStr);
            ParameterProperty prop = new ParameterProperty(unconditionalDerefSet);
            return prop;
        } catch (NumberFormatException e) {
            throw new PropertyDatabaseFormatException("Invalid unconditional deref param set: " + propStr);
        }
    }
View Full Code Here

                    try {
                        Set<JavaClassAndMethod> targetMethodSet = Hierarchy.resolveMethodCallTargets(inv, typeFrame, cpg);
                        BitSet unconditionallyDereferencedNullArgSet = null;
                        for (JavaClassAndMethod targetMethod : targetMethodSet) {

                            ParameterProperty property = unconditionalDerefParamDatabase.getProperty(targetMethod
                                    .toMethodDescriptor());
                            if (property == null) {
                                unconditionallyDereferencedNullArgSet = null;
                                break;
                            }
                            BitSet foo = property.getAsBitSet();
                            if (unconditionallyDereferencedNullArgSet == null) {
                                unconditionallyDereferencedNullArgSet = foo;
                            } else {
                                unconditionallyDereferencedNullArgSet.intersects(foo);
                            }
View Full Code Here

            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
                                && lastConstantForSIPUSH == 1000) {
                            priority = HIGH_PRIORITY;
View Full Code Here

            if (DEBUG_CHECK_CALLS) {
                System.out.println("target set size: " + targetSet.size());
            }
            // Compute the intersection of all properties
            ParameterProperty derefParamSet = null;
            for (XMethod target : targetSet) {
                if (target.isStub()) {
                    continue;
                }
                if (DEBUG_CHECK_CALLS) {
                    System.out.print("Checking: " + target + ": ");
                }

                ParameterProperty targetDerefParamSet = database.getProperty(target.getMethodDescriptor());
                if (targetDerefParamSet == null) {
                    // Hmm...no information for this target.
                    // assume it doesn't dereference anything
                    if (DEBUG_CHECK_CALLS) {
                        System.out.println("==> no information, assume no guaranteed dereferences");
                    }
                    return Collections.emptySet();
                }

                if (DEBUG_CHECK_CALLS) {
                    System.out.println("==> " + targetDerefParamSet);
                }
                if (derefParamSet == null) {
                    derefParamSet = new ParameterProperty();
                    derefParamSet.copyFrom(targetDerefParamSet);
                } else {
                    derefParamSet.intersectWith(targetDerefParamSet);
                }
            }
View Full Code Here

    ParameterProperty extremes;

    @Override
    protected void setUp() throws Exception {
        empty = new ParameterProperty();

        nonEmpty = new ParameterProperty();
        nonEmpty.setParamWithProperty(11, true);
        nonEmpty.setParamWithProperty(25, true);

        extremes = new ParameterProperty();
        extremes.setParamWithProperty(0, true);
        extremes.setParamWithProperty(31, true);
    }
View Full Code Here

            if (VERBOSE_DEBUG) {
                ClassContext.dumpDataflowInformation(method, cfg, vnaDataflow, classContext.getIsNullValueDataflow(method),
                        dataflow, classContext.getTypeDataflow(method));
            }
            ParameterProperty property = new ParameterProperty();
            property.setParamsWithProperty(unconditionalDerefSet);

            AnalysisContext.currentAnalysisContext().getUnconditionalDerefParamDatabase()
            .setProperty(xmethod.getMethodDescriptor(), property);
            if (DEBUG) {
                System.out.println("Unconditional deref: " + xmethod + "=" + property);
View Full Code Here

        LocalVariableTable t = obj.getLocalVariableTable();

        if (t == null) {
            return;
        }
        ParameterProperty property = new ParameterProperty();

        int index = getMethod().isStatic() ? 0 : 1;
        int parameterNumber = 0;
        for (Iterator<String> i = p.parameterSignatureIterator(); i.hasNext();) {
            String s = i.next();
            LocalVariable localVariable = t.getLocalVariable(index, 0);
            if (localVariable != null) {
                String name = localVariable.getName();
                if (s.equals("J") && (name.toLowerCase().indexOf("instant") >= 0 || name.startsWith("date"))) {

                    // System.out.println(getFullyQualifiedMethodName() + " " + s + " " + index + " " + name);
                    property.setParamWithProperty(parameterNumber, true);
                }
            }
            if (s.equals("J") || s.equals("D")) {
                index += 2;
            } else {
                index += 1;
            }
            parameterNumber++;
        }
        if (!property.isEmpty()) {
            // System.out.println(getFullyQualifiedMethodName() + " " + property);
            database.setProperty(getMethodDescriptor(), property);
        }
    }
View Full Code Here

    static class LongInstantParameterDatabase extends MethodPropertyDatabase<ParameterProperty> {
        @Override
        protected ParameterProperty decodeProperty(String propStr) throws PropertyDatabaseFormatException {
            try {
                int longInstants = Integer.parseInt(propStr);
                ParameterProperty prop = new ParameterProperty(longInstants);
                return prop;
            } catch (NumberFormatException e) {
                throw new PropertyDatabaseFormatException("Invalid unconditional deref param set: " + propStr);
            }
        }
View Full Code Here

TOP

Related Classes of edu.umd.cs.findbugs.ba.interproc.ParameterProperty

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.