Package edu.umd.cs.findbugs.ba

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


    /**
     * Check whether or not the various interprocedural databases we can use
     * exist and are nonempty.
     */
    private void checkDatabases() {
        AnalysisContext analysisContext = AnalysisContext.currentAnalysisContext();
        unconditionalDerefParamDatabase = analysisContext.getUnconditionalDerefParamDatabase();
    }
View Full Code Here


    final UnreadFieldsData unreadFields;

    final BugReporter bugReporter;

    public ExplicitSerialization(BugReporter bugReporter) {
        AnalysisContext context = AnalysisContext.currentAnalysisContext();
        unreadFields = context.getUnreadFieldsData();
        this.bugReporter = bugReporter;
    }
View Full Code Here

    @Override
    public SourceLineAnnotation getSourceLines() {
        if (sourceLines == null) {
            // Create source line annotation for field on demand
            AnalysisContext currentAnalysisContext = AnalysisContext.currentAnalysisContext();
            if (currentAnalysisContext == null) {
                sourceLines = new SourceLineAnnotation(className, sourceFileName, -1, -1, -1, -1);
            } else {
                SourceInfoMap.SourceLineRange fieldLine = currentAnalysisContext.getSourceInfoMap().getFieldLine(className,
                        fieldName);
                if (fieldLine == null) {
                    sourceLines = new SourceLineAnnotation(className, sourceFileName, -1, -1, -1, -1);
                } else {
                    sourceLines = new SourceLineAnnotation(className, sourceFileName, fieldLine.getStart(), fieldLine.getEnd(),
View Full Code Here

            AnalysisContext.currentAnalysisContext().analysisSkippedDueToInvokeDynamic(xmethod);
            return null;
        }

        try {
            AnalysisContext analysisContext = AnalysisContext.currentAnalysisContext();
            JavaClass jclass = getJavaClass(analysisCache, descriptor.getClassDescriptor());
            ConstantPoolGen cpg = getConstantPoolGen(analysisCache, descriptor.getClassDescriptor());

            String methodName = method.getName();
            int codeLength = method.getCode().getLength();
            String superclassName = jclass.getSuperclassName();
            if (codeLength > 6000 && methodName.equals("<clinit>") && superclassName.equals("java.lang.Enum")) {
                analysisContext.getLookupFailureCallback().reportSkippedAnalysis(
                        new JavaClassAndMethod(jclass, method).toMethodDescriptor());
                return null;
            }
            if (analysisContext.getBoolProperty(AnalysisFeatures.SKIP_HUGE_METHODS)) {
                if (codeLength > 6000 || (methodName.equals("<clinit>") || methodName.equals("getContents")) && codeLength > 2000) {
                    analysisContext.getLookupFailureCallback().reportSkippedAnalysis(
                            new JavaClassAndMethod(jclass, method).toMethodDescriptor());
                    return null;
                }
            }
View Full Code Here

        boolean hasStubs;

        @Override
        public ClassInfo build() {
            AnalysisContext context = AnalysisContext.currentAnalysisContext();
            FieldInfo fields[];
            MethodInfo methods[];
            if (fieldInfoList.size() == 0) {
                fields = FieldInfo.EMPTY_ARRAY;
            } else {
                fields = fieldInfoList.toArray(new FieldInfo[fieldInfoList.size()]);
            }

            for (Map.Entry<MethodInfo, String> e : bridgedSignatures.entrySet()) {
                MethodInfo method = e.getKey();
                String signature = e.getValue();
                for (MethodInfo m : methodInfoList) {
                    if (m.getName().equals(method.getName()) && m.getSignature().equals(signature)) {
                        context.setBridgeMethod(method, m);

                    }
                }

            }
View Full Code Here

    protected PackageMemberAnnotation(@DottedClassName String className, String description) {
        this(className, description, computeSourceFile(className));
    }

    private static String computeSourceFile(String className) {
        AnalysisContext context = AnalysisContext.currentAnalysisContext();

        if (context != null) {
            return context.lookupSourceFile(className);
        }
        return SourceLineAnnotation.UNKNOWN_SOURCE_FILE;

    }
View Full Code Here

public class FieldItemSummary extends OpcodeStackDetector implements NonReportingDetector {

    FieldSummary fieldSummary = new FieldSummary();

    public FieldItemSummary(BugReporter bugReporter) {
        AnalysisContext context = AnalysisContext.currentAnalysisContext();
        context.setFieldSummary(fieldSummary);
    }
View Full Code Here

        super.visit(code); // make callbacks to sawOpcode for all opcodes
        bugAccumulator.reportAccumulatedBugs();
    }

    private boolean isExplicitlyNullable() {
        AnalysisContext analysisContext = AnalysisContext.currentAnalysisContext();
        INullnessAnnotationDatabase nullnessAnnotationDatabase = analysisContext.getNullnessAnnotationDatabase();
        XMethod xMethod = getXMethod();
        NullnessAnnotation na = nullnessAnnotationDatabase.getResolvedAnnotation(xMethod, true);
        return na != null && na != NullnessAnnotation.NONNULL;
    }
View Full Code Here

     * @param sourceInfoFileName
     *            name of source info file (null if none)
     */
    public static void createAnalysisContext(Project project, List<ClassDescriptor> appClassList,
            @CheckForNull String sourceInfoFileName) throws  IOException {
        AnalysisContext analysisContext = new AnalysisContext(project);

        // Make this the current analysis context
        AnalysisContext.setCurrentAnalysisContext(analysisContext);

        // Make the AnalysisCache the backing store for
        // the BCEL Repository
        analysisContext.clearRepository();

        // If needed, load SourceInfoMap
        if (sourceInfoFileName != null) {
            SourceInfoMap sourceInfoMap = analysisContext.getSourceInfoMap();
            sourceInfoMap.read(new FileInputStream(sourceInfoFileName));
        }
    }
View Full Code Here

            sourceInfoMap.read(new FileInputStream(sourceInfoFileName));
        }
    }

    public static void setAppClassList(List<ClassDescriptor> appClassList)  {
        AnalysisContext analysisContext = AnalysisContext
                .currentAnalysisContext();

        analysisContext.setAppClassList(appClassList);
    }
View Full Code Here

TOP

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

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.