mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
enum constants visibility (IDEADEV-22700)
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user