本文整理了Java中edu.umd.cs.findbugs.classfile.Global.getAnalysisCache()
方法的一些代码示例,展示了Global.getAnalysisCache()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Global.getAnalysisCache()
方法的具体详情如下:
包路径:edu.umd.cs.findbugs.classfile.Global
类名称:Global
方法名:getAnalysisCache
[英]Get the analysis cache for the current thread.
[中]获取当前线程的分析缓存。
代码示例来源:origin: spotbugs/spotbugs
public XClass getXClass() throws CheckedAnalysisException {
return Global.getAnalysisCache().getClassAnalysis(XClass.class, this);
}
/**
代码示例来源:origin: spotbugs/spotbugs
/**
* @return Returns the referencedXClass.
*/
private XClass getReferencedXClass() {
if (referencedXClass == null && referencedClass != null) {
try {
referencedXClass = Global.getAnalysisCache().getClassAnalysis(XClass.class, referencedClass);
} catch (CheckedAnalysisException e) {
assert true;
}
}
return referencedXClass;
}
}
代码示例来源:origin: spotbugs/spotbugs
public static XClass getXClass(ClassDescriptor c) throws CheckedAnalysisException {
return Global.getAnalysisCache().getClassAnalysis(XClass.class, c);
}
代码示例来源:origin: spotbugs/spotbugs
static XClass getXClass(ClassDescriptor c) throws CheckedAnalysisException {
return Global.getAnalysisCache().getClassAnalysis(XClass.class, c);
}
代码示例来源:origin: spotbugs/spotbugs
/**
* Get the XClass object providing information about the class named by the
* given ClassDescriptor.
*
* @param classDescriptor
* a ClassDescriptor
* @return an XClass object providing information about the class, or null
* if the class cannot be found
*/
public @CheckForNull
XClass getXClass(ClassDescriptor classDescriptor) {
try {
IAnalysisCache analysisCache = Global.getAnalysisCache();
return analysisCache.getClassAnalysis(XClass.class, classDescriptor);
} catch (CheckedAnalysisException e) {
return null;
}
}
代码示例来源:origin: spotbugs/spotbugs
@Override
public @CheckForNull
AnnotatedObject getContainingScope() {
try {
return Global.getAnalysisCache().getClassAnalysis(XClass.class, getClassDescriptor());
} catch (CheckedAnalysisException e) {
return null;
}
}
代码示例来源:origin: spotbugs/spotbugs
@Override
public @CheckForNull
AnnotatedObject getContainingScope() {
try {
return Global.getAnalysisCache().getClassAnalysis(XClass.class, getClassDescriptor());
} catch (CheckedAnalysisException e) {
return null;
}
}
代码示例来源:origin: spotbugs/spotbugs
@Override
public void visitClass(ClassDescriptor classDescriptor) throws CheckedAnalysisException {
FBClassReader cr = Global.getAnalysisCache().getClassAnalysis(FBClassReader.class, classDescriptor);
this.interfaces = new ArrayList<>();
this.innerClasses = new ArrayList<>();
this.fields = new ArrayList<>();
this.methods = new ArrayList<>();
cr.accept(this, 0);
}
代码示例来源:origin: spotbugs/spotbugs
@CheckForNull
XClass getClassInfo(ClassDescriptor classDescr){
if(classDescr == null){
return null;
}
try {
return Global.getAnalysisCache().getClassAnalysis(XClass.class, classDescr);
} catch (CheckedAnalysisException e) {
bugReporter.reportMissingClass(classDescr);
return null;
}
}
代码示例来源:origin: spotbugs/spotbugs
@Override
public @CheckForNull
AnnotatedObject getContainingScope() {
try {
return Global.getAnalysisCache().getClassAnalysis(XClass.class, getClassDescriptor());
} catch (CheckedAnalysisException e) {
return null;
}
}
}
代码示例来源:origin: spotbugs/spotbugs
private <Analysis> Analysis getClassAnalysis(Class<Analysis> analysisClass) throws CheckedAnalysisException {
ClassDescriptor classDescriptor = BCELUtil.getClassDescriptor(jclass);
return Global.getAnalysisCache().getClassAnalysis(analysisClass, classDescriptor);
}
代码示例来源:origin: spotbugs/spotbugs
/**
* Constructor.
*
* @param jclass
* the JavaClass
*/
public ClassContext(JavaClass jclass, AnalysisContext analysisContext) {
this.jclass = jclass;
this.analysisContext = analysisContext;
this.methodAnalysisObjectMap = new HashMap<>();
try {
classInfo = (ClassInfo) Global.getAnalysisCache().getClassAnalysis(XClass.class,
DescriptorFactory.createClassDescriptor(jclass));
} catch (CheckedAnalysisException e) {
throw new AssertionError("No ClassInfo for " + jclass);
}
}
代码示例来源:origin: spotbugs/spotbugs
static byte[] loadClassData(String name) throws CheckedAnalysisException {
ClassDescriptor d = DescriptorFactory.createClassDescriptorFromDottedClassName(name);
ClassData data = Global.getAnalysisCache().getClassAnalysis(ClassData.class, d);
return data.getData();
}
static class Data {
代码示例来源:origin: spotbugs/spotbugs
public @CheckForNull
AnnotatedObject getContainingScope0() {
try {
if (immediateEnclosingClass != null) {
return Global.getAnalysisCache().getClassAnalysis(XClass.class, getImmediateEnclosingClass());
}
if (getClassName().endsWith("package-info")) {
return null;
}
ClassDescriptor p = DescriptorFactory.createClassDescriptor(getSlashedPackageName() + "/" + "package-info");
return Global.getAnalysisCache().getClassAnalysis(XClass.class, p);
} catch (CheckedAnalysisException e) {
return null;
}
}
代码示例来源:origin: spotbugs/spotbugs
@Override
public JavaClass loadClass(String className) throws ClassNotFoundException {
if (className.length() == 0) {
throw new IllegalArgumentException("Request to load empty class");
}
className = ClassName.toSlashedClassName(className);
ClassDescriptor classDescriptor = DescriptorFactory.instance().getClassDescriptor(className);
try {
return Global.getAnalysisCache().getClassAnalysis(JavaClass.class, classDescriptor);
} catch (CheckedAnalysisException e) {
throw new ClassNotFoundException("Exception while looking for class " + className, e);
}
}
代码示例来源:origin: spotbugs/spotbugs
public static XClass getXClass(@SlashedClassName String className) throws CheckedAnalysisException {
return Global.getAnalysisCache().getClassAnalysis(XClass.class, DescriptorFactory.createClassDescriptor(className));
}
代码示例来源:origin: spotbugs/spotbugs
public boolean callsOverriddenMethodsFromSuperConstructor(ClassDescriptor c) {
try {
while (true) {
XClass cx = Global.getAnalysisCache().getClassAnalysis(XClass.class, c);
c = cx.getSuperclassDescriptor();
if (c == null) {
return false;
}
if (callsOverriddenMethodsFromConstructor(c)) {
return true;
}
}
} catch (CheckedAnalysisException e) {
return false;
}
}
代码示例来源:origin: spotbugs/spotbugs
public int getClassSize(ClassDescriptor desc) {
IAnalysisCache analysisCache = Global.getAnalysisCache();
try {
/* ClassContext classContext =*/ analysisCache.getClassAnalysis(ClassContext.class, desc);
ClassData classData = analysisCache.getClassAnalysis(ClassData.class, desc);
return classData.getData().length;
} catch (RuntimeException e) {
AnalysisContext.logError("Error getting class data for " + desc, e);
return 10000;
} catch (CheckedAnalysisException e) {
AnalysisContext.logError("Could not get class context for " + desc, e);
return 10000;
}
}
代码示例来源:origin: spotbugs/spotbugs
/**
* Determine whether the class descriptor ultimately inherits from
* java.lang.Exception
*
* @param d
* class descriptor we want to check
* @return true iff the descriptor ultimately inherits from Exception
*/
private static boolean mightInheritFromException(ClassDescriptor d) {
while (d != null) {
try {
if ("java.lang.Exception".equals(d.getDottedClassName())) {
return true;
}
XClass classNameAndInfo = Global.getAnalysisCache().getClassAnalysis(XClass.class, d);
d = classNameAndInfo.getSuperclassDescriptor();
} catch (CheckedAnalysisException e) {
return true; // don't know
}
}
return false;
}
代码示例来源:origin: spotbugs/spotbugs
@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());
}
内容来源于网络,如有侵权,请联系作者删除!