Java inspection: Improved messages and documentation for the inspection "Lambda parameter type is redundant"

This commit is contained in:
Pavel Dolgov
2016-08-15 20:18:43 +03:00
parent 6fdc29ee24
commit f0eecf562c
3 changed files with 10 additions and 4 deletions
@@ -43,7 +43,7 @@ public class RedundantLambdaParameterTypeInspection extends BaseJavaBatchLocalIn
public void visitParameterList(PsiParameterList parameterList) {
super.visitParameterList(parameterList);
if (isApplicable(parameterList)) {
holder.registerProblem(parameterList, "Remove redundant types", new LambdaParametersFix());
holder.registerProblem(parameterList, "Lambda parameter type is redundant", new LambdaParametersFix());
}
}
};
@@ -140,7 +140,7 @@ public class RedundantLambdaParameterTypeInspection extends BaseJavaBatchLocalIn
@NotNull
@Override
public String getFamilyName() {
return "Remove redundant types";
return "Remove redundant parameter types";
}
@Override
@@ -28,7 +28,7 @@ import java.util.List;
public class RedundantLambdaParameterTypeInspectionTest extends LightCodeInsightFixtureTestCase {
private RedundantLambdaParameterTypeInspection myInspection = new RedundantLambdaParameterTypeInspection();
private String myIntentionName = "Remove redundant types";
private String myIntentionName = "Remove redundant parameter types";
@Override
protected String getBasePath() {
@@ -1,5 +1,11 @@
<html>
<body>
This inspection removes lambda formal parameter types when they can be inferred from context.
This inspection reports lambda formal parameter types which are redundant, because they can be inferred from the context.
<p>The quick fix removes the parameter types from the lambda.
<p>Example: <pre><code>Map&lt;String, Integer&gt; map = ...
map.forEach((String s, Integer i) -> log.info(s + "=" + i));</code></pre>
<p>The code above can be simplified to the following:
<pre><code>Map&lt;String, Integer&gt; map = ...
map.forEach((s, i) -> log.info(s + "=" + i));</code></pre>
</body>
</html>