Examples of IAnalysisCache


Examples of edu.umd.cs.findbugs.classfile.IAnalysisCache

        }

        AnalysisContext analysisContext = AnalysisContext.currentAnalysisContext();
        Subtypes2 subtypes2 = analysisContext.getSubtypes2();

        IAnalysisCache cache = Global.getAnalysisCache();
        XClass lhs = cache.getClassAnalysis(XClass.class, lhsDescriptor);
        XClass rhs = cache.getClassAnalysis(XClass.class, rhsDescriptor);
        // Look up the classes
        XMethod lhsEquals = getInvokedMethod(lhs, "equals", "(Ljava/lang/Object;)Z", false);
        XMethod rhsEquals = getInvokedMethod(rhs, "equals", "(Ljava/lang/Object;)Z", false);
        String lhsClassName = lhsEquals.getClassName();
        if (lhsEquals.equals(rhsEquals)) {
View Full Code Here

Examples of edu.umd.cs.findbugs.classfile.IAnalysisCache

    public When validate(@CheckForNull Object constantValue) {
        if (validator == null) {
            throw new IllegalStateException("No validator");
        }
        IAnalysisCache analysisCache = Global.getAnalysisCache();
        Profiler profiler = analysisCache.getProfiler();
        profiler.start(validator.getClass());
        try {
            return ValidationSecurityManager.sandboxedValidation(proxy, validator, constantValue);
        } catch (Exception e) {
            AnalysisContext.logError("Error executing custom validator for " + typeQualifier + " " + constantValue, e);
View Full Code Here

Examples of edu.umd.cs.findbugs.classfile.IAnalysisCache

            // on the method and all methods directly called by the method.
            //

            addEffectiveRelevantQualifiers(result, xmethod);

            IAnalysisCache analysisCache = Global.getAnalysisCache();
            ConstantPoolGen cpg = analysisCache.getClassAnalysis(ConstantPoolGen.class, methodDescriptor.getClassDescriptor());
            for (Iterator<Location> i = cfg.locationIterator(); i.hasNext();) {
                Location location = i.next();
                Instruction ins = location.getHandle().getInstruction();
                if (ins instanceof InvokeInstruction) {
                    XMethod called = XFactory.createXMethod((InvokeInstruction) ins, cpg);
View Full Code Here

Examples of edu.umd.cs.findbugs.classfile.IAnalysisCache

    private DataflowResult<DataflowType> compute(TypeQualifierValue<?> typeQualifierValue) {
        DataflowResult<DataflowType> result = new DataflowResult<DataflowType>();

        try {
            IAnalysisCache analysisCache = Global.getAnalysisCache();

            DepthFirstSearch dfs = analysisCache.getMethodAnalysis(DepthFirstSearch.class, methodDescriptor);
            XMethod xmethod = XFactory.createXMethod(methodDescriptor);
            CFG cfg = analysisCache.getMethodAnalysis(CFG.class, methodDescriptor);
            ValueNumberDataflow vnaDataflow = analysisCache.getMethodAnalysis(ValueNumberDataflow.class, methodDescriptor);
            ConstantPoolGen cpg = analysisCache.getClassAnalysis(ConstantPoolGen.class, methodDescriptor.getClassDescriptor());

            DataflowType dataflow = getDataflow(dfs, xmethod, cfg, vnaDataflow, cpg, analysisCache, methodDescriptor,
                    typeQualifierValue);

            result.dataflow = dataflow;

            if (TypeQualifierDatabase.USE_DATABASE) {
                try {
                    populateDatabase(dataflow, vnaDataflow, xmethod, typeQualifierValue);
                } catch (DataflowAnalysisException e) {
                    analysisCache.getErrorLogger().logError("Error populating type qualifier database", e);
                }
            }
        } catch (CheckedAnalysisException e) {
            result.checkedException = e;
        } catch (RuntimeException e) {
View Full Code Here

Examples of edu.umd.cs.findbugs.classfile.IAnalysisCache

    private final ObligationPolicyDatabase database;

    public FindUnsatisfiedObligation(BugReporter bugReporter) {
        this.bugReporter = bugReporter;
        IAnalysisCache analysisCache = Global.getAnalysisCache();

        database = analysisCache.getDatabase(ObligationPolicyDatabase.class);

    }
View Full Code Here

Examples of edu.umd.cs.findbugs.classfile.IAnalysisCache

    }

    @Override
    public void visitClass(ClassDescriptor classDescriptor) throws CheckedAnalysisException {
        IAnalysisCache analysisCache = Global.getAnalysisCache();

        ObligationFactory factory = database.getFactory();

        JavaClass jclass = analysisCache.getClassAnalysis(JavaClass.class, classDescriptor);
        for (Constant c : jclass.getConstantPool().getConstantPool()) {
            if (c instanceof ConstantNameAndType) {
                ConstantNameAndType cnt = (ConstantNameAndType) c;
                String signature = cnt.getSignature(jclass.getConstantPool());
                if (factory.signatureInvolvesObligations(signature)) {
View Full Code Here

Examples of edu.umd.cs.findbugs.classfile.IAnalysisCache

            return;
        }
        if (DEBUG) {
            System.out.println("  Relevant type qualifiers are " + relevantQualifiers);
        }
        IAnalysisCache analysisCache = Global.getAnalysisCache();
        ForwardTypeQualifierDataflowFactory forwardDataflowFactory = analysisCache.getMethodAnalysis(
                ForwardTypeQualifierDataflowFactory.class, methodDescriptor);
        BackwardTypeQualifierDataflowFactory backwardDataflowFactory = analysisCache.getMethodAnalysis(
                BackwardTypeQualifierDataflowFactory.class, methodDescriptor);
        ValueNumberDataflow vnaDataflow = analysisCache.getMethodAnalysis(ValueNumberDataflow.class, methodDescriptor);

        for (TypeQualifierValue<?> typeQualifierValue : relevantQualifiers) {

            try {
                checkQualifier(xMethod, cfg, typeQualifierValue, forwardDataflowFactory, backwardDataflowFactory,
View Full Code Here

Examples of edu.umd.cs.findbugs.classfile.IAnalysisCache

        }
        return c.size();
    }

    private JumpInfo getJumpInfo() {
        IAnalysisCache analysisCache = Global.getAnalysisCache();
        XMethod xMethod = XFactory.createXMethod(v.getThisClass(), v.getMethod());
        if (xMethod instanceof MethodInfo) {
            MethodInfo mi = (MethodInfo) xMethod;
            if (!mi.hasBackBranch()) {
                return null;
            }
        }
        try {
            return analysisCache.getMethodAnalysis(JumpInfo.class, xMethod.getMethodDescriptor());
        } catch (CheckedAnalysisException e) {
            AnalysisContext.logError("Error getting jump information", e);
            return null;
        }
    }
View Full Code Here

Examples of edu.umd.cs.findbugs.classfile.IAnalysisCache

            AnalysisContext.logError("Error getting jump information", e);
            return null;
        }
    }
    private JumpInfoFromStackMap getJumpInfoFromStackMap() {
        IAnalysisCache analysisCache = Global.getAnalysisCache();
        XMethod xMethod = XFactory.createXMethod(v.getThisClass(), v.getMethod());
        if (xMethod instanceof MethodInfo) {
            MethodInfo mi = (MethodInfo) xMethod;
            if (!mi.hasBackBranch()) {
                return null;
            }
        }

        try {
            return analysisCache.getMethodAnalysis(JumpInfoFromStackMap.class, xMethod.getMethodDescriptor());

        } catch (CheckedAnalysisException e) {
            AnalysisContext.logError("Error getting jump information from StackMap", e);
            return null;
        }
View Full Code Here

Examples of edu.umd.cs.findbugs.classfile.IAnalysisCache

     * edu.umd.cs.findbugs.Detector2#visitClass(edu.umd.cs.findbugs.classfile
     * .ClassDescriptor)
     */
    @Override
    public void visitClass(ClassDescriptor classDescriptor) throws CheckedAnalysisException {
        IAnalysisCache analysisCache = Global.getAnalysisCache();

        JavaClass jclass = analysisCache.getClassAnalysis(JavaClass.class, classDescriptor);
        classContext = analysisCache.getClassAnalysis(ClassContext.class, classDescriptor);

        for (Method m : classContext.getMethodsInCallOrder()) {
            if (m.getCode() == null) {
                continue;
            }
            method = m;

            MethodDescriptor methodDescriptor = BCELUtil.getMethodDescriptor(jclass, method);

            // Try to get MethodGen. If we can't get one,
            // then this method should be skipped.
            MethodGen methodGen = analysisCache.getMethodAnalysis(MethodGen.class, methodDescriptor);
            if (methodGen == null) {
                continue;
            }

            CFG cfg = analysisCache.getMethodAnalysis(CFG.class, methodDescriptor);
            visitMethodCFG(methodDescriptor, cfg);
        }
    }
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.