rtaneja1 commented on a change in pull request #596: [NETBEANS-860] Hints: 
Convert Lambda to Use 'var' Parameter Types
URL: https://github.com/apache/incubator-netbeans/pull/596#discussion_r202610746
 
 

 ##########
 File path: 
java.hints/src/org/netbeans/modules/java/hints/suggestions/Lambda.java
 ##########
 @@ -238,6 +243,36 @@ public static ErrorDescription 
explicitParameterTypes(HintContext ctx) {
         return ErrorDescriptionFactory.forName(ctx, ctx.getPath(), 
Bundle.ERR_addExplicitLambdaParameters(), new 
AddExplicitLambdaParameterTypes(ctx.getInfo(), ctx.getPath()).toEditorFix());
     }
     
+    @Hint(displayName = "#DN_addVarLambdaParameters", description = 
"#DESC_addVarLambdaParameters", category = "suggestions", hintKind = 
Hint.Kind.ACTION, minSourceVersion = "11")
+    @Messages({
+        "DN_addVarLambdaParameters=Convert Lambda to Var Parameter Types",
+        "DESC_addVarLambdaParameters=Converts lambdas to var parameter types",
+        "ERR_addVarLambdaParameters=",
+        "FIX_addVarLambdaParameters=Use var parameter types"
+    })
+    @TriggerTreeKind(Kind.LAMBDA_EXPRESSION)
+    public static ErrorDescription implicitVarParameterTypes(HintContext ctx) {
+        // hint will be enable only for JDK-11 or above.
+        if 
(ctx.getInfo().getSourceVersion().compareTo(SourceVersion.RELEASE_9) < 2) {
+            return null;
+        }
+        // Check invalid lambda parameter declaration
+        for (Diagnostic d : ctx.getInfo().getDiagnostics()) {
 
 Review comment:
   We should check for errors only in the selected lambda expr.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to