Examples of IAnalysisCache


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

     *
     * @throws IOException
     *             if error occurs registering analysis engines in a plugin
     */
    protected IAnalysisCache createAnalysisCache() throws IOException {
        IAnalysisCache analysisCache = ClassFactory.instance().createAnalysisCache(classPath, bugReporter);

        // Register the "built-in" analysis engines
        registerBuiltInAnalysisEngines(analysisCache);

        // Register analysis engines in plugins
        registerPluginAnalysisEngines(detectorFactoryCollection, analysisCache);

        // Install the DetectorFactoryCollection as a database
        analysisCache.eagerlyPutDatabase(DetectorFactoryCollection.class, detectorFactoryCollection);

        Global.setAnalysisCacheForCurrentThread(analysisCache);
        return analysisCache;
    }
View Full Code Here

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

    public CallListDataflow getCallListDataflow(Method method) throws CFGBuilderException, DataflowAnalysisException {
        return getMethodAnalysis(CallListDataflow.class, method);
    }

    public BitSet linesMentionedMultipleTimes(Method method) {
        IAnalysisCache analysisCache = Global.getAnalysisCache();
        XMethod xMethod = XFactory.createXMethod(jclass, method);
        JumpInfo jumpInfo = null;
        try {
            jumpInfo = analysisCache.getMethodAnalysis(JumpInfo.class, xMethod.getMethodDescriptor());
        } catch (CheckedAnalysisException e) {
            AnalysisContext.logError("Error getting jump information", e);
        }
        BitSet lineMentionedMultipleTimes = new BitSet();
        BitSet pcInFinallyBlock = new BitSet();
View Full Code Here

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

     * edu.umd.cs.findbugs.classfile.IClassFactory#createAnalysisCache(edu.umd
     * .cs.findbugs.classfile.IClassPath)
     */
    @Override
    public IAnalysisCache createAnalysisCache(IClassPath classPath, BugReporter errorLogger) {
        IAnalysisCache analysisCache = new AnalysisCache(classPath, errorLogger);
        return analysisCache;
    }
View Full Code Here

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

     *            the method to build a CFG for
     */
    public BetterCFGBuilder2(@Nonnull MethodDescriptor descriptor, @Nonnull MethodGen methodGen) {
        this.methodGen = methodGen;
        this.cpg = methodGen.getConstantPool();
        IAnalysisCache analysisCache = Global.getAnalysisCache();
        StandardTypeMerger merger = null;
        ExceptionSetFactory exceptionSetFactory;
        try {
            exceptionSetFactory = analysisCache.getMethodAnalysis(ExceptionSetFactory.class, descriptor);
            merger = new StandardTypeMerger( AnalysisContext.currentAnalysisContext()
                    .getLookupFailureCallback(), exceptionSetFactory);
        } catch (CheckedAnalysisException e) {
            AnalysisContext.logError("Unable to generate exceptionSetFactory for " + descriptor, e);
        }
View Full Code Here

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

            }
            boolean didInCallOrder = false;

            if (visitMethodsInCallOrder) {
                try {
                    IAnalysisCache analysisCache = Global.getAnalysisCache();

                    ClassDescriptor c = DescriptorFactory.createClassDescriptor(obj);

                    ClassContext classContext = analysisCache.getClassAnalysis(ClassContext.class, c);
                    didInCallOrder = true;
                    for (Method m : classContext.getMethodsInCallOrder()) {
                        doVisitMethod(m);
                    }
View Full Code Here

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

    public void visitClass(ClassDescriptor classDescriptor) throws CheckedAnalysisException {

        // Just get the ClassContext from the analysis cache
        // and apply the detector to it.

        IAnalysisCache analysisCache = Global.getAnalysisCache();
        ClassContext classContext = analysisCache.getClassAnalysis(ClassContext.class, classDescriptor);
        Profiler profiler = analysisCache.getProfiler();
        profiler.start(detector.getClass());
        try {
            detector.visitClassContext(classContext);
        } finally {
            profiler.end(detector.getClass());
View Full Code Here

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

        if (dataflowClass == null) {
            return;
        }

        IAnalysisCache analysisCache = Global.getAnalysisCache();

        XClass classInfo = analysisCache.getClassAnalysis(XClass.class, classDescriptor);

        // Test dataflow analysis on each method]
        for (XMethod xMethod : classInfo.getXMethods()) {
            if (methodName != null && !methodName.equals(xMethod.getName())) {
                continue;
            }
            MethodDescriptor methodDescriptor = xMethod.getMethodDescriptor();

            System.out.println("-----------------------------------------------------------------");
            System.out.println("Method: " + SignatureConverter.convertMethodSignature(methodDescriptor));
            System.out.println("-----------------------------------------------------------------");

            // Create and execute the dataflow analysis
            Dataflow<Fact,AnalysisType> dataflow = analysisCache.getMethodAnalysis(dataflowClass, methodDescriptor);

            System.out.println("Dataflow finished after " + dataflow.getNumIterations());

            if (SystemProperties.getBoolean("dataflow.printcfg")) {
                DataflowCFGPrinter<Fact,AnalysisType> cfgPrinter
View Full Code Here

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

    }

    private void initialize()  {
        initialized = true;

        IAnalysisCache analysisCache = Global.getAnalysisCache();

        Class<? extends Dataflow<Fact,AnalysisType>> cls = null;

        // First, try loading the dataflow class from the general findBugs code.
        try {
            Class<?> c = getClass().getClassLoader().loadClass(dataflowClassName);
            cls = asDataflowClass(c);

        } catch (ClassNotFoundException e) {
            assert true;
        }

        if (cls == null) {
            // Find the dataflow class from the plugin in which it was loaded

            DetectorFactoryCollection detectorFactoryCollection = analysisCache.getDatabase(DetectorFactoryCollection.class);
            for (Iterator<Plugin> i = detectorFactoryCollection.pluginIterator(); i.hasNext();) {
                Plugin plugin = i.next();

                try {
                    cls = asDataflowClass(plugin.getClassLoader().loadClass(dataflowClassName));
                    break;
                } catch (ClassNotFoundException e) {
                    assert true;
                }

            }
        }

        if (cls == null) {
            analysisCache.getErrorLogger().logError("TestDataflowAnalysis: could not load class " + dataflowClassName);
            return;
        }


        dataflowClass = cls;
View Full Code Here

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

        reporter = bugReporter;
    }

    @Override
    protected IAnalysisCache createAnalysisCache() throws IOException {
        IAnalysisCache cache = super.createAnalysisCache();
        if(cache instanceof AnalysisCache) {
            analysisCache = (AnalysisCache)cache;
            if(cacheClassData) {
                reuseClassCache();
            }
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.