mbien commented on issue #9673:
URL: https://github.com/apache/netbeans/issues/9673#issuecomment-6054415977
researched a few things about this. So those $$ names indicate runtime
generated constructs. Those are lambda _instances_ which may hold state.
the JDK can generate them in stack traces too:
```java
private static <V> V foo(Callable<V> call) throws Exception {
return call.call();
}
static void main() throws Exception {
foo(() -> {
throw new RuntimeException();
});
}
```
regular stack trace:
```
Exception in thread "main" java.lang.RuntimeException
at
dev.mbien.mavenproject1.Mavenproject1.lambda$main$0(Mavenproject1.java:18)
at dev.mbien.mavenproject1.Mavenproject1.foo(Mavenproject1.java:13)
at dev.mbien.mavenproject1.Mavenproject1.main(Mavenproject1.java:17)
```
now with `-XX:+UnlockDiagnosticVMOptions -XX:+ShowHiddenFrames`
```
Exception in thread "main" java.lang.RuntimeException
at
dev.mbien.mavenproject1.Mavenproject1.lambda$main$0(Mavenproject1.java:18)
at
dev.mbien.mavenproject1.Mavenproject1$$Lambda/0x000000005d040400.call(Unknown
Source)
at dev.mbien.mavenproject1.Mavenproject1.foo(Mavenproject1.java:13)
at dev.mbien.mavenproject1.Mavenproject1.main(Mavenproject1.java:17)
```
the number changes from run to run since its an instance and not part of the
bytecode.
Given that this synthetic frame is somewhat redundant for the debugger view,
we could probably hide it.
However: There is another issue which might be related to the extra stack
frame. You can't actually step into the lambda.
```java
private static <V> V foo(Callable<V> call) throws Exception {
return call.call(); // set breakpoint and step into
}
public static void main(String[] args) throws Exception {
foo(() -> {
System.out.println("lambda"); // it will print "lambda"
without halting on this line
return null;
});
System.out.println("exit");
}
```
the only way I could step into it is by setting a breakpoint inside the
lambda. (tested also on JDK 8 which didn't have hidden classes yet)
--
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