當前位置: 首頁>>代碼示例>>Java>>正文


Java ClassNameMismatchException類代碼示例

本文整理匯總了Java中edu.umd.cs.findbugs.classfile.ClassNameMismatchException的典型用法代碼示例。如果您正苦於以下問題:Java ClassNameMismatchException類的具體用法?Java ClassNameMismatchException怎麽用?Java ClassNameMismatchException使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ClassNameMismatchException類屬於edu.umd.cs.findbugs.classfile包,在下文中一共展示了ClassNameMismatchException類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: analyze

import edu.umd.cs.findbugs.classfile.ClassNameMismatchException; //導入依賴的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: analyze

import edu.umd.cs.findbugs.classfile.ClassNameMismatchException; //導入依賴的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


注:本文中的edu.umd.cs.findbugs.classfile.ClassNameMismatchException類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。