mbien commented on PR #8264:
URL: https://github.com/apache/netbeans/pull/8264#issuecomment-2726292064
> The cross-jdk access indeed seems to be problematic. NB running on JDK 23
can use target JDK 23 and 21, but not 17
took a look and
- for JDK 19+ as runtime the compatible jshell version would be [19, RT_JDK]
- for JDK 17 or 18 as runtime it would be [9, RT_JDK]
due to
https://github.com/openjdk/jdk/blob/0460978e7c769624cacdb528277a99914b327e30/src/jdk.jdi/share/classes/com/sun/tools/jdi/SunCommandLineLauncher.java#L135-L140
which isn't recognized on JVMs < 19 (there is also no option to ignore
unknown flags) as you mentioned.
whats funny though is that the argument is checked on both sides, I tried to
remove it from the connector via reflection as test and it failed validation on
the client side:
```
com.sun.jdi.connect.IllegalConnectorArgumentsException: Argument missing
at
jdk.jdi/com.sun.tools.jdi.ConnectorImpl.argument(ConnectorImpl.java:105)
at
jdk.jdi/com.sun.tools.jdi.SunCommandLineLauncher.launch(SunCommandLineLauncher.java:167)
at
jdk.jshell/jdk.jshell.execution.JdiInitiator.lambda$launchTarget$0(JdiInitiator.java:142)
```
> In the opposite direction I see a problem when running on JDK 17 and
choosing JDK 21 as platform. If I read ShellSession.java correctly, the code
asks the runtime JDK to create a javac with target of the target platform. This
must go wrong.
I think this might be actually correct since it uses also the classpath of
the target platform too. I believe what is happening is that JShell invokes
javac from the runtime JDK without using its javac or nb-javac. I tried to
enable nb-javac but this lead to other classloader problems.
I probably won't change anything there for now - this would be something for
other PRs.
--
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