enum constants visibility (IDEADEV-22700)

This commit is contained in:
Anna Kozlova
2007-10-18 16:53:39 +04:00
parent b1c1528793
commit 0f9bd48e4a
4 changed files with 20 additions and 0 deletions
@@ -132,6 +132,8 @@ public class VisibilityInspection extends GlobalInspectionTool {
//ignore implicit constructors. User should not be able to see them.
if (refElement instanceof RefImplicitConstructor) return null;
if (refElement instanceof RefField && ((RefField)refElement).getElement() instanceof PsiEnumConstant) return null;
//ignore library override methods.
if (refElement instanceof RefMethod) {
RefMethod refMethod = (RefMethod) refElement;
@@ -74,4 +74,11 @@ public class VisibilityInspectionTest extends InspectionTestCase {
myTool.SUGGEST_PRIVATE_FOR_INNERS = false;
doTest("visibility/implicitConstructor", myTool, false, true);
}
public void testEnumConstants() throws Exception {
myTool.SUGGEST_PACKAGE_LOCAL_FOR_MEMBERS = true;
myTool.SUGGEST_PACKAGE_LOCAL_FOR_TOP_CLASSES = true;
myTool.SUGGEST_PRIVATE_FOR_INNERS = false;
doTest("visibility/enumConstantsVisibility", myTool, false, true);
}
}
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<problems>
</problems>
@@ -0,0 +1,7 @@
public enum Foo {
BAR, UNUSED;
public static void main(String[] args){
System.out.println(BAR);
}
}