Examples of XField


Examples of edu.umd.cs.findbugs.ba.XField

                    bugType = "NP_TOSTRING_COULD_RETURN_NULL";
                    priority = NORMAL_PRIORITY;
                }

            } else {
                XField f = pu.getNonNullField();
                if (f != null) {
                    storedField = FieldAnnotation.fromXField(f);
                    bugType = "NP_STORE_INTO_NONNULL_FIELD";
                } else {
                    XMethodParameter mp = pu.getNonNullParameter();
View Full Code Here

Examples of edu.umd.cs.findbugs.ba.XField

            nullValueStored = getFrame().getTopValue();
        } catch (DataflowAnalysisException e1) {
            AnalysisContext.logError("Oops", e1);
        }
        super.visitPUTFIELD(obj);
        XField field = XFactory.createXField(obj, cpg);
        if (nullValueStored != null && ValueNumberAnalysisFeatures.REDUNDANT_LOAD_ELIMINATION) {
            try {
                ValueNumberFrame vnaFrameBefore = vnaDataflow.getFactAtLocation(getLocation());
                ValueNumber refValue = vnaFrameBefore.getStackValue(1);
                AvailableLoad load = new AvailableLoad(refValue, field);
View Full Code Here

Examples of edu.umd.cs.findbugs.ba.XField

        if (checkForKnownValue(obj)) {
            return;
        }

        XField field = XFactory.createXField(obj, cpg);

        NullnessAnnotation annotation = AnalysisContext.currentAnalysisContext().getNullnessAnnotationDatabase()
                .getResolvedAnnotation(field, false);
        if (annotation == NullnessAnnotation.NONNULL) {
            modelNormalInstruction(obj, getNumWordsConsumed(obj), 0);
View Full Code Here

Examples of edu.umd.cs.findbugs.ba.XField

        }

        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")
                || field.getClassName().equals("org.apache.log4j.Level")
                && (field.getName().equals("ERROR") || field.getName().equals("FATAL"))) {
            getFrame().toExceptionValues();
        }

        if (field.getName().startsWith("class$")) {
            produce(IsNullValue.nonNullValue());
            return;
        }
        NullnessAnnotation annotation = AnalysisContext.currentAnalysisContext().getNullnessAnnotationDatabase()
                .getResolvedAnnotation(field, false);
View Full Code Here

Examples of edu.umd.cs.findbugs.ba.XField

     */
    @Override
    public void sawOpcode(int seen) {

        if (seen == GETSTATIC) {
            XField f = getXFieldOperand();
            if (pendingBugs.containsKey(f)) {
                if (!isLocked()) {
                    reporter.reportBug(pendingBugs.remove(f));

                }

            }
        }
        // we are only interested in method calls
        if (seen != INVOKEVIRTUAL) {
            return;
        }

        try {
            @SlashedClassName String className = getClassConstantOperand();

            if (className.startsWith("[")) {
                // Ignore array classes
                return;
            }
            ClassDescriptor cDesc = DescriptorFactory.createClassDescriptor(className);

            // if it is not compatible with Calendar or DateFormat, we are not
            // interested anymore
            boolean isCalendar = subtypes2.isSubtype(cDesc, calendarType);
            boolean isDateFormat = subtypes2.isSubtype(cDesc, dateFormatType);
            if (!isCalendar && !isDateFormat) {
                return;
            }

            // determine the number of arguments the method expects
            int numArguments = getNumberArguments(getSigConstantOperand());
            // go back on the stack to find what the receiver of the method is
            OpcodeStack.Item invokedOn = stack.getStackItem(numArguments);
            XField field = invokedOn.getXField();
            // find out, if the field is static. if not, we are not interested
            // anymore
            if (field == null || !field.isStatic()) {
                return;
            }

            if (getMethodName().equals("<clinit>") && field.getClassName().equals(getDottedClassName())) {
                return;
            }
            String invokedName = getNameConstantOperand();
            if (invokedName.startsWith("get")) {
                return;
            }
            if (invokedName.equals("equals") && numArguments == 1) {
                OpcodeStack.Item passedAsArgument = stack.getStackItem(0);
                field = passedAsArgument.getXField();
                if (field == null || !field.isStatic()) {
                    return;
                }
            }

            if (!SystemProperties.getBoolean(PROP_SKIP_SYNCHRONIZED_CHECK)) {
View Full Code Here

Examples of edu.umd.cs.findbugs.ba.XField

     *            TODO
     */
    public IsNullValue markInformationAsComingFromReturnValueOfMethod(XMethod methodInvoked) {
        FieldDescriptor fieldDescriptor = methodInvoked.getAccessMethodForField();
        if (fieldDescriptor != null) {
            XField f = XFactory.getExactXField(fieldDescriptor);
            return markInformationAsComingFromFieldValue(f);
        }

        int flag = RETURN_VAL;
        if (methodInvoked.getName().equals("readLine") && methodInvoked.getSignature().equals("()Ljava/lang/String;")) {
View Full Code Here

Examples of edu.umd.cs.findbugs.ba.XField

                                PointerUsageRequiringNonNullValue.getReturnFromNonNullMethod(thisMethod));
                    }

                } else if (ins instanceof PUTFIELD || ins instanceof PUTSTATIC) {
                    FieldInstruction inf = (FieldInstruction) ins;
                    XField field = XFactory.createXField(inf, cpg);
                    NullnessAnnotation annotation = AnalysisContext.currentAnalysisContext().getNullnessAnnotationDatabase()
                            .getResolvedAnnotation(field, false);
                    if (annotation == NullnessAnnotation.NONNULL) {
                        ValueNumber valueNumber = valueNumberFrame.getTopValue();
                        if (valueNumberForThis != valueNumber) {
View Full Code Here

Examples of edu.umd.cs.findbugs.ba.XField

                            }
                        }
                    }
                } else if (fieldInstructionOpcodeSet.get(opcode)) {
                    boolean isLoad = (opcode == Constants.GETFIELD || opcode == Constants.GETSTATIC);
                    XField field = Hierarchy.findXField((FieldInstruction) ins, cpg);
                    if (field != null) {
                        if (isLoad) {
                            loadedFieldSet.addLoad(handle, field);
                        } else {
                            loadedFieldSet.addStore(handle, field);
View Full Code Here

Examples of edu.umd.cs.findbugs.ba.XField

    }

    @Override
    public void visit(Field obj) {
        super.visit(obj);
        XField f = XFactory.createXField(this);
        if (checkForInitialization(f) && !f.isSynthetic()) {
            if (f.isStatic()) {
                nonnullStaticFields.add(f);
            } else {
                nonnullFields.add(f);
            }
        }
View Full Code Here

Examples of edu.umd.cs.findbugs.ba.XField

            if (getMethod().isStatic()) {
                return;
            }
            OpcodeStack.Item left = stack.getStackItem(1);
            if (left.isInitialParameter() && left.getRegisterNumber() == 0 && isSelfOperation()) {
                XField f = getXFieldOperand();
                if (f == null) {
                    break;
                }
                if (checkForInitialization(f)) {
                    initializedFields.add(f);
                }
            }
            break;
        case Constants.PUTSTATIC:
            if (!getMethod().isStatic()) {
                break;
            }

            if (isSelfOperation()) {
                XField f = getXFieldOperand();
                if (f == null) {
                    break;
                }

                if (checkForInitialization(f)) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.