Package edu.umd.cs.findbugs.log

Examples of edu.umd.cs.findbugs.log.Profiler


    static class CheckCallSitesAndReturnInstructions {
    }

    private void checkCallSitesAndReturnInstructions() {
        Profiler profiler = Global.getAnalysisCache().getProfiler();
        profiler.start(CheckCallSitesAndReturnInstructions.class);
        try {
            ConstantPoolGen cpg = classContext.getConstantPoolGen();
            TypeDataflow typeDataflow = classContext.getTypeDataflow(method);

            for (Iterator<Location> i = classContext.getCFG(method).locationIterator(); i.hasNext();) {
                Location location = i.next();
                Instruction ins = location.getHandle().getInstruction();
                try {
                    ValueNumberFrame vnaFrame = classContext.getValueNumberDataflow(method).getFactAtLocation(location);
                    if (!vnaFrame.isValid()) {
                        continue;
                    }

                    if (ins instanceof InvokeInstruction) {
                        examineCallSite(location, cpg, typeDataflow);
                    } else if (methodAnnotation == NullnessAnnotation.NONNULL && ins.getOpcode() == Constants.ARETURN) {
                        examineReturnInstruction(location);
                    } else if (ins instanceof PUTFIELD) {
                        examinePutfieldInstruction(location, (PUTFIELD) ins, cpg);
                    }
                } catch (ClassNotFoundException e) {
                    bugReporter.reportMissingClass(e);
                }
            }
        } catch (CheckedAnalysisException e) {
            AnalysisContext.logError("error:", e);
        } finally {
            profiler.end(CheckCallSitesAndReturnInstructions.class);
        }
    }
View Full Code Here


        ObligationAnalysis analysis = new ObligationAnalysis(dfs, xmethod, cpg, factory, database, typeDataflow, invDataflow,
                analysisCache.getErrorLogger());
        ObligationDataflow dataflow = new ObligationDataflow(cfg, analysis);

        Profiler profiler = analysisCache.getProfiler();
        profiler.start(analysis.getClass());
        try {
            dataflow.execute();
        } finally {
            profiler.end(analysis.getClass());
        }

        if (DEBUG_PRINTCFG) {
            System.out.println("Dataflow CFG:");
            DataflowCFGPrinter.printCFG(dataflow, System.out);
View Full Code Here

* @author pugh
*/
public class ZipCodeBaseFactory {

    public static AbstractScannableCodeBase makeZipCodeBase(ICodeBaseLocator codeBaseLocator, File file) throws IOException {
        Profiler profiler = Global.getAnalysisCache().getProfiler();
        profiler.start(ZipCodeBaseFactory.class);
        try {
            return new ZipFileCodeBase(codeBaseLocator, file);
        } catch (ZipException e) {
            // May be too many zip entries
            return new ZipInputStreamCodeBase(codeBaseLocator, file);
        } finally {
            profiler.end(ZipCodeBaseFactory.class);
        }
    }
View Full Code Here

            IAnalysisEngine<ClassDescriptor, E> engine = (IAnalysisEngine<ClassDescriptor, E>) classAnalysisEngineMap
                    .get(analysisClass);
            if (engine == null) {
                throw new IllegalArgumentException("No analysis engine registered to produce " + analysisClass.getName());
            }
            Profiler profiler = getProfiler();
            // Perform the analysis
            try {
                profiler.start(engine.getClass());
                analysisResult = engine.analyze(this, classDescriptor);

                // If engine returned null, we need to construct
                // an AbnormalAnalysisResult object to record that fact.
                // Otherwise we will try to recompute the value in
                // the future.
                if (analysisResult == null) {
                    analysisResult = NULL_ANALYSIS_RESULT;
                }
            } catch (CheckedAnalysisException e) {
                // Exception - make note
                // Andrei: e.getStackTrace() cannot be null, but getter clones
                // the stack...
                // if (e.getStackTrace() == null)
                // e.fillInStackTrace();
                analysisResult = new AbnormalAnalysisResult(e);
            } catch (RuntimeException e) {
                // Exception - make note
                // Andrei: e.getStackTrace() cannot be null, but getter clones
                // the stack...
                // if (e.getStackTrace() == null)
                // e.fillInStackTrace();
                analysisResult = new AbnormalAnalysisResult(e);
            } finally {
                profiler.end(engine.getClass());
            }

            // Save the result
            descriptorMap.put(classDescriptor, analysisResult);
        }
View Full Code Here

            throws CheckedAnalysisException {
        IMethodAnalysisEngine<E> engine = (IMethodAnalysisEngine<E>) methodAnalysisEngineMap.get(analysisClass);
        if (engine == null) {
            throw new IllegalArgumentException("No analysis engine registered to produce " + analysisClass.getName());
        }
        Profiler profiler = getProfiler();
        profiler.start(engine.getClass());
        try {
            return engine.analyze(this, methodDescriptor);
        } finally {
            profiler.end(engine.getClass());
        }
    }
View Full Code Here

        this.nonnullTypeQualifierValue = TypeQualifierValue.getValue(javax.annotation.Nonnull.class, null);
    }

    @Override
    public NullnessAnnotation getResolvedAnnotation(Object o, boolean getMinimal) {
        Profiler profiler = Global.getAnalysisCache().getProfiler();
        profiler.start(this.getClass());
        try {

            if (DEBUG) {
                System.out.println("getResolvedAnnotation: o=" + o + "...");
            }

            TypeQualifierAnnotation tqa = null;

            if (o instanceof XMethodParameter) {
                XMethodParameter param = (XMethodParameter) o;

                tqa = TypeQualifierApplications.getEffectiveTypeQualifierAnnotation(param.getMethod(),
                        param.getParameterNumber(), nonnullTypeQualifierValue);
            } else if (o instanceof XMethod || o instanceof XField) {
                tqa = TypeQualifierApplications.getEffectiveTypeQualifierAnnotation((AnnotatedObject) o,
                        nonnullTypeQualifierValue);
            }

            NullnessAnnotation result = toNullnessAnnotation(tqa);
            if (DEBUG) {
                if (result == null) {
                    System.out.println("   ===> not found");
                } else {
                    System.out.println("   ===> " + tqa + "/" + result.toString() );
                }
            }
            return result;
        } finally {
            profiler.end(this.getClass());
        }
    }
View Full Code Here

            profiler.end(this.getClass());
        }
    }

    public @CheckForNull NullnessAnnotation getInheritedAnnotation(XMethod m, int parameter) {
        Profiler profiler = Global.getAnalysisCache().getProfiler();
        profiler.start(this.getClass());
        try {
            TypeQualifierAnnotation tqa
            = TypeQualifierApplications.getInheritedTypeQualifierAnnotation(m,
                    parameter, nonnullTypeQualifierValue);
            NullnessAnnotation result = toNullnessAnnotation(tqa);
            return result;
        } finally {
            profiler.end(this.getClass());
        }
    }
View Full Code Here

        } finally {
            profiler.end(this.getClass());
        }
    }
    public @CheckForNull NullnessAnnotation getInheritedAnnotation(XMethod m) {
        Profiler profiler = Global.getAnalysisCache().getProfiler();
        profiler.start(this.getClass());
        try {
            TypeQualifierAnnotation tqa
            = TypeQualifierApplications.getInheritedTypeQualifierAnnotation(m, nonnullTypeQualifierValue);
            NullnessAnnotation result = toNullnessAnnotation(tqa);
            return result;
        } finally {
            profiler.end(this.getClass());
        }
    }
View Full Code Here

        } finally {
            profiler.end(this.getClass());
        }
    }
    public @CheckForNull NullnessAnnotation getDirectAnnotation(Object o) {
        Profiler profiler = Global.getAnalysisCache().getProfiler();
        profiler.start(this.getClass());
        try {

            if (DEBUG) {
                System.out.println("getDirectAnnotation: o=" + o + "...");
            }

            TypeQualifierAnnotation tqa = null;

            if (o instanceof XMethodParameter) {
                XMethodParameter param = (XMethodParameter) o;
                tqa = TypeQualifierApplications.getDirectTypeQualifierAnnotation(param.getMethod(),
                        param.getParameterNumber(), nonnullTypeQualifierValue);
            } else if (o instanceof XMethod || o instanceof XField) {
                tqa = TypeQualifierApplications.getEffectiveTypeQualifierAnnotation((AnnotatedObject) o,
                        nonnullTypeQualifierValue);
            }

            NullnessAnnotation result = toNullnessAnnotation(tqa);
            if (DEBUG) {
                if (result == null) {
                    System.out.println("   ===> not found");
                } else {
                    System.out.println("   ===> " + tqa + "/" + result.toString() );
                }
            }
            return result;
        } finally {
            profiler.end(this.getClass());
        }
    }
View Full Code Here

    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);
            return When.UNKNOWN;
        } finally {
            profiler.end(validator.getClass());
        }
    }
View Full Code Here

TOP

Related Classes of edu.umd.cs.findbugs.log.Profiler

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.