mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IG: make "Empty class" inspection warn on empty enums also
This commit is contained in:
+1
@@ -890,6 +890,7 @@ switch.statement.with.confusing.declaration.problem.descriptor=Local variable <c
|
||||
raw.use.of.parameterized.type.problem.descriptor=Raw use of parameterized class <code>#ref</code> #loc
|
||||
final.class.problem.descriptor=Class declared <code>#ref</code> #loc
|
||||
empty.class.problem.descriptor=Class <code>#ref</code> is empty #loc
|
||||
empty.enum.problem.descriptor=Enum <code>#ref</code> is empty #loc
|
||||
empty.class.file.without.class.problem.descriptor=Java file does not declare any class #loc
|
||||
empty.anonymous.class.problem.descriptor=Anonymous class is empty #loc
|
||||
anonymous.inner.class.problem.descriptor=Anonymous inner class <code>#ref</code> #loc
|
||||
|
||||
+5
-3
@@ -47,7 +47,9 @@ public class EmptyClassInspectionBase extends BaseInspection {
|
||||
return InspectionGadgetsBundle.message("empty.anonymous.class.problem.descriptor");
|
||||
}
|
||||
else if (element instanceof PsiClass) {
|
||||
return InspectionGadgetsBundle.message("empty.class.problem.descriptor");
|
||||
return ((PsiClass)element).isEnum() ?
|
||||
InspectionGadgetsBundle.message("empty.enum.problem.descriptor"):
|
||||
InspectionGadgetsBundle.message("empty.class.problem.descriptor");
|
||||
}
|
||||
else {
|
||||
return InspectionGadgetsBundle.message("empty.class.file.without.class.problem.descriptor");
|
||||
@@ -94,10 +96,10 @@ public class EmptyClassInspectionBase extends BaseInspection {
|
||||
if (FileTypeUtils.isInServerPageFile(aClass.getContainingFile())) {
|
||||
return;
|
||||
}
|
||||
if (aClass.isInterface() || aClass.isEnum() || aClass.isAnnotationType()) {
|
||||
if (aClass.isInterface() || aClass.isAnnotationType()) {
|
||||
return;
|
||||
}
|
||||
if (!aClass.hasModifierProperty(PsiModifier.ABSTRACT)) {
|
||||
if (!aClass.hasModifierProperty(PsiModifier.ABSTRACT) && !aClass.isEnum()) {
|
||||
for (PsiClass superClass : aClass.getSupers()) {
|
||||
if (superClass.isInterface() || superClass.hasModifierProperty(PsiModifier.ABSTRACT)) {
|
||||
return;
|
||||
|
||||
+2
-1
@@ -19,4 +19,5 @@ interface Interface {
|
||||
}
|
||||
}
|
||||
class EmptyClassTest implements Interface {
|
||||
}
|
||||
}
|
||||
enum <warning descr="Enum 'EmptyEnum' is empty">EmptyEnum</warning> {}
|
||||
Reference in New Issue
Block a user