edu.umd.cs.findbugs.classfile.ClassDescriptor Java Examples
The following examples show how to use
edu.umd.cs.findbugs.classfile.ClassDescriptor.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DontIgnoreResultOfPutIfAbsent.java From spotbugs with GNU Lesser General Public License v2.1 | 6 votes |
private boolean extendsConcurrentMap(@DottedClassName String className) { if ("java.util.concurrent.ConcurrentHashMap".equals(className) || className.equals(concurrentMapDescriptor.getDottedClassName())) { return true; } ClassDescriptor c = DescriptorFactory.createClassDescriptorFromDottedClassName(className); Subtypes2 subtypes2 = AnalysisContext.currentAnalysisContext().getSubtypes2(); try { if (subtypes2.isSubtype(c, concurrentMapDescriptor)) { return true; } } catch (ClassNotFoundException e) { AnalysisContext.reportMissingClass(e); } return false; }
Example #2
Source File: Subtypes2.java From spotbugs with GNU Lesser General Public License v2.1 | 6 votes |
/** * Determine whether or not a given ObjectType is a subtype of another. * Throws ClassNotFoundException if the question cannot be answered * definitively due to a missing class. * * @param type * a ReferenceType * @param possibleSupertype * another Reference type * @return true if <code>type</code> is a subtype of * <code>possibleSupertype</code>, false if not * @throws ClassNotFoundException * if a missing class prevents a definitive answer */ public boolean isSubtype(ObjectType type, ObjectType possibleSupertype) throws ClassNotFoundException { if (DEBUG_QUERIES) { System.out.println("isSubtype: check " + type + " subtype of " + possibleSupertype); } if (type.equals(possibleSupertype)) { if (DEBUG_QUERIES) { System.out.println(" ==> yes, types are same"); } return true; } ClassDescriptor typeClassDescriptor = DescriptorFactory.getClassDescriptor(type); ClassDescriptor possibleSuperclassClassDescriptor = DescriptorFactory.getClassDescriptor(possibleSupertype); return isSubtype(typeClassDescriptor, possibleSuperclassClassDescriptor); }
Example #3
Source File: PreorderVisitor.java From spotbugs with GNU Lesser General Public License v2.1 | 6 votes |
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); }
Example #4
Source File: OverriddenMethodsVisitor.java From spotbugs with GNU Lesser General Public License v2.1 | 6 votes |
@Override public boolean visitClass(ClassDescriptor classDescriptor, XClass xclass) { assert xclass != null; String methodSignature = xmethod.getSignature(); XMethod bridgedFrom = xmethod.bridgeFrom(); // See if this class has an overridden method XMethod xm = xclass.findMethod(xmethod.getName(), methodSignature, false); if (xm == null && bridgedFrom != null && !classDescriptor.equals(xmethod.getClassDescriptor())) { methodSignature = bridgedFrom.getSignature(); xm = xclass.findMethod(xmethod.getName(), methodSignature, false); } if (xm != null) { return visitOverriddenMethod(xm) || bridgedFrom != null; } else { // Even though this particular class doesn't contain the method // we're // looking for, a superclass might, so we need to keep going. return true; } }
Example #5
Source File: Subtypes2.java From spotbugs with GNU Lesser General Public License v2.1 | 6 votes |
public static boolean instanceOf(JavaClass subtype, @DottedClassName String dottedSupertype) { if (subtype.getClassName().equals(dottedSupertype) || subtype.getSuperclassName().equals(dottedSupertype)) { return true; } if (Values.DOTTED_JAVA_LANG_OBJECT.equals(subtype.getSuperclassName()) && subtype.getInterfaceIndices().length == 0) { return false; } Subtypes2 subtypes2 = AnalysisContext.currentAnalysisContext().getSubtypes2(); ClassDescriptor subDescriptor = DescriptorFactory.createClassDescriptor(subtype); ClassDescriptor superDescriptor = DescriptorFactory.createClassDescriptorFromDottedClassName(dottedSupertype); try { return subtypes2.isSubtype(subDescriptor, superDescriptor); } catch (ClassNotFoundException e) { AnalysisContext.reportMissingClass(e); return false; } }
Example #6
Source File: CheckRelaxingNullnessAnnotation.java From spotbugs with GNU Lesser General Public License v2.1 | 6 votes |
public XClass next() { while (!interfacesToVisit.isEmpty()) { ClassDescriptor interfaceDescr = interfacesToVisit.poll(); if (visited.add(interfaceDescr)) { XClass xinterface = getClassInfo(interfaceDescr); if (xinterface != null) { interfacesToVisit.addAll(Arrays.asList(xinterface.getInterfaceDescriptorList())); return xinterface; } } } // no interfaces => check super classes if (superclass == null) { return null; } XClass currentSuperclass = superclass; // compute next one superclass = getClassInfo(superclass.getSuperclassDescriptor()); if (superclass != null) { interfacesToVisit = new LinkedList<>(Arrays.asList(superclass.getInterfaceDescriptorList())); } return currentSuperclass; }
Example #7
Source File: Reporter.java From spotbugs with GNU Lesser General Public License v2.1 | 6 votes |
@Override public void observeClass(ClassDescriptor classDescriptor) { String className = classDescriptor.getDottedClassName(); // if (DEBUG) { // System.out.println("Observing class: " + className); //$NON-NLS-1$ // } if (monitor.isCanceled()) { // causes break in FindBugs main loop Thread.currentThread().interrupt(); } int work = (pass * 99) + 1; // Update progress monitor if (pass <= 0) { monitor.setTaskName("Prescanning... (found " + bugCount + ", checking " + className + ")"); } else { monitor.setTaskName("Checking... (pass #" + pass + ") (found " + bugCount + ", checking " + className + ")"); } monitor.worked(work); // printToStream("observeClass: " + className); }
Example #8
Source File: CheckTypeQualifiers.java From spotbugs with GNU Lesser General Public License v2.1 | 6 votes |
@Override public void visitClass(ClassDescriptor classDescriptor) throws CheckedAnalysisException { if (!checked) { checked = true; Collection<TypeQualifierValue<?>> allKnownTypeQualifiers = TypeQualifierValue.getAllKnownTypeQualifiers(); int size = allKnownTypeQualifiers.size(); if (size == 1) { TypeQualifierValue<?> value = Util.first(allKnownTypeQualifiers); if (!value.typeQualifier.getClassName().equals(NONNULL_ANNOTATION)) { shouldRunAnalysis = true; } } else if (size > 1) { shouldRunAnalysis = true; } } if (shouldRunAnalysis) { super.visitClass(classDescriptor); } }
Example #9
Source File: TypeQualifierNullnessAnnotationDatabase.java From spotbugs with GNU Lesser General Public License v2.1 | 6 votes |
@Override public void addMethodAnnotation(String cName, String mName, String sig, boolean isStatic, NullnessAnnotation annotation) { if (DEBUG) { System.out.println("addMethodAnnotation: annotate " + cName + "." + mName + " with " + annotation); } XMethod xmethod = getXMethod(cName, mName, sig, isStatic); if (xmethod == null) { return; } // Get JSR-305 nullness annotation type ClassDescriptor nullnessAnnotationType = getNullnessAnnotationClassDescriptor(annotation); // Create an AnnotationValue AnnotationValue annotationValue = new AnnotationValue(nullnessAnnotationType); // Destructively add the annotation to the MethodInfo object xmethod.addAnnotation(annotationValue); }
Example #10
Source File: AnalysisContext.java From spotbugs with GNU Lesser General Public License v2.1 | 6 votes |
static public void reportMissingClass(ClassDescriptor c) { requireNonNull(c, "argument is null"); if (!analyzingApplicationClass()) { return; } String missing = c.getDottedClassName(); if (missing.length() == 1) { System.out.println(c); } if (skipReportingMissingClass(missing)) { return; } RepositoryLookupFailureCallback lookupFailureCallback = getCurrentLookupFailureCallback(); if (lookupFailureCallback != null) { lookupFailureCallback.reportMissingClass(c); } }
Example #11
Source File: FindBugs2.java From spotbugs with GNU Lesser General Public License v2.1 | 6 votes |
/** * Create the AnalysisContext that will serve as the BCEL-compatibility * layer over the AnalysisCache. * * @param project * The project * @param appClassList * list of ClassDescriptors identifying application classes * @param sourceInfoFileName * name of source info file (null if none) */ public static void createAnalysisContext(Project project, List<ClassDescriptor> appClassList, @CheckForNull String sourceInfoFileName) throws IOException { AnalysisContext analysisContext = new AnalysisContext(project); // Make this the current analysis context AnalysisContext.setCurrentAnalysisContext(analysisContext); // Make the AnalysisCache the backing store for // the BCEL Repository analysisContext.clearRepository(); // If needed, load SourceInfoMap if (sourceInfoFileName != null) { SourceInfoMap sourceInfoMap = analysisContext.getSourceInfoMap(); sourceInfoMap.read(new FileInputStream(sourceInfoFileName)); } }
Example #12
Source File: Hierarchy2.java From spotbugs with GNU Lesser General Public License v2.1 | 6 votes |
public static @CheckForNull XMethod findFirstSuperMethod(XMethod m) { try { @CheckForNull ClassDescriptor c = m.getClassDescriptor(); XClass xc = getXClass(c); c = xc.getSuperclassDescriptor(); while (c != null) { xc = getXClass(c); XMethod xm = xc.findMatchingMethod(m.getMethodDescriptor()); if (xm != null) { return xm; } c = xc.getSuperclassDescriptor(); } } catch (CheckedAnalysisException e) { AnalysisContext.logError("Error finding super methods for " + m, e); } return null; }
Example #13
Source File: WrongMapIterator.java From spotbugs with GNU Lesser General Public License v2.1 | 6 votes |
/** * Determine from the class descriptor for a variable whether that variable * implements java.util.Map. * * @param d * class descriptor for variable we want to check implements Map * @return true iff the descriptor corresponds to an implementor of Map */ private static boolean implementsMap(ClassDescriptor d) { while (d != null) { try { // Do not report this warning for EnumMap: EnumMap.keySet()/get() iteration is as fast as entrySet() iteration if ("java.util.EnumMap".equals(d.getDottedClassName())) { return false; } // True if variable is itself declared as a Map if ("java.util.Map".equals(d.getDottedClassName())) { return true; } XClass classNameAndInfo = Global.getAnalysisCache().getClassAnalysis(XClass.class, d); ClassDescriptor is[] = classNameAndInfo.getInterfaceDescriptorList(); d = classNameAndInfo.getSuperclassDescriptor(); for (ClassDescriptor i : is) { if ("java.util.Map".equals(i.getDottedClassName())) { return true; } } } catch (CheckedAnalysisException e) { d = null; } } return false; }
Example #14
Source File: FindRefComparison.java From spotbugs with GNU Lesser General Public License v2.1 | 6 votes |
private boolean checkForWeirdEquals(String lhsSig, String rhsSig, Set<XMethod> targets) { boolean allOk = false; try { ClassSummary classSummary = AnalysisContext.currentAnalysisContext().getClassSummary(); ClassDescriptor expectedClassDescriptor = DescriptorFactory.createClassDescriptorFromSignature(lhsSig); ClassDescriptor actualClassDescriptor = DescriptorFactory.createClassDescriptorFromSignature(rhsSig); targets.addAll(Hierarchy2.resolveVirtualMethodCallTargets(expectedClassDescriptor, "equals", "(Ljava/lang/Object;)Z", false, false)); allOk = targets.size() > 0; for (XMethod m2 : targets) { if (!classSummary.mightBeEqualTo(m2.getClassDescriptor(), actualClassDescriptor)) { allOk = false; } } } catch (ClassNotFoundException e) { AnalysisContext.reportMissingClass(e); } return allOk; }
Example #15
Source File: FieldSummary.java From spotbugs with GNU Lesser General Public License v2.1 | 6 votes |
public Set<ProgramPoint> getCalledFromSuperConstructor(ClassDescriptor superClass, XMethod calledFromConstructor) { if (!callsOverriddenMethodsFromConstructor.contains(superClass)) { return Collections.emptySet(); } for (Map.Entry<XMethod, Set<ProgramPoint>> e : selfMethodsCalledFromConstructor.entrySet()) { XMethod m = e.getKey(); if (m.getName().equals(calledFromConstructor.getName()) && m.getClassDescriptor().equals(calledFromConstructor.getClassDescriptor())) { String sig1 = m.getSignature(); String sig2 = calledFromConstructor.getSignature(); sig1 = sig1.substring(0, sig1.indexOf(')')); sig2 = sig2.substring(0, sig2.indexOf(')')); if (sig1.equals(sig2)) { return e.getValue(); } } } return Collections.emptySet(); }
Example #16
Source File: XFactory.java From spotbugs with GNU Lesser General Public License v2.1 | 6 votes |
private boolean isCalledDirectlyOrIndirectly(@CheckForNull ClassDescriptor clazzDescriptor, XMethod m) throws CheckedAnalysisException { if (clazzDescriptor == null) { return false; } IAnalysisCache analysisCache = Global.getAnalysisCache(); XClass clazz = analysisCache.getClassAnalysis(XClass.class, clazzDescriptor); XMethod m2 = clazz.findMethod(m.getName(), m.getSignature(), m.isStatic()); if (m2 != null && isCalled(m2)) { return true; } if (isCalledDirectlyOrIndirectly(clazz.getSuperclassDescriptor(), m)) { return true; } for (ClassDescriptor i : clazz.getInterfaceDescriptorList()) { if (isCalledDirectlyOrIndirectly(i, m)) { return true; } } return false; }
Example #17
Source File: Subtypes2.java From spotbugs with GNU Lesser General Public License v2.1 | 6 votes |
private boolean traverseEdge(ClassVertex vertex, @CheckForNull ClassDescriptor supertypeDescriptor, boolean isInterfaceEdge, InheritanceGraphVisitor visitor) { if (supertypeDescriptor == null) { // We reached java.lang.Object return false; } ClassVertex supertypeVertex = classDescriptorToVertexMap.get(supertypeDescriptor); if (supertypeVertex == null) { try { supertypeVertex = resolveClassVertex(supertypeDescriptor); } catch (ClassNotFoundException e) { supertypeVertex = addClassVertexForMissingClass(supertypeDescriptor, isInterfaceEdge); } } assert supertypeVertex != null; return visitor.visitEdge(vertex.getClassDescriptor(), vertex.getXClass(), supertypeDescriptor, supertypeVertex.getXClass()); }
Example #18
Source File: Hierarchy2.java From spotbugs with GNU Lesser General Public License v2.1 | 5 votes |
public static @CheckForNull XMethod findMethod(ClassDescriptor classDescriptor, String methodName, String methodSig, boolean isStatic) { try { return getXClass(classDescriptor).findMethod(methodName, methodSig, isStatic); } catch (CheckedAnalysisException e) { return null; } }
Example #19
Source File: CheckRelaxingNullnessAnnotation.java From spotbugs with GNU Lesser General Public License v2.1 | 5 votes |
@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; } }
Example #20
Source File: Hierarchy2.java From spotbugs with GNU Lesser General Public License v2.1 | 5 votes |
public static @CheckForNull XMethod findInvocationLeastUpperBound(ClassDescriptor classDesc, String methodName, String methodSig, boolean invokeStatic, boolean invokeInterface) { try { return findInvocationLeastUpperBound(getXClass(classDesc), methodName, methodSig, invokeStatic, invokeInterface); } catch (Exception e) { return null; } }
Example #21
Source File: ClassInfoAnalysisEngine.java From spotbugs with GNU Lesser General Public License v2.1 | 5 votes |
@Override 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 (!"package-info".equals(descriptor.getSimpleName())) { 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; }
Example #22
Source File: CheckExpectedWarnings.java From spotbugs with GNU Lesser General Public License v2.1 | 5 votes |
public BugInstance makeWarning(String bugPattern, Object descriptor, int priority, ClassDescriptor cd) { BugInstance bug = new BugInstance(this, bugPattern, priority).addClass(cd); if (descriptor instanceof FieldDescriptor) { bug.addField((FieldDescriptor) descriptor); } else if (descriptor instanceof MethodDescriptor) { bug.addMethod((MethodDescriptor) descriptor); } else if (descriptor instanceof ClassDescriptor) { bug.addClass((ClassDescriptor) descriptor); } if (DEBUG) { System.out.println("Reporting " + bug); } return bug; }
Example #23
Source File: ClassInfo.java From spotbugs with GNU Lesser General Public License v2.1 | 5 votes |
/** * * @param classDescriptor * ClassDescriptor representing the class name * @param superclassDescriptor * ClassDescriptor representing the superclass name * @param interfaceDescriptorList * ClassDescriptors representing implemented interface names * @param codeBaseEntry * codebase entry class was loaded from * @param accessFlags * class's access flags * @param referencedClassDescriptorList * ClassDescriptors of all classes/interfaces referenced by the * class * @param fieldDescriptorList * FieldDescriptors of fields defined in the class * @param methodInfoList * MethodDescriptors of methods defined in the class */ private ClassInfo(ClassDescriptor classDescriptor, String classSourceSignature, ClassDescriptor superclassDescriptor, ClassDescriptor[] interfaceDescriptorList, ICodeBaseEntry codeBaseEntry, int accessFlags, String source, int majorVersion, int minorVersion, Collection<ClassDescriptor> referencedClassDescriptorList, Set<ClassDescriptor> calledClassDescriptors, Map<ClassDescriptor, AnnotationValue> classAnnotations, FieldInfo[] fieldDescriptorList, MethodInfo[] methodInfoList, ClassDescriptor immediateEnclosingClass, boolean usesConcurrency, boolean hasStubs) { super(classDescriptor, superclassDescriptor, interfaceDescriptorList, codeBaseEntry, accessFlags, referencedClassDescriptorList, calledClassDescriptors, majorVersion, minorVersion); this.source = source; this.classSourceSignature = classSourceSignature; if (fieldDescriptorList.length == 0) { fieldDescriptorList = FieldInfo.EMPTY_ARRAY; } this.xFields = fieldDescriptorList; this.xMethods = methodInfoList; this.immediateEnclosingClass = immediateEnclosingClass; this.classAnnotations = Util.immutableMap(classAnnotations); this.usesConcurrency = usesConcurrency; this.hasStubs = hasStubs; this.methodsInCallOrder = computeMethodsInCallOrder(); /* if (false) { System.out.println("Methods in call order for " + classDescriptor); for (MethodInfo m : methodsInCallOrder) { System.out.println(" " + m); } System.out.println(); } */ }
Example #24
Source File: CheckRelaxingNullnessAnnotation.java From spotbugs with GNU Lesser General Public License v2.1 | 5 votes |
@Override public void visitClass(ClassDescriptor classDescriptor) throws CheckedAnalysisException { xclass = getClassInfo(classDescriptor); if (xclass != null) { super.visitClass(classDescriptor); } }
Example #25
Source File: AbstractBugReporter.java From spotbugs with GNU Lesser General Public License v2.1 | 5 votes |
@Override public void reportMissingClass(ClassDescriptor classDescriptor) { LOG.debug("Missing class: {}", classDescriptor, new ClassNotFoundException()); if (verbosityLevel == SILENT) { return; } logMissingClass(classDescriptor.toDottedClassName()); }
Example #26
Source File: Subtypes2.java From spotbugs with GNU Lesser General Public License v2.1 | 5 votes |
/** * Add supertype edge to the InheritanceGraph. * * @param vertex * source ClassVertex (subtype) * @param superclassDescriptor * ClassDescriptor of a direct supertype * @param isInterfaceEdge * true if supertype is (as far as we know) an interface * @param workList * work list of ClassVertexes that need to have their supertype * edges added (null if no further work will be generated) */ private void addInheritanceEdge(ClassVertex vertex, ClassDescriptor superclassDescriptor, boolean isInterfaceEdge, @CheckForNull LinkedList<XClass> workList) { if (superclassDescriptor == null) { return; } ClassVertex superclassVertex = classDescriptorToVertexMap.get(superclassDescriptor); if (superclassVertex == null) { // Haven't encountered this class previously. XClass superclassXClass = AnalysisContext.currentXFactory().getXClass(superclassDescriptor); if (superclassXClass == null) { // Inheritance graph will be incomplete. // Add a dummy node to inheritance graph and report missing // class. superclassVertex = addClassVertexForMissingClass(superclassDescriptor, isInterfaceEdge); } else { // Haven't seen this class before. superclassVertex = ClassVertex.createResolvedClassVertex(superclassDescriptor, superclassXClass); addVertexToGraph(superclassDescriptor, superclassVertex); if (workList != null) { // We'll want to recursively process the superclass. workList.addLast(superclassXClass); } } } assert superclassVertex != null; if (graph.lookupEdge(vertex, superclassVertex) == null) { if (DEBUG) { System.out.println(" Add edge " + vertex.getClassDescriptor().toDottedClassName() + " -> " + superclassDescriptor.toDottedClassName()); } graph.createEdge(vertex, superclassVertex); } }
Example #27
Source File: AnalysisCacheToRepositoryAdapter.java From spotbugs with GNU Lesser General Public License v2.1 | 5 votes |
@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); } }
Example #28
Source File: MethodInfo.java From spotbugs with GNU Lesser General Public License v2.1 | 5 votes |
@Override public @Nullable AnnotationValue getParameterAnnotation(int param, ClassDescriptor desc) { Map<ClassDescriptor, AnnotationValue> map = methodParameterAnnotations.get(param); if (map == null) { return null; } return map.get(desc); }
Example #29
Source File: UnresolvedXMethod.java From spotbugs with GNU Lesser General Public License v2.1 | 5 votes |
@Override public Collection<AnnotationValue> getParameterAnnotations(int param) { Map<ClassDescriptor, AnnotationValue> map = methodParameterAnnotations.get(param); if (map == null) { return Collections.<AnnotationValue>emptySet(); } return map.values(); }
Example #30
Source File: CheckExpectedWarnings.java From spotbugs with GNU Lesser General Public License v2.1 | 5 votes |
private void check(XClass xclass, ClassDescriptor annotation, boolean expectWarnings, int priority) { AnnotationValue expect = xclass.getAnnotation(annotation); if (expect == null) { return; } if (DEBUG) { System.out.println("*** Found " + annotation + " annotation on " + xclass); } ClassDescriptor descriptor = xclass.getClassDescriptor(); Collection<BugInstance> warnings = warningsByClass.get(descriptor); check(expect, descriptor, warnings, expectWarnings, priority, descriptor); }