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_r202939599
##########
File path:
java.hints/src/org/netbeans/modules/java/hints/suggestions/Lambda.java
##########
@@ -630,4 +663,39 @@ protected void performRewrite(TransformationContext ctx)
throws Exception {
}
}
}
+
+ private static final class AddVarLambdaParameterTypes extends JavaFix {
+
+ public AddVarLambdaParameterTypes(CompilationInfo info, TreePath tp) {
+ super(info, tp);
+ }
+
+ @Override
+ protected String getText() {
+ return Bundle.FIX_addVarLambdaParameters();
+ }
+
+ @Override
+ protected void performRewrite(JavaFix.TransformationContext ctx)
throws Exception {
+ LambdaExpressionTree let = (LambdaExpressionTree)
ctx.getPath().getLeaf();
+ TreeMaker make = ctx.getWorkingCopy().getTreeMaker();
+ let.getParameters().forEach((var) -> {
+ ctx.getWorkingCopy().rewrite(var.getType(), make.Type("var"));
// NOI18N
+ });
+ }
+ }
+
+ /**
+ *
+ * @param info : compilationInfo
+ * @return true if Diagnostic Code is present in SKIPPED_ERROR_CODES
+ */
+ private static boolean isDiagnosticCodeTobeSkipped(CompilationInfo info,
Tree tree) {
Review comment:
Move this to a Utility class?
----------------------------------------------------------------
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