jlahoda commented on a change in pull request #3540:
URL: https://github.com/apache/netbeans/pull/3540#discussion_r796290460
##########
File path:
java/java.hints.declarative/src/org/netbeans/modules/java/hints/declarative/conditionapi/Matcher.java
##########
@@ -90,25 +91,38 @@ public Void scan(Tree tree, Void p) {
return result[0];
}
+ @SuppressWarnings("BoxedValueEquality")
public boolean referencedIn(@NonNull Variable variable, @NonNull Variable
in) {
- final Element e =
ctx.ctx.getInfo().getTrees().getElement(ctx.getSingleVariable(variable));
+ final Trees trees = ctx.ctx.getInfo().getTrees();
+ final Element e = trees.getElement(ctx.getSingleVariable(variable));
if (e == null) { //TODO: check also error
return false;
}
+ TreePath v = ctx.getSingleVariable(in);
+ if (v != null && e.equals(trees.getElement(v))) {
Review comment:
Good catch, but it would be better, I think, to move this test into the
for loop (and operate over `tp`). We could have something like:
`Arrays.asList(0, 1, b, 3)` with a pattern list `Arrays.asList($arrgs$)`.
--
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