-
Notifications
You must be signed in to change notification settings - Fork 874
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Escape java hint fix String for html and fill in multi variables. #7075
Conversation
java/spi.java.hints/src/org/netbeans/spi/java/hints/JavaFixUtilities.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks reasonable to me. Thanks!
java/spi.java.hints/src/org/netbeans/spi/java/hints/JavaFixUtilities.java
Outdated
Show resolved
Hide resolved
@lahodaj do you think it is possible to compute the display name lazily in the getter of Is it legal to call |
ef653e6
to
cd18599
Compare
after testing a bit more I had to make some more adjustments
I noticed during testing that variables for method names are missing in the list, example: java.util.Iterator<$T> $it = $col.iterator();
while ($it.hasNext()) {
if ($it.next().$condition($params$)) {
$it.remove();
}
} :: $col instanceof java.util.Collection
=>
$col.removeIf(e -> e.$condition($params$));
;;
|
rebasing/squashing for a fresh run and preparing for merge |
- The hint fix contains code segments which may contain angle brackets. This can break the formatting of the apply-fix dropdown. - Multi variables are now replaced with their values in simple cases. - sort vars by length before replacement so that they don't replace each other. Multi-vars go first. - VariableTree should be converted into an identifier name in some cases - some String cleanup so that it is presentable as one-liner in UI - compute display name for fix lazily so that it does not run in the hint matching phase
cd18599
to
57e3c10
Compare
I looked through com.sun.tools.javac.tree.Pretty which is called by |
fixes a few small issues and one little performance improvement:
String.replace()
instead ofreplaceAll()
since no regex is involvedbefore:

after:

hint:
note:
$T$
(zero-or-many) were not substituted before this changenon-trivial case:
note: some vars are prefixes of others
empty body:

single entry in multivar:

multiple entries in multivar:
