当前位置: 首页>>代码示例>>Java>>正文


Java ClassInfo类代码示例

本文整理汇总了Java中edu.umd.cs.findbugs.classfile.analysis.ClassInfo的典型用法代码示例。如果您正苦于以下问题:Java ClassInfo类的具体用法?Java ClassInfo怎么用?Java ClassInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ClassInfo类属于edu.umd.cs.findbugs.classfile.analysis包,在下文中一共展示了ClassInfo类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setupVisitorForClass

import edu.umd.cs.findbugs.classfile.analysis.ClassInfo; //导入依赖的package包/类
public void setupVisitorForClass(JavaClass obj) {
    constantPool = obj.getConstantPool();
    thisClass = obj;
    ConstantClass c = (ConstantClass) constantPool.getConstant(obj.getClassNameIndex());
    className = getStringFromIndex(c.getNameIndex());
    dottedClassName = className.replace('/', '.');
    packageName = obj.getPackageName();
    sourceFile = obj.getSourceFileName();
    dottedSuperclassName = obj.getSuperclassName();
    superclassName = dottedSuperclassName.replace('.', '/');

    ClassDescriptor cDesc = DescriptorFactory.createClassDescriptor(className);
    if (!FindBugs.isNoAnalysis())
    try {
        thisClassInfo = (ClassInfo) Global.getAnalysisCache().getClassAnalysis(XClass.class, cDesc);
    } catch (CheckedAnalysisException e) {
        throw new AssertionError("Can't find ClassInfo for " + cDesc);
    }

    super.visitJavaClass(obj);
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:22,代码来源:PreorderVisitor.java

示例2: analyze

import edu.umd.cs.findbugs.classfile.analysis.ClassInfo; //导入依赖的package包/类
public ClassInfo analyze(IAnalysisCache analysisCache, ClassDescriptor descriptor) throws CheckedAnalysisException {

        if (descriptor instanceof ClassInfo)
            return (ClassInfo) descriptor;
        ClassData classData;
        try {
            classData = analysisCache.getClassAnalysis(ClassData.class, descriptor);
        } catch (edu.umd.cs.findbugs.classfile.MissingClassException e) {
            if (!descriptor.getSimpleName().equals("package-info"))
                throw e;

            ClassInfo.Builder builder = new ClassInfo.Builder();
            builder.setClassDescriptor(descriptor);
            builder.setAccessFlags(1536);
            return builder.build();
        }

        // Read the class info

        FBClassReader reader = analysisCache.getClassAnalysis(FBClassReader.class, descriptor);
        ClassParserInterface parser = new ClassParserUsingASM(reader, descriptor, classData.getCodeBaseEntry());

        ClassInfo.Builder classInfoBuilder = new ClassInfo.Builder();
        parser.parse(classInfoBuilder);
        ClassInfo classInfo = classInfoBuilder.build();

        if (!classInfo.getClassDescriptor().equals(descriptor)) {
            throw new ClassNameMismatchException(descriptor, classInfo.getClassDescriptor(), classData.getCodeBaseEntry());
        }
        return classInfo;
    }
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:32,代码来源:ClassInfoAnalysisEngine.java

示例3: setAppClassList

import edu.umd.cs.findbugs.classfile.analysis.ClassInfo; //导入依赖的package包/类
/**
 * Set the collection of class descriptors identifying all application
 * classes.
 *
 * @param appClassCollection
 *            List of ClassDescriptors identifying application classes
 */
public void setAppClassList(List<ClassDescriptor> appClassCollection) {

    // FIXME: we really should drive the progress callback here
    HashSet<ClassDescriptor> appSet = new HashSet<ClassDescriptor>(appClassCollection);

    Collection<ClassDescriptor> allClassDescriptors = new ArrayList<ClassDescriptor>(DescriptorFactory.instance()
            .getAllClassDescriptors());
    for (ClassDescriptor appClass : allClassDescriptors)
        try {
            XClass xclass = currentXFactory().getXClass(appClass);

            if (xclass == null)
                continue;

            // Add the application class to the database
            if (appSet.contains(appClass))
                getSubtypes2().addApplicationClass(xclass);
            else if (xclass instanceof ClassInfo)
                getSubtypes2().addClass(xclass);

        } catch (Exception e) {
            AnalysisContext.logError("Unable to get XClass for " + appClass, e);
        }

    if (true && Subtypes2.DEBUG) {
        System.out.println(getSubtypes2().getGraph().getNumVertices() + " vertices in inheritance graph");
    }
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:36,代码来源:AnalysisCacheToAnalysisContextAdapter.java

示例4: ClassContext

import edu.umd.cs.findbugs.classfile.analysis.ClassInfo; //导入依赖的package包/类
/**
 * Constructor.
 * 
 * @param jclass
 *            the JavaClass
 */
public ClassContext(JavaClass jclass, AnalysisContext analysisContext) {
    this.jclass = jclass;
    this.analysisContext = analysisContext;
    this.methodAnalysisObjectMap = new HashMap<Class<?>, Map<MethodDescriptor, Object>>();
    try {
        classInfo = (ClassInfo) Global.getAnalysisCache().getClassAnalysis(XClass.class,
                DescriptorFactory.createClassDescriptor(jclass));
    } catch (CheckedAnalysisException e) {
        throw new AssertionError("No ClassInfo for " + jclass);
    }
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:18,代码来源:ClassContext.java

示例5: findFullyQualifiedSourceFileName

import edu.umd.cs.findbugs.classfile.analysis.ClassInfo; //导入依赖的package包/类
private String findFullyQualifiedSourceFileName(IClassPath classPath, ClassDescriptor classDesc) throws IOException,
        CheckedAnalysisException {
    try {
        // Open and parse the class file to attempt
        // to discover the source file name.
        ICodeBaseEntry codeBaseEntry = classPath.lookupResource(classDesc.toResourceName());

        ClassParserUsingASM classParser = new ClassParserUsingASM(new ClassReader(codeBaseEntry.openResource()), classDesc,
                codeBaseEntry);

        ClassInfo.Builder classInfoBuilder = new ClassInfo.Builder();
        classParser.parse(classInfoBuilder);
        ClassInfo classInfo = classInfoBuilder.build();

        // Construct the fully-qualified source file name
        // based on the package name and source file name.
        String packageName = classDesc.getPackageName();
        String sourceFile = classInfo.getSource();

        if (!packageName.equals("")) {
            packageName = packageName.replace('.', '/');
            packageName += "/";
        }

        String fullyQualifiedSourceFile = packageName + sourceFile;

        return fullyQualifiedSourceFile;
    } catch (CheckedAnalysisException e) {
        errorLogger.logError("Could scan class " + classDesc.toDottedClassName(), e);
        throw e;
    } finally {
        progress.finishClass();
    }
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:35,代码来源:DiscoverSourceDirectories.java

示例6: setAppClassList

import edu.umd.cs.findbugs.classfile.analysis.ClassInfo; //导入依赖的package包/类
public void setAppClassList(List<ClassDescriptor> appClassCollection) {

        // FIXME: we really should drive the progress callback here
        HashSet<ClassDescriptor> appSet = new HashSet<ClassDescriptor>(appClassCollection);

        Collection<ClassDescriptor> allClassDescriptors = new ArrayList<ClassDescriptor>(DescriptorFactory.instance()
                .getAllClassDescriptors());
        for (ClassDescriptor appClass : allClassDescriptors)
            try {
                XClass xclass = currentXFactory().getXClass(appClass);

                if (xclass == null)
                    continue;

                // Add the application class to the database
                if (appSet.contains(appClass))
                    getSubtypes2().addApplicationClass(xclass);
                else if (xclass instanceof ClassInfo)
                    getSubtypes2().addClass(xclass);

            } catch (Exception e) {
                AnalysisContext.logError("Unable to get XClass for " + appClass, e);
            }

        if (true && Subtypes2.DEBUG) {
            System.out.println(getSubtypes2().getGraph().getNumVertices() + " vertices in inheritance graph");
        }
    }
 
开发者ID:OpenNTF,项目名称:FindBug-for-Domino-Designer,代码行数:29,代码来源:AnalysisContext.java

示例7: ClassContext

import edu.umd.cs.findbugs.classfile.analysis.ClassInfo; //导入依赖的package包/类
/**
 * Constructor.
 *
 * @param jclass
 *            the JavaClass
 */
public ClassContext(JavaClass jclass, AnalysisContext analysisContext) {
    this.jclass = jclass;
    this.analysisContext = analysisContext;
    this.methodAnalysisObjectMap = new HashMap<Class<?>, Map<MethodDescriptor, Object>>();
    try {
        classInfo = (ClassInfo) Global.getAnalysisCache().getClassAnalysis(XClass.class,
                DescriptorFactory.createClassDescriptor(jclass));
    } catch (CheckedAnalysisException e) {
        throw new AssertionError("No ClassInfo for " + jclass);
    }
}
 
开发者ID:OpenNTF,项目名称:FindBug-for-Domino-Designer,代码行数:18,代码来源:ClassContext.java

示例8: parse

import edu.umd.cs.findbugs.classfile.analysis.ClassInfo; //导入依赖的package包/类
public void parse(ClassInfo.Builder builder) throws InvalidClassFileFormatException {
    throw new UnsupportedOperationException("Need to use a ClassParserUsingASM to build ClassInfo");
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:4,代码来源:ClassParser.java

示例9: parse

import edu.umd.cs.findbugs.classfile.analysis.ClassInfo; //导入依赖的package包/类
public void parse(ClassInfo.Builder builder) throws InvalidClassFileFormatException {
    parse((ClassNameAndSuperclassInfo.Builder) builder);

}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:5,代码来源:ClassParserUsingASM.java

示例10: parse

import edu.umd.cs.findbugs.classfile.analysis.ClassInfo; //导入依赖的package包/类
/**
 * Parse the class data into a ClassInfo object containing (some of) the
 * class's symbolic information.
 * 
 * @param classInfo
 *            a ClassInfo object to be filled in with (some of) the class's
 *            symbolic information
 * @throws InvalidClassFileFormatException
 */
public void parse(ClassInfo.Builder classInfo) throws InvalidClassFileFormatException;
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:11,代码来源:ClassParserInterface.java


注:本文中的edu.umd.cs.findbugs.classfile.analysis.ClassInfo类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。