if (JavaResolveUtil.isAccessible(member, member.getContainingClass(), modList, reference, null, null)) {
return;
}
+ int a = 1;
}
reportProblem(reference, member, h);
@Nullable
private static PsiAnnotation findVisibleForTestingAnnotation(@NotNull PsiMember member) {
PsiAnnotation anno = AnnotationUtil.findAnnotation(member, "com.google.common.annotations.VisibleForTesting");
- return anno != null ? anno : AnnotationUtil.findAnnotation(member, "com.android.annotations.VisibleForTesting");
+ if (anno == null) {
+ anno = AnnotationUtil.findAnnotation(member, "com.android.annotations.VisibleForTesting");
+ }
+ if (anno != null) return anno;
+
+ PsiClass containingClass = member.getContainingClass();
+ return containingClass != null ? findVisibleForTestingAnnotation(containingClass) : null;
}
private static boolean isInsideTestOnlyMethod(PsiElement e) {
void relaxedToPackageLevel(int a) {
}
+
+ @com.google.common.annotations.VisibleForTesting
+ static class FooException extends RuntimeException {
+ FooException(String message) {
+ super(message);
+ }
+ }
+
+ public static void usingExceptionPrivately(String[] args) {
+ A.FooException exception =
+ new A.FooException("");
+ }
}
\ No newline at end of file
new A().invisibleMethod(2);
new A().visibleMethod(2);
new A().relaxedToPackageLevel(2);
+ A.FooException exception =
+ new A.FooException("");
}
}
\ No newline at end of file