10
10
import com .intellij .patterns .PsiElementPattern ;
11
11
import com .intellij .util .ProcessingContext ;
12
12
import org .jetbrains .annotations .NotNull ;
13
- import org .jetbrains .kotlin .descriptors .annotations .AnnotationDescriptor ;
14
- import org .jetbrains .kotlin .idea .caches .resolve .ResolutionUtils ;
15
- import org .jetbrains .kotlin .name .FqName ;
16
13
import org .jetbrains .kotlin .psi .KtAnnotationEntry ;
17
- import org .jetbrains .kotlin . resolve . BindingContext ;
18
- import org .jetbrains .kotlin . resolve . lazy . BodyResolveMode ;
14
+ import org .jetbrains .uast . UAnnotation ;
15
+ import org .jetbrains .uast . UastContextKt ;
19
16
20
17
/**
21
18
* @author Filip Hrisafov
@@ -32,20 +29,12 @@ public KtAnnotationEntryPattern qName(ElementPattern<String> pattern) {
32
29
return with ( new PatternCondition <KtAnnotationEntry >( "qName" ) {
33
30
@ Override
34
31
public boolean accepts (@ NotNull KtAnnotationEntry ktAnnotation , ProcessingContext context ) {
35
- AnnotationDescriptor descriptor = ResolutionUtils .analyze (
36
- ktAnnotation ,
37
- BodyResolveMode .PARTIAL_FOR_COMPLETION
38
- ).get ( BindingContext .ANNOTATION , ktAnnotation );
39
-
40
- if ( descriptor == null ) {
41
- return false ;
42
- }
43
-
44
- FqName fqName = descriptor .getFqName ();
45
- if ( fqName == null ) {
32
+ UAnnotation uElement = UastContextKt .toUElement ( ktAnnotation , UAnnotation .class );
33
+ if ( uElement == null ) {
46
34
return false ;
47
35
}
48
- return pattern .accepts ( fqName .asString (), context );
36
+ String name = uElement .getQualifiedName ();
37
+ return pattern .accepts ( name , context );
49
38
}
50
39
} );
51
40
}
0 commit comments