Examples of XField


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

    private boolean doForwardSubstitution() {
        if (!REDUNDANT_LOAD_ELIMINATION) {
            return false;
        }

        XField xfield = loadedFieldSet.getField(handle);
        if (xfield == null) {
            return false;
        }

        if (!xfield.isReferenceType()) {
            return false;
        }

        // Don't do forward substitution for fields that
        // are never read.
View Full Code Here

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

        pushOutputValues(outputValueList);
    }

    @Override
    public void visitGETFIELD(GETFIELD obj) {
        XField xfield = Hierarchy.findXField(obj, getCPG());
        if (xfield != null) {
            if (xfield.isVolatile()) {
                getFrame().killAllLoads();
            }

            if (doRedundantLoadElimination()) {
                loadInstanceField(xfield, obj);
View Full Code Here

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

    }

    @Override
    public void visitPUTFIELD(PUTFIELD obj) {
        if (doForwardSubstitution()) {
            XField xfield = Hierarchy.findXField(obj, getCPG());
            if (xfield != null) {
                storeInstanceField(xfield, obj, false);
                return;
            }
View Full Code Here

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

            ValueNumber value = factory.getClassObjectValue(className);
            frame.pushValue(value);
            return;
        }

        XField xfield = Hierarchy.findXField(obj, getCPG());
        if (xfield != null) {
            if (xfield.isVolatile()) {
                getFrame().killAllLoads();
            }
            if (doRedundantLoadElimination()) {
                loadStaticField(xfield, obj);
                return;
View Full Code Here

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

    @Override
    public void visitPUTSTATIC(PUTSTATIC obj) {
        if (doForwardSubstitution()) {

            XField xfield = Hierarchy.findXField(obj, getCPG());
            if (xfield != null) {
                storeStaticField(xfield, obj, false);
                return;
            }
View Full Code Here

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

                } catch (DataflowAnalysisException e) {
                    throw new InvalidBytecodeException("stack underflow", methodGen, handle, e);
                }
            } else if (Hierarchy.isInnerClassAccess(obj, cpg)) {
                // Possible access of field via an inner-class access method
                XField xfield = loadedFieldSet.getField(handle);
                if (xfield != null) {
                    if (loadedFieldSet.instructionIsLoad(handle)) {
                        // Load via inner-class accessor
                        if (doRedundantLoadElimination()) {
                            if (xfield.isStatic()) {
                                loadStaticField(xfield, obj);
                            } else {
                                loadInstanceField(xfield, obj);
                            }
                            return;
                        }
                    } else {
                        // Store via inner-class accessor
                        if (doForwardSubstitution()) {
                            // Some inner class access store methods
                            // return the value stored.
                            boolean pushValue = !methodSig.endsWith(")V");

                            if (xfield.isStatic()) {
                                storeStaticField(xfield, obj, pushValue);
                            } else {
                                storeInstanceField(xfield, obj, pushValue);
                            }
View Full Code Here

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

        return null;
    }

    public static FieldAnnotation findFieldAnnotationFromValueNumber(Method method, Location location, ValueNumber valueNumber,
            ValueNumberFrame vnaFrame) {
        XField field = ValueNumberSourceInfo.findXFieldFromValueNumber(method, location, valueNumber, vnaFrame);
        if (field == null) {
            return null;
        }
        return FieldAnnotation.fromXField(field);
    }
View Full Code Here

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

        for (Map.Entry<String, SortedSet<String>> e : map.entrySet()) {
            Set<String> occursIn = e.getValue();
            if (occursIn.size() == 1) {
                continue;
            }
            XField field = definition.get(e.getKey());
            if (field == null) {
                continue;
            }
            Integer length = stringSize.get(e.getKey());
            int overhead = length * (occursIn.size() - 1);
            if (overhead < 3 * SIZE_OF_HUGE_CONSTANT) {
                continue;
            }
            String className = field.getClassName();

            BugInstance bug = new BugInstance(this, "HSC_HUGE_SHARED_STRING_CONSTANT",
                    overhead > 20 * SIZE_OF_HUGE_CONSTANT ? HIGH_PRIORITY
                            : (overhead > 8 * SIZE_OF_HUGE_CONSTANT ? NORMAL_PRIORITY : LOW_PRIORITY)).addClass(className)
                            .addField(field).addInt(length).addInt(occursIn.size()).describe(IntAnnotation.INT_OCCURRENCES);
View Full Code Here

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

            System.out.println("  isJSPClass: " + isJSPClass);
        }
        if (isSerializable && !sawReadObject && !sawReadResolve && seenTransientField && !superClassHasReadObject) {
            for (Map.Entry<XField, Integer> e : transientFieldsUpdates.entrySet()) {

                XField fieldX = e.getKey();
                int priority = NORMAL_PRIORITY;
                if (transientFieldsSetInConstructor.contains(e.getKey())) {
                    priority--;
                }

                if (isGUIClass) {
                    priority++;
                }
                if (isEjbImplClass) {
                    priority++;
                }
                if (isJSPClass) {
                    priority++;
                }
                if (e.getValue() < 3) {
                    priority++;
                }
                if (transientFieldsSetToDefaultValueInConstructor.contains(e.getKey())) {
                    priority++;
                }
                if (obj.isAbstract()) {
                    priority++;
                    if (priority < Priorities.LOW_PRIORITY) {
                        priority = Priorities.LOW_PRIORITY;
                    }
                }

                try {
                    double isSerializable = DeepSubtypeAnalysis.isDeepSerializable(fieldX.getSignature());
                    if (isSerializable < 0.6) {
                        priority++;
                    }
                } catch (ClassNotFoundException e1) {
                    // ignore it
View Full Code Here

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

    }

    @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) {
                                XField f = fieldsThatMightBeAProblem.get(nameOfField);

                                String sig = f.getSignature();
                                // System.out.println("Field signature: " +
                                // sig);
                                // System.out.println("Class stored: " +
                                // classStored.getClassName());
                                String genSig = "L" + classStored.getClassName().replace('.', '/') + ";";
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.