Change logic of loading "suppress" annotation class descriptor

Instead of loading the descriptor and checking equals(), we now check if the
annotation is in fact "suppress" by simply comparing its FQ name. This allows
us to suppress warnings while compiling built-ins: the problem is that
built-ins have its own "suppress" annotation class (defined in the sources)
which differs from the one loaded by the compiler (from kotlin-compiler.jar)
This commit is contained in:
Alexander Udalov
2014-05-14 22:24:28 +04:00
parent 5488a8402f
commit 5fdb9e6218
3 changed files with 35 additions and 43 deletions
@@ -135,11 +135,10 @@ public class KotlinSuppressIntentionAction(
private fun suppressAnnotationText(id: String) = "[suppress($id)]"
private fun findSuppressAnnotation(annotated: JetAnnotated): JetAnnotationEntry? {
val suppressAnnotationClass = KotlinBuiltIns.getInstance().getSuppressAnnotationClass()
val context = AnalyzerFacadeWithCache.getContextForElement(annotated)
for (entry in annotated.getAnnotationEntries()) {
val annotationDescriptor = context.get(BindingContext.ANNOTATION, entry)
if (annotationDescriptor != null && suppressAnnotationClass.getTypeConstructor() == annotationDescriptor.getType().getConstructor()) {
if (annotationDescriptor != null && KotlinBuiltIns.getInstance().isSuppressAnnotation(annotationDescriptor)) {
return entry
}
}