Java debugger can't call some default method implementations

后端 未结 1 622
没有蜡笔的小新
没有蜡笔的小新 2021-01-05 03:43

I\'m coding in IntelliJ IDEA. When debugging my application, I can\'t use some default method implementations in Watches.

Here is a condensed example:

相关标签:
1条回答
  • 2021-01-05 04:34

    Prior to JDK 8u40, default and static interface methods were not supported by JDI (Java Debugger Interface), JDWP (Java Debugger Wire Protocol) and JDB (the standard Java debugger). This is bug JDK-8042123, which is recorded as fixed in 8u40 and a corresponding blurb appears in the 8u40 release notes.

    Update to 8u40 or later to fix this issue, at least on the JDK side.

    From the bug description, it looks like debugger-side changes are also required, to avoid casting com.sun.jdi.InterfaceType objects to com.sun.jdi.ClassType, but instead call InterfaceType.invokeMethod() directly.

    In the specific case of IntelliJ, Suseika confirmed in a comment that 14.1.2 has mostly fixed the issue (except the unexpected boxing), though Mike Kobit still experiences this problem on that version with a ClassCastException suggestive of the incorrect cast above.

    0 讨论(0)
提交回复
热议问题