You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by GitBox <gi...@apache.org> on 2020/04/20 09:02:33 UTC

[GitHub] [netbeans] entlicher commented on a change in pull request #2055: NETBEANS-3580] : Fixed Debug Expression Lambda

entlicher commented on a change in pull request #2055:
URL: https://github.com/apache/netbeans/pull/2055#discussion_r411213144



##########
File path: java/debugger.jpda/src/org/netbeans/modules/debugger/jpda/breakpoints/LineBreakpointImpl.java
##########
@@ -337,32 +343,35 @@ protected void classLoaded (List<ReferenceType> referenceTypes) {
                     continue;
                 }
                 // Submit the breakpoint for the lowest location on the line only:
-                Location location = locations.get(0);
-                com.sun.jdi.Method m0 = location.method();
-                for (int li = 1; li < locations.size(); li++) {
-                    Location l = locations.get(li);
-                    if (l.codeIndex() < location.codeIndex()) {
-                        if (l.method().equals(m0)) {
-                            // Assure that we're still in the same method
-                            location = l;
-                        }
-                    }
-                }
+                /* If location contains multiple event breakpoint for the same line 
+                (e.g lambda expression along with any function calling 
+                map(n -> foo(
+                        boo(n)))) 
+                then take the lowest location from each type of event*/
+                Collection<Location> lowestLocationList = locations
+                        .stream()
+                        .collect(groupingBy(loc->loc.method().toString(),
+                                LinkedHashMap::new,
+                                collectingAndThen(minBy(Comparator.comparingDouble(Location::codeIndex)), 

Review comment:
       It's better to use `Comparator.comparingLong`




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists