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


Java ClassData类代码示例

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


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

示例1: analyze

import edu.umd.cs.findbugs.classfile.analysis.ClassData; //导入依赖的package包/类
public ClassNameAndSuperclassInfo analyze(IAnalysisCache analysisCache, ClassDescriptor descriptor)
        throws CheckedAnalysisException {
    // Get InputStream reading from class data
    ClassData classData = analysisCache.getClassAnalysis(ClassData.class, descriptor);
    DataInputStream classDataIn = new DataInputStream(new ByteArrayInputStream(classData.getData()));

    // Read the class info
    ClassParserInterface parser = new ClassParser(classDataIn, descriptor, classData.getCodeBaseEntry());
    ClassNameAndSuperclassInfo.Builder classInfoBuilder = new ClassNameAndSuperclassInfo.Builder();
    parser.parse(classInfoBuilder);
    ClassNameAndSuperclassInfo classInfo = classInfoBuilder.build();

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

示例2: getQualifierClass

import edu.umd.cs.findbugs.classfile.analysis.ClassData; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private static <A> Class<A> getQualifierClass(ClassDescriptor typeQualifier) throws ClassNotFoundException {
    @DottedClassName String className = typeQualifier.getDottedClassName();
    if (DEBUG_CLASSLOADING)
        System.out.println("Getting qualifier class for " + className);
    if (className.startsWith("javax.annotation"))
        return (Class<A>) Class.forName(className);
    try {
        Global.getAnalysisCache().getClassAnalysis(ClassData.class, typeQualifier);
    } catch (CheckedAnalysisException e) {
        throw new ClassNotFoundException("No class data found for " + className);
    }
    
    ValidatorClassLoader validatorLoader = ValidatorClassLoader.INSTANCE;
    return (Class<A>) validatorLoader.loadClass(typeQualifier.getDottedClassName());
}
 
开发者ID:OpenNTF,项目名称:FindBug-for-Domino-Designer,代码行数:17,代码来源:TypeQualifierValue.java

示例3: analyze

import edu.umd.cs.findbugs.classfile.analysis.ClassData; //导入依赖的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

示例4: reuseClassCache

import edu.umd.cs.findbugs.classfile.analysis.ClassData; //导入依赖的package包/类
private void reuseClassCache() {
    SoftReference<Map<ClassDescriptor, Object>> wr = classAnalysisCache.get(project);
    Map<ClassDescriptor, Object> classAnalysis = wr != null? wr.get() : null;
    if(classAnalysis != null) {
        analysisCache.reuseClassAnalysis(ClassData.class, classAnalysis);
        // TODO would be nice to reuse ClassInfoAnalysisEngine: XClass.class,
        // JavaClassAnalysisEngine: JavaClass.class
        // but unfortunately there are side effects for analysis during data generation
        // which we can't have if we would just re-use the data
    }
}
 
开发者ID:OpenNTF,项目名称:FindBug-for-Domino-Designer,代码行数:12,代码来源:FindBugs2Eclipse.java

示例5: registerWith

import edu.umd.cs.findbugs.classfile.analysis.ClassData; //导入依赖的package包/类
public void registerWith(IAnalysisCache analysisCache) {
    analysisCache.registerClassAnalysisEngine(ClassData.class, this);
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:4,代码来源:ClassDataAnalysisEngine.java

示例6: loadClassData

import edu.umd.cs.findbugs.classfile.analysis.ClassData; //导入依赖的package包/类
private byte[] loadClassData(String name) throws CheckedAnalysisException {
    ClassDescriptor d = DescriptorFactory.createClassDescriptorFromDottedClassName(name);
    ClassData data = Global.getAnalysisCache().getClassAnalysis(ClassData.class, d);
    return data.getData();
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:6,代码来源:ValidatorClassLoader.java

示例7: loadClassData

import edu.umd.cs.findbugs.classfile.analysis.ClassData; //导入依赖的package包/类
static byte[] loadClassData(String name) throws CheckedAnalysisException {
    ClassDescriptor d = DescriptorFactory.createClassDescriptorFromDottedClassName(name);
    ClassData data = Global.getAnalysisCache().getClassAnalysis(ClassData.class, d);
    return data.getData();
}
 
开发者ID:OpenNTF,项目名称:FindBug-for-Domino-Designer,代码行数:6,代码来源:TypeQualifierValue.java

示例8: analyze

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

        ClassData classData = analysisCache.getClassAnalysis(ClassData.class, descriptor);

        FBClassReader classReader = new FBClassReader(classData.getData());

        return classReader;
    }
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:9,代码来源:ClassReaderAnalysisEngine.java


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