correct check that all constructors are private for "Class with only 'private' constructors should be declared 'final'" inspection

This commit is contained in:
Bas Leijdekkers
2014-09-24 16:04:28 +02:00
parent 198c79845a
commit 5db3adb4f5
2 changed files with 7 additions and 1 deletions
@@ -62,7 +62,7 @@ public class ClassWithOnlyPrivateConstructorsInspectionBase extends BaseInspecti
return;
}
for (PsiMethod constructor : constructors) {
if (constructor.hasModifierProperty(PsiModifier.FINAL)) {
if (!constructor.hasModifierProperty(PsiModifier.PRIVATE)) {
return;
}
}
@@ -49,6 +49,12 @@ public class ClassWithOnlyPrivateConstructorsInspectionTest extends LightInspect
"}");
}
public void testPublicConstructor() {
doTest("class A {" +
" public A() {}" +
"}");
}
@Nullable
@Override
protected InspectionProfileEntry getInspection() {