mbien commented on code in PR #7075:
URL: https://github.com/apache/netbeans/pull/7075#discussion_r1504810875
##########
java/spi.java.hints/src/org/netbeans/spi/java/hints/JavaFixUtilities.java:
##########
@@ -285,9 +285,11 @@ private static String
defaultFixDisplayName(CompilationInfo info, Map<String, Tr
return "Rewrite to " + replaceTarget.replace("♦", "$").replace("<",
"<");
}
- // could this be leaf.toString()?
private static String treeToString(TreePath tp, CompilationInfo info) {
Tree leaf = tp.getLeaf();
+ if (leaf.getKind() == Kind.VARIABLE) {
+ return ((VariableTree) leaf).getName().toString();
+ }
Review Comment:
```
$mods$ $type $name = new $T();
```
lets say we have the tp for `$name` the old code would have essentially
called tp.getLeaf().toString() which would be the whole statement. This will
only return the identifier (`$name`).
I am not sure if there are other trees which need similar treatment.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
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