diff --git a/java.hints/test/unit/src/org/netbeans/modules/java/hints/suggestions/Bundle_test.properties b/java.hints/test/unit/src/org/netbeans/modules/java/hints/suggestions/Bundle_test.properties index e774716f970f..8f12d2f9e256 100644 --- a/java.hints/test/unit/src/org/netbeans/modules/java/hints/suggestions/Bundle_test.properties +++ b/java.hints/test/unit/src/org/netbeans/modules/java/hints/suggestions/Bundle_test.properties @@ -45,3 +45,5 @@ ERR_splitIfCondition=ERR_splitIfCondition HINT_ConvertIfToSwitch=HINT_ConvertIfToSwitch FIX_ConvertIfsToSwitch=FIX_ConvertIfsToSwitch + +ERR_ConvertVarLambdaParameters=ERR_ConvertVarLambdaParameters diff --git a/java.hints/test/unit/src/org/netbeans/modules/java/hints/suggestions/LambdaTest.java b/java.hints/test/unit/src/org/netbeans/modules/java/hints/suggestions/LambdaTest.java index 19e277e2a560..53c3f27788c0 100644 --- a/java.hints/test/unit/src/org/netbeans/modules/java/hints/suggestions/LambdaTest.java +++ b/java.hints/test/unit/src/org/netbeans/modules/java/hints/suggestions/LambdaTest.java @@ -552,7 +552,6 @@ public void testExplicitParameterTypes() throws Exception { "}\n"); } - //Todo: Verification is pending on nb-javac of JDK11 @Test public void testImplicitVarParameterTypes1() throws Exception { HintTest.create() @@ -560,7 +559,7 @@ public void testImplicitVarParameterTypes1() throws Exception { .input("package test;\n" + "import java.util.function.IntBinaryOperator;\n" + "public class Test {\n" + - " public void main(String list) {\n" + + " public void main(String[] args) {\n" + " IntBinaryOperator calc3 = (int x, int y)^ -> x + y;\n" + " }\n" + "}\n") @@ -572,13 +571,12 @@ public void testImplicitVarParameterTypes1() throws Exception { .assertVerbatimOutput("package test;\n" + "import java.util.function.IntBinaryOperator;\n" + "public class Test {\n" + - " public void main(List list) {\n" + + " public void main(String[] args) {\n" + " IntBinaryOperator calc3 = (var x, var y) -> x + y;\n" + " }\n" + "}\n"); } - //Todo: Verification is pending on nb-javac of JDK11 @Test public void testImplicitVarParameterTypes2() throws Exception { HintTest.create() @@ -586,24 +584,40 @@ public void testImplicitVarParameterTypes2() throws Exception { .input("package test;\n" + "import java.util.function.IntBinaryOperator;\n" + "public class Test {\n" + - " public void main(String list) {\n" + + " public void main(String[] args) {\n" + " IntBinaryOperator calc3 = (x, y)^ -> x + y;\n" + " }\n" + "}\n") .sourceLevel("1.11") .run(Lambda.class) - .findWarning("4:48-4:48:verifier:ERR_ConvertVarLambdaParameters") + .findWarning("4:40-4:40:verifier:ERR_ConvertVarLambdaParameters") .applyFix() .assertCompilable() .assertVerbatimOutput("package test;\n" + "import java.util.function.IntBinaryOperator;\n" + "public class Test {\n" + - " public void main(List list) {\n" + + " public void main(String[] args) {\n" + " IntBinaryOperator calc3 = (var x, var y) -> x + y;\n" + " }\n" + "}\n"); } + @Test + public void testImplicitVarParameterTypes3() throws Exception { + HintTest.create() + .setCaretMarker('^') + .input("package test;\n" + + "import java.util.function.IntBinaryOperator;\n" + + "public class Test {\n" + + " public void main(String[] args) {\n" + + " IntBinaryOperator calc3 = (var x, var y)^ -> x + y;\n" + + " }\n" + + "}\n") + .sourceLevel("1.11") + .run(Lambda.class) + .assertNotContainsWarnings("ERR_ConvertVarLambdaParameters"); + } + static { JavacParser.DISABLE_SOURCE_LEVEL_DOWNGRADE = true; }