mbien commented on a change in pull request #3540:
URL: https://github.com/apache/netbeans/pull/3540#discussion_r796465847



##########
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:
       haven't considered that. Fixed + added another test for the mentioned 
case.




-- 
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

Reply via email to