microsoft / java-wdb

Windows Developer Box for Java Developers
MIT License
75 stars 1 forks source link

Add native support in JDWP for debugging lambda expressions #3

Open gayanper opened 3 years ago

gayanper commented 3 years ago

Summary

Today there is no support for debugging lambda expressions using JDWP efficiently. The current support only capable of putting a line breakpoint where the jvm is suspended on each lambda expression in that line. But if the developer want to suspend only on certain lambda expression they have to make the lambda expression a lambda block which spans multiple lines.

Such example scenarios is debugging a stream operation such as Stream.of(args).filer(s -> s.length() > 1).map(s -> s.trim()).collect(toList()) Some IDEs add method breakpoint after looking at synthetic methods that are generated for lambda expressions at compile time.

Motivation

This enhancement will enable IDE developers to add breakpoints to lambda expressions without depending on how different compilers generate synthetic methods for lambda expressions. This make debugging lambda statement reliable in most of Java IDEs which will support full JDWP.

shathor commented 3 years ago

This make debugging lambda statement reliable in most of Java IDEs which will support full JDWP.

Note that this already works in IntelliJ IDEA. If looking for hints.

gayanper commented 3 years ago

@shathor yes thats an IDE solution not supported by JDK tooling and IJ is not the only java IDE used in the industry. So i think adding support in JDK tooling will make IDE to focus more on user features.