mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
+3
-3
@@ -2519,10 +2519,10 @@
|
||||
key="expand.one.line.lambda2.code.block.name" groupBundle="messages.InspectionsBundle"
|
||||
groupKey="group.names.code.style.issues" enabledByDefault="true" level="INFORMATION"
|
||||
implementationClass="com.siyeh.ig.style.ExpandOneLineLambda2CodeBlockInspection"/>
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="InferLambdaParameterType" bundle="com.siyeh.InspectionGadgetsBundle"
|
||||
key="infer.lambda.parameter.type.name" groupBundle="messages.InspectionsBundle"
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="LambdaParameterTypeCanBeSpecified" bundle="com.siyeh.InspectionGadgetsBundle"
|
||||
key="lambda.parameter.type.can.be.specified.name" groupBundle="messages.InspectionsBundle"
|
||||
groupKey="group.names.code.style.issues" enabledByDefault="true" level="INFORMATION"
|
||||
implementationClass="com.siyeh.ig.style.InferLambdaParameterTypeInspection"/>
|
||||
implementationClass="com.siyeh.ig.style.LambdaParameterTypeCanBeSpecifiedInspection"/>
|
||||
<localInspection groupPath="Java" language="JAVA" shortName="DiamondCanBeReplacedWithExplicitTypeArguments" bundle="com.siyeh.InspectionGadgetsBundle"
|
||||
key="diamond.can.be.replaced.with.explicit.type.arguments.name" groupBundle="messages.InspectionsBundle"
|
||||
groupKey="group.names.code.style.issues" enabledByDefault="true" level="INFORMATION"
|
||||
|
||||
+4
-2
@@ -2159,8 +2159,10 @@ object.instantiation.inside.equals.or.hashcode.problem.descriptor=Object instant
|
||||
expand.one.line.lambda2.code.block.name=Expand lambda expression body to code block
|
||||
expand.one.line.lambda2.code.block.descriptor=Expand lambda expression body to {...}
|
||||
expand.one.line.lambda2.code.block.quickfix=Expand lambda expression body to {...}
|
||||
infer.lambda.parameter.type.name=Infer lambda parameter type
|
||||
infer.lambda.parameter.type.descriptor=Expand lambda to {0} -> '{'...'}'
|
||||
lambda.parameter.type.can.be.specified.name=Lambda parameter type can be specified
|
||||
lambda.parameter.type.can.be.specified.descriptor=Lambda can be expanded to {0} -> '{'...'}'
|
||||
lambda.parameter.type.can.be.specified.quickfix=Expand lambda to {0} -> '{'...'}'
|
||||
lambda.parameter.type.can.be.specified.family.quickfix=Specify lambda parameter type
|
||||
diamond.can.be.replaced.with.explicit.type.arguments.name=Diamond can be replaced with explicit type arguments
|
||||
diamond.can.be.replaced.with.explicit.type.arguments.quickfix=Replace '<>' with explicit type arguments
|
||||
lambda.can.be.replaced.with.anonymous.name=Lambda can be replaced with anonymous class
|
||||
|
||||
+7
-7
@@ -30,20 +30,20 @@ import org.jetbrains.annotations.Nls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class InferLambdaParameterTypeInspection extends BaseInspection {
|
||||
private static final Logger LOG = Logger.getInstance("#" + InferLambdaParameterTypeInspection.class.getName());
|
||||
public class LambdaParameterTypeCanBeSpecifiedInspection extends BaseInspection {
|
||||
private static final Logger LOG = Logger.getInstance("#" + LambdaParameterTypeCanBeSpecifiedInspection.class.getName());
|
||||
|
||||
@Nls
|
||||
@NotNull
|
||||
@Override
|
||||
public String getDisplayName() {
|
||||
return InspectionGadgetsBundle.message("infer.lambda.parameter.type.name");
|
||||
return InspectionGadgetsBundle.message("lambda.parameter.type.can.be.specified.name");
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
protected String buildErrorString(Object... infos) {
|
||||
return InspectionGadgetsBundle.message("infer.lambda.parameter.type.descriptor", infos);
|
||||
return InspectionGadgetsBundle.message("lambda.parameter.type.can.be.specified.descriptor", infos);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -126,21 +126,21 @@ public class InferLambdaParameterTypeInspection extends BaseInspection {
|
||||
@NotNull
|
||||
@Override
|
||||
public String getName() {
|
||||
return InspectionGadgetsBundle.message("infer.lambda.parameter.type.descriptor", myInfos);
|
||||
return InspectionGadgetsBundle.message("lambda.parameter.type.can.be.specified.quickfix", myInfos);
|
||||
}
|
||||
|
||||
@Nls
|
||||
@NotNull
|
||||
@Override
|
||||
public String getFamilyName() {
|
||||
return InspectionGadgetsBundle.message("infer.lambda.parameter.type.name");
|
||||
return InspectionGadgetsBundle.message("lambda.parameter.type.can.be.specified.family.quickfix");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doFix(Project project, ProblemDescriptor descriptor) {
|
||||
final PsiElement element = descriptor.getPsiElement();
|
||||
if (element instanceof PsiLambdaExpression) {
|
||||
InferLambdaParameterTypeInspection.doFix(project, (PsiLambdaExpression)element);
|
||||
LambdaParameterTypeCanBeSpecifiedInspection.doFix(project, (PsiLambdaExpression)element);
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -3,8 +3,8 @@
|
||||
This inspection reports instantiation of generic classes where <b><></b> (diamond) is used instead of type parameters.
|
||||
<p>The quick fix replaces the <b><></b> (diamond) with the explicit type parameters.
|
||||
<p>Example of use of the diamond:
|
||||
<pre><code>List String> list = new ArrayList<>()</code></pre>
|
||||
<pre><code>List <String> list = new ArrayList<>()</code></pre>
|
||||
<p>The statement above is replaced with the following:
|
||||
<pre><code>List String> list = new ArrayList<String>()</code></pre>
|
||||
<pre><code>List <String> list = new ArrayList<String>()</code></pre>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,5 +0,0 @@
|
||||
<html>
|
||||
<body>
|
||||
This inspection extends lambda parameters to contain formal types
|
||||
</body>
|
||||
</html>
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
<html>
|
||||
<body>
|
||||
This inspection reports lambda parameters which don't have their type specified, e.g. <code>a -> a + 1</code>
|
||||
<p>The quick fix adds type declaration to the lambda parameters, the result looks like this:
|
||||
<code>(int a) -> a + 1</code>
|
||||
</body>
|
||||
</html>
|
||||
+3
-3
@@ -16,13 +16,13 @@
|
||||
package com.siyeh.ig.fixes.style;
|
||||
|
||||
import com.siyeh.ig.IGQuickFixesTestCase;
|
||||
import com.siyeh.ig.style.InferLambdaParameterTypeInspection;
|
||||
import com.siyeh.ig.style.LambdaParameterTypeCanBeSpecifiedInspection;
|
||||
|
||||
public class InferLambdaParameterTypeFixTest extends IGQuickFixesTestCase {
|
||||
public class LambdaParameterTypeCanBeSpecifiedFixTest extends IGQuickFixesTestCase {
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
myFixture.enableInspections(new InferLambdaParameterTypeInspection());
|
||||
myFixture.enableInspections(new LambdaParameterTypeCanBeSpecifiedInspection());
|
||||
}
|
||||
|
||||
public void testSimple() {
|
||||
Reference in New Issue
Block a user