emilianbold commented on code in PR #53:
URL: https://github.com/apache/netbeans-jackpot30/pull/53#discussion_r4349097286


##########
cmdline/tool/src/org/netbeans/modules/jackpot30/cmdline/Main.java:
##########
@@ -659,7 +660,17 @@ public FilteringWorker(PatchDescription patch, Worker 
delegate) {
             @Override
             public Collection<? extends ErrorDescription> 
createErrors(HintContext ctx) {
                 Collection<? extends ErrorDescription> errors = 
delegate.createErrors(ctx);
-                return errors != null ? errors.stream().filter(ed -> 
patch.included(ed)).collect(Collectors.toList()) : null;
+                if (errors == null) return null;
+                //ErrorDescriptionFactory never produces a multi-line span: 
forTree clamps the
+                //end of the description to the end of its first line, forName 
uses the (short)
+                //name span. A match that starts on a line the patch did not 
add but ends on a
+                //line it did add would therefore be filtered out when judged 
by the description's
+                //range. Use the span of the tree the hint matched instead; 
fall back to the
+                //description's own range if the tree positions cannot be 
determined.
+                Tree tree = ctx.getPath().getLeaf();
+                int start = (int) 
ctx.getInfo().getTrees().getSourcePositions().getStartPosition(ctx.getInfo().getCompilationUnit(),
 tree);
+                int end = (int) 
ctx.getInfo().getTrees().getSourcePositions().getEndPosition(ctx.getInfo().getCompilationUnit(),
 tree);

Review Comment:
   Done.



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