eclipse-jdt / eclipse-jdt/eclipse.jdt.debug
Lambda Entry Breakpoints doesn't stop at the intended breakpoint location once source is modified
- Dominant language
- Java
- Stars
- 23
- Forks
- 68
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 13
Description
Take this snippet
```
public class LambdaTesting {
interface Drawable {
public void draw();
}
public static void main(String[] args) {
List names = Arrays.asList("Calice", "Bob", "Charlie", "David");
names.stream().filter(n -> n.length() > 3).map(n -> n.toUpperCase()).collect(Collectors.toList());
Drawable d1 = () -> {
System.out.println("21");
};
/*
* Drawable d2 = () -> { System.out.println("2"); }; // Keep this commented first
*/
Drawable d21 = () -> { // Create a lambda entry breakpoint here
System.out.println("2");
};
d1.draw();
d21.draw();
//d2.draw(); // Keep this commented first
}
}
```
And try debugging ---> It will stop at `d21()` entry
Now stop the debugger and uncomment the lambda above `d21` (d2) and `d2.draw` and save the editor and try debugging the code again. --> Now it stop stops at `d2()` even though breakpoint was at `d21()`
___________________________________________
Now add an entry lambda breakpoint for ` names.stream().filter(n -> n.length() > 3).map(n -> n.toUpperCase()).collect(Collectors.toList()); ` (Chained lambda)
and debug for first time ---> Works
Again copy & paste the same lambdas multiple times above the current one and debug -> Fails
https://github.com/user-attachments/assets/c020a7f2-1684-498a-ac71-937a12314e50
Contributor guide
Assessment
This issue has not been assessed yet.