Examples of IAnalysisCache


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

    public boolean isApplicationClass(ClassDescriptor desc) {
        return getSubtypes2().isApplicationClass(desc);
    }

    public int getClassSize(ClassDescriptor desc) {
        IAnalysisCache analysisCache = Global.getAnalysisCache();

        try {
            /* ClassContext classContext =*/ analysisCache.getClassAnalysis(ClassContext.class, desc);
            ClassData classData = analysisCache.getClassAnalysis(ClassData.class, desc);
            return classData.getData().length;

        } catch (RuntimeException e) {
            AnalysisContext.logError("Error getting class data for " + desc, e);
            return 10000;
View Full Code Here

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

            return 10000;
        }
    }

    public boolean isTooBig(ClassDescriptor desc) {
        IAnalysisCache analysisCache = Global.getAnalysisCache();

        try {
            ClassContext classContext = analysisCache.getClassAnalysis(ClassContext.class, desc);
            ClassData classData = analysisCache.getClassAnalysis(ClassData.class, desc);
            if (classData.getData().length > 1000000) {
                return true;
            }
            try {
                JavaClass javaClass = classContext.getJavaClass();
View Full Code Here

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

            defined = new HashSet<String>();

            Subtypes2 subtypes2 = AnalysisContext.currentAnalysisContext().getSubtypes2();
            Collection<XClass> allClasses = subtypes2.getXClassCollection();

            IAnalysisCache analysisCache = Global.getAnalysisCache();

            for (XClass c : allClasses) {
                try {
                    JavaClass jclass = analysisCache.getClassAnalysis(JavaClass.class, c.getClassDescriptor());
                    addAllDefinitions(jclass);
                } catch (MissingClassException e) {
                    bugReporter.reportMissingClass(e.getClassDescriptor());
                } catch (CheckedAnalysisException e) {
                    bugReporter.logError("Could not find class " + c.getClassDescriptor().toDottedClassName(), e);
View Full Code Here

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

        return fromVisitedInstruction(methodDescriptor, location.getHandle().getPosition());
    }

    public static SourceLineAnnotation fromVisitedInstruction(MethodDescriptor methodDescriptor, int position) {
        try {
            IAnalysisCache analysisCache = Global.getAnalysisCache();
            JavaClass jclass = analysisCache.getClassAnalysis(JavaClass.class, methodDescriptor.getClassDescriptor());
            Method method = analysisCache.getMethodAnalysis(Method.class, methodDescriptor);
            return fromVisitedInstruction(jclass, method, position);
        } catch (CheckedAnalysisException e) {
            return createReallyUnknown(methodDescriptor.getClassDescriptor().toDottedClassName());
        }
    }
View Full Code Here

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

        }
        if (m.isStatic() || m.isPrivate() || m.getName().equals("<init>")) {
            return false;
        }
        try {
            IAnalysisCache analysisCache = Global.getAnalysisCache();
            XClass clazz = analysisCache.getClassAnalysis(XClass.class, m.getClassDescriptor());
            if (isCalledDirectlyOrIndirectly(clazz.getSuperclassDescriptor(), m)) {
                return true;
            }
            for (ClassDescriptor i : clazz.getInterfaceDescriptorList()) {
                if (isCalledDirectlyOrIndirectly(i, m)) {
View Full Code Here

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

    private boolean isCalledDirectlyOrIndirectly(@CheckForNull ClassDescriptor clazzDescriptor, XMethod m)
            throws CheckedAnalysisException {
        if (clazzDescriptor == null) {
            return false;
        }
        IAnalysisCache analysisCache = Global.getAnalysisCache();
        XClass clazz = analysisCache.getClassAnalysis(XClass.class, clazzDescriptor);
        XMethod m2 = clazz.findMethod(m.getName(), m.getSignature(), m.isStatic());
        if (m2 != null && isCalled(m2)) {
            return true;
        }
        if (isCalledDirectlyOrIndirectly(clazz.getSuperclassDescriptor(), m)) {
View Full Code Here

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

     *         if the class cannot be found
     */
    public @CheckForNull
    XClass getXClass(ClassDescriptor classDescriptor) {
        try {
            IAnalysisCache analysisCache = Global.getAnalysisCache();
            return analysisCache.getClassAnalysis(XClass.class, classDescriptor);
        } catch (CheckedAnalysisException e) {
            return null;
        }
    }
View Full Code Here

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

     * @return this BugInstance
     */
    @Nonnull
    public BugInstance addSourceLine(MethodDescriptor methodDescriptor, Location location) {
        try {
            IAnalysisCache analysisCache = Global.getAnalysisCache();
            ClassContext classContext = analysisCache.getClassAnalysis(ClassContext.class, methodDescriptor.getClassDescriptor());
            Method method = analysisCache.getMethodAnalysis(Method.class, methodDescriptor);
            return addSourceLine(classContext, method, location);
        } catch (CheckedAnalysisException e) {
            return addSourceLine(SourceLineAnnotation.createReallyUnknown(methodDescriptor.getClassDescriptor()
                    .toDottedClassName()));
        }
View Full Code Here

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

    @Override
    public boolean matches(Type t) {
        if (!(t instanceof ReferenceType)) {
            return false;
        }
        IAnalysisCache analysisCache = Global.getAnalysisCache();
        Subtypes2 subtypes2 = analysisCache.getDatabase(Subtypes2.class);

        try {
            return subtypes2.isSubtype((ReferenceType) t, supertype);
        } catch (ClassNotFoundException e) {
            analysisCache.getErrorLogger().reportMissingClass(e);
            return false;
        }
    }
View Full Code Here

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

        return ARRAY_AND_NON_ARRAY;
    }

    static @Nonnull
    XMethod getInvokedMethod(XClass xClass, String name, String sig, boolean isStatic) throws CheckedAnalysisException {
        IAnalysisCache cache = Global.getAnalysisCache();
        while (true) {
            XMethod result = xClass.findMethod(name, sig, isStatic);
            if (result != null) {
                return result;
            }
            if (isStatic) {
                throw new CheckedAnalysisException();
            }
            ClassDescriptor superclassDescriptor = xClass.getSuperclassDescriptor();
            if (superclassDescriptor == null) {
                throw new CheckedAnalysisException();
            }
            xClass = cache.getClassAnalysis(XClass.class, superclassDescriptor);
        }

    }
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.