mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-08 06:39:38 +07:00
try to check annotation target applicability without resolve (IDEA-155612)
This commit is contained in:
@@ -135,6 +135,17 @@ public class AnnotationTargetUtil {
|
||||
|
||||
@Nullable
|
||||
private static TargetType translateTargetRef(@NotNull PsiReference reference) {
|
||||
if (reference instanceof PsiJavaCodeReferenceElement) {
|
||||
String name = ((PsiJavaCodeReferenceElement)reference).getReferenceName();
|
||||
if (name != null) {
|
||||
try {
|
||||
return TargetType.valueOf(name);
|
||||
}
|
||||
catch (IllegalArgumentException ignore) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PsiElement field = reference.resolve();
|
||||
if (field instanceof PsiEnumConstant) {
|
||||
String name = ((PsiEnumConstant)field).getName();
|
||||
|
||||
Reference in New Issue
Block a user