sarveshkesharwani commented on a change in pull request #1071: [NETBEANS-1728]
fix for Exception encountered when break returns value
URL:
https://github.com/apache/incubator-netbeans/pull/1071#discussion_r249683878
##########
File path:
java/java.source.base/src/org/netbeans/api/java/source/TreeUtilities.java
##########
@@ -1335,6 +1335,54 @@ public Void visitMethod(MethodTree node, Boolean p) {
return null;
}
+ /**Find the target of <code>break</code> or <code>continue</code>. The
given
+ * {@link CompilationInfo} has to be at least in the {@link
Phase#RESOLVED} phase.
+ *
+ * @param breakOrContinue {@link TreePath} to the tree that should be
inspected.
+ * The
<code>breakOrContinue.getLeaf().getKind()</code>
+ * has to be either {@link Kind#BREAK} or {@link
Kind#CONTINUE}, or
+ * an IllegalArgumentException is thrown
+ * @return the tree that is the "target" for the given break or continue
statement, or null if there is none. Tree can be of type StatementTree or
ExpressionTree
+ * @throws IllegalArgumentException if the given tree is not a break or
continue tree or if the given {@link CompilationInfo}
+ * is not in the {@link Phase#RESOLVED} phase.
+ * @since 0.16
+ */
+ public Tree getBreakContinueTargetTree(TreePath breakOrContinue) throws
IllegalArgumentException {
Review comment:
Thanks for the review, Arunava. I've moved the version to 2.40.0, and made
the necessary changes in TreeUtilities, and apichanges.xml.
----------------------------------------------------------------
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