mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-97384 (Replace constructor with factory method inspection shall have an option so can be ignored on abstract classes)
This commit is contained in:
+11
-2
@@ -58,6 +58,11 @@ public class PublicConstructorInspection extends BaseInspection {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean buildQuickFixesOnlyForOnTheFlyErrors() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
protected InspectionGadgetsFix buildFix(Object... infos) {
|
||||
@@ -103,7 +108,11 @@ public class PublicConstructorInspection extends BaseInspection {
|
||||
if (!method.hasModifierProperty(PsiModifier.PUBLIC)) {
|
||||
return;
|
||||
}
|
||||
if (SerializationUtils.isExternalizable(method.getContainingClass())) {
|
||||
final PsiClass aClass = method.getContainingClass();
|
||||
if (aClass == null || aClass.hasModifierProperty(PsiModifier.ABSTRACT)) {
|
||||
return;
|
||||
}
|
||||
if (SerializationUtils.isExternalizable(aClass)) {
|
||||
final PsiParameterList parameterList = method.getParameterList();
|
||||
if (parameterList.getParametersCount() == 0) {
|
||||
return;
|
||||
@@ -118,7 +127,7 @@ public class PublicConstructorInspection extends BaseInspection {
|
||||
if (aClass.isInterface() || aClass.isEnum()) {
|
||||
return;
|
||||
}
|
||||
if (!aClass.hasModifierProperty(PsiModifier.PUBLIC)) {
|
||||
if (!aClass.hasModifierProperty(PsiModifier.PUBLIC) || aClass.hasModifierProperty(PsiModifier.ABSTRACT)) {
|
||||
return;
|
||||
}
|
||||
final PsiMethod[] constructors = aClass.getConstructors();
|
||||
|
||||
+3
@@ -6,4 +6,7 @@ abstract class X implements java.io.Externalizable {
|
||||
}
|
||||
class Y {
|
||||
public Y() {}
|
||||
}
|
||||
abstract class Z {
|
||||
public Z() {}
|
||||
}
|
||||
Reference in New Issue
Block a user