simplify annotation present check

GitOrigin-RevId: f7b56843330b6b769c859d4f53b8551a7999783f
This commit is contained in:
Anna Kozlova
2019-06-05 11:11:11 +03:00
committed by intellij-monorepo-bot
parent 48fd5c0153
commit 8df0ee7569
@@ -38,7 +38,7 @@ public class TestDataFilesReferencesContributor extends PsiReferenceContributor
if (call == null) return PsiReference.EMPTY_ARRAY;
PsiParameter targetParameter = UastUtils.getParameterForArgument(call, expression);
if (!checkTestDataFileAnnotationPresent(targetParameter)) {
if (targetParameter == null || !targetParameter.hasAnnotation(TEST_DATA_FILE_ANNOTATION_QUALIFIED_NAME)) {
return PsiReference.EMPTY_ARRAY;
}
@@ -61,19 +61,6 @@ public class TestDataFilesReferencesContributor extends PsiReferenceContributor
);
}
private static boolean checkTestDataFileAnnotationPresent(@Nullable PsiParameter targetParameter) {
if (targetParameter == null) {
return false;
}
PsiAnnotation[] annotations = targetParameter.getAnnotations();
for (PsiAnnotation annotation : annotations) {
if (TEST_DATA_FILE_ANNOTATION_QUALIFIED_NAME.equals(annotation.getQualifiedName())) {
return true;
}
}
return false;
}
@Nullable
private static String getTestDataDirectory(@NotNull UExpression expression,
@NotNull UCallExpression methodCallExpression) {