extract parameter object: warn if existing class doesn't contain compatible constructor though method calls to modify are found

This commit is contained in:
Anna.Kozlova
2016-04-19 19:05:54 +02:00
parent e00394804a
commit cb339bf590
@@ -279,6 +279,7 @@ public class JavaIntroduceParameterObjectDelegate
}
if (moveDestination != null) {
boolean constructorMiss = false;
for (UsageInfo info : infos) {
if (info instanceof IntroduceParameterObjectProcessor.ChangeSignatureUsageWrapper) {
final UsageInfo usageInfo = ((IntroduceParameterObjectProcessor.ChangeSignatureUsageWrapper)info).getInfo();
@@ -289,6 +290,10 @@ public class JavaIntroduceParameterObjectDelegate
conflicts.putValue(overridingMethod, "Created class won't be accessible");
}
}
if (!constructorMiss && classDescriptor.isUseExistingClass() && usageInfo instanceof MethodCallUsageInfo && classDescriptor.getExistingClassCompatibleConstructor() == null) {
conflicts.putValue(classDescriptor.getExistingClass(), "Existing class misses compatible constructor");
constructorMiss = true;
}
}
}
}