本文整理汇总了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);
}
示例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;
}
示例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");
}
}
示例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);
}
}
示例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();
}
}
示例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");
}
}
示例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);
}
}
示例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");
}
示例9: parse
import edu.umd.cs.findbugs.classfile.analysis.ClassInfo; //导入依赖的package包/类
public void parse(ClassInfo.Builder builder) throws InvalidClassFileFormatException {
parse((ClassNameAndSuperclassInfo.Builder) builder);
}
示例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;