Package edu.umd.cs.findbugs.ba

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


            short opcode = ins.getOpcode();
            try {
                if (opcode == Constants.INVOKESTATIC) {
                    INVOKESTATIC inv = (INVOKESTATIC) ins;
                    if (Hierarchy.isInnerClassAccess(inv, cpg)) {
                        InnerClassAccess access = Hierarchy.getInnerClassAccess(inv, cpg);
                        /*
                         * if (access == null) {
                         * System.out.println("Missing inner class access in " +
                         * SignatureConverter.convertMethodSignature(methodGen)
                         * + " at " + inv); }
                         */
                        if (access != null) {
                            if (access.isLoad()) {
                                loadedFieldSet.addLoad(handle, access.getField());
                            } else {
                                loadedFieldSet.addStore(handle, access.getField());
                            }
                        }
                    }
                } else if (fieldInstructionOpcodeSet.get(opcode)) {
                    boolean isLoad = (opcode == Constants.GETFIELD || opcode == Constants.GETSTATIC);
View Full Code Here


            }
            if ((argTypes.length == 2) && !argTypes[1].getSignature().equals(Type.getReturnType(methodSig).getSignature())) {
                return;
            }

            InnerClassAccess access = null;
            try {
                String dottedClassConstantOperand = getDottedClassConstantOperand();
                access = AnalysisContext.currentAnalysisContext().getInnerClassAccessMap().getInnerClassAccess(dottedClassConstantOperand, methodName);
                if(access != null) {
                    // if the enclosing class of the field differs from the enclosing class of the method, we shouln't report
                    // because there is nothing wrong: see bug 1226
                    if (!access.getField().getClassName().equals(dottedClassConstantOperand)) {
                        return;
                    }
                    // the access method is created to access the synthetic reference to the enclosing class, we shouln't report
                    // user can't do anything here, see bug 1191
                    if(access.getField().isSynthetic()){
                        return;
                    }
                }
            } catch (ClassNotFoundException e) {
            }

            BugInstance bug = new BugInstance(this, "IMA_INEFFICIENT_MEMBER_ACCESS", LOW_PRIORITY).addClassAndMethod(this)
                    .addSourceLine(this);
            if(access != null) {
                bug.addField(access.getField());
            }
            bugReporter.reportBug(bug);
        }
    }
View Full Code Here

        if (o instanceof XMethod) {
            XMethod m = (XMethod) o;
            if (m.getName().startsWith("access$")) {
                InnerClassAccessMap icam = AnalysisContext.currentAnalysisContext().getInnerClassAccessMap();
                try {
                    InnerClassAccess ica = icam.getInnerClassAccess(m.getClassName(), m.getName());
                    if (ica != null && ica.isLoad()) {
                        o = ica.getField();
                    }
                } catch (ClassNotFoundException e) {
                    AnalysisContext.reportMissingClass(e);
                    return null;
                }
View Full Code Here

                        System.out.println("Handling field access: " + location.getHandle() + " (frame="
                                + vnaDataflow.getFactAtLocation(location) + ") :" + n);
                    }
                } else if (ins instanceof INVOKESTATIC) {
                    INVOKESTATIC inv = (INVOKESTATIC) ins;
                    InnerClassAccess access = icam.getInnerClassAccess(inv, cpg);
                    if (access != null && access.getMethodSignature().equals(inv.getSignature(cpg))) {
                        xfield = access.getField();
                        isWrite = !access.isLoad();
                        isLocal = false;
                        if (DEBUG) {
                            System.out.println("Handling inner class access: " + location.getHandle() + " (frame="
                                    + vnaDataflow.getFactAtLocation(location) + ")");
                        }
View Full Code Here

TOP

Related Classes of edu.umd.cs.findbugs.ba.InnerClassAccess

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.