sdedic commented on a change in pull request #650: [NETBEANS-1075]-Adding var hints for enhanced-for-loop URL: https://github.com/apache/incubator-netbeans/pull/650#discussion_r208539954
########## File path: java.hints/src/org/netbeans/modules/java/hints/jdk/ConvertToVarHint.java ########## @@ -129,6 +138,22 @@ protected void performRewrite(TransformationContext tc) throws Exception { initializerTree ); wc.rewrite(oldVariableTree, newVariableTree); + } else if (statementPath.getLeaf().getKind() == Tree.Kind.ENHANCED_FOR_LOOP) { + EnhancedForLoopTree elfTree = (EnhancedForLoopTree) statementPath.getLeaf(); + ExpressionTree expTree = elfTree.getExpression(); + VariableTree vtt = elfTree.getVariable(); + if (expTree == null) { Review comment: maybe also check for `vtt == null` ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@netbeans.apache.org For additional commands, e-mail: notifications-h...@netbeans.apache.org For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists