-
Notifications
You must be signed in to change notification settings - Fork 860
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[NETBEANS-7069] Support Nashorn 15.x for JDK >= 15 #7972
base: master
Are you sure you want to change the base?
Conversation
Netbeans does support debugging of legacy Nashorn JavaScript engine bundled with OpenJDK < 15.0. It does not support the the most recent Nashorn 15.4 extracted from OpenJDK, that has different package name. Change allows debugging both legacy Nashorn JavaScript and also extracted Nashorn with new org.openjdk.nashorn package name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for working on this. I left a first set of comments inline. The bad part is, that it does not work for me.
This is the project I used to test: mavenproject3.zip
Baseline is (more or less) current master. I configure the maven project to use JDK 11 for execution and comment out the Nashorn dependency. Then I place a breakpoint in the test.js
file, line 5. Then I invoke "Debug" from the context menu of the project. The IDE starts the programm and the breakpoint in the JS code is hit. This looks like the expected behavior.
I then reconfigured the maven project to run with JDK 21 and reenabled the Nashorn dependency (only out-of-jdk Nashorn is run). With that baseline does not break anywhere, programm just runs through.
Side information I noticed while testing was, that when both out-of-jdk Nashorn and in-jdk Nashorn are present (dependency commented in and running on JDK 11), the out-of-jdk version if preferred by ScriptEngineManager.
With this PR and the same setup I get several hits in java code:
But none in JS. I would first look inside JSJavaBreakpointsManager.java
. One thing to keep in mind in that class is, that it might be called multiple times. NetBeans supports multiple debugging sessions in parallel and then engineAdded
is called multiple times, without calls to engineRemoved
in between.
java/debugger.jpda/src/org/netbeans/modules/debugger/jpda/models/CallStackFrameImpl.java
Outdated
Show resolved
Hide resolved
java/debugger.jpda.js/src/org/netbeans/modules/debugger/jpda/js/vars/JSVariable.java
Outdated
Show resolved
Hide resolved
java/debugger.jpda.js/src/org/netbeans/modules/debugger/jpda/js/vars/JSVariable.java
Outdated
Show resolved
Hide resolved
@@ -64,7 +64,7 @@ | |||
@LazyActionsManagerListener.Registration(path="netbeans-JPDASession/Java") | |||
public class StepIntoJSHandler extends LazyActionsManagerListener implements PropertyChangeListener { | |||
|
|||
private static final String SCRIPT_ACCESS_CLASS = "jdk.nashorn.internal.runtime.ScriptFunctionData"; // NOI18N | |||
private static final String SCRIPT_ACCESS_CLASS = "org.openjdk.nashorn.internal.runtime.ScriptFunctionData"; // NOI18N |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I'm not mistaken, this also need to be duplicated so that both in-jdk and external nashorn are supported.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch, you are correct, I missed this. Need to apply for both Nashorns too.
Hi @matthiasblaesing , I'll try your project. And yes, problem will be most probably in the JSJavaBreakpointsManager, this is tricky part, because one has to create breakpoints in advance and the debugger instance not available, so I created two sets of breakpoints. I need also put some explanation for potential reader. |
…ls/CallStackFrameImpl.java Co-authored-by: Matthias Bläsing <[email protected]>
…s/vars/JSVariable.java Of course this was wrong typo. Btw, I'll squash all commits later on. Co-authored-by: Matthias Bläsing <[email protected]>
…s/vars/JSVariable.java Co-authored-by: Matthias Bläsing <[email protected]>
Netbeans does support debugging of legacy Nashorn JavaScript engine bundled with OpenJDK < 15.0. It does not support the the most recent Nashorn 15.4 extracted from OpenJDK, that has different package name.
Change allows debugging both legacy Nashorn JavaScript and also extracted Nashorn with new org.openjdk.nashorn package name.
See issue #7069