don't provide potentially unsafe fixes in batch mode (IDEA-167496)

This commit is contained in:
Anna.Kozlova
2017-02-01 19:12:26 +01:00
parent 3c88c8a2cf
commit 2c3b5544bc
@@ -95,8 +95,14 @@ public class LambdaCanBeMethodReferenceInspection extends BaseJavaBatchLocalInsp
? ((PsiNewExpression)methodRefCandidate).getQualifier()
: null;
boolean safeQualifier = checkQualifier(qualifier);
ProblemHighlightType errorOrWarning = safeQualifier ? ProblemHighlightType.GENERIC_ERROR_OR_WARNING
: ProblemHighlightType.INFORMATION;
ProblemHighlightType errorOrWarning;
if (safeQualifier) {
errorOrWarning = ProblemHighlightType.GENERIC_ERROR_OR_WARNING;
}
else {
if (!isOnTheFly) return;
errorOrWarning = ProblemHighlightType.INFORMATION;
}
holder.registerProblem(InspectionProjectProfileManager.isInformationLevel(getShortName(), expression) ? expression : candidate,
"Can be replaced with method reference",
errorOrWarning, new ReplaceWithMethodRefFix(safeQualifier ? "" : " (may change semantics)"));