Skip to content
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

JlinkPlugin misses jdk.unsupported #1446

Closed
Martomate opened this issue Aug 9, 2021 · 2 comments · Fixed by #1499
Closed

JlinkPlugin misses jdk.unsupported #1446

Martomate opened this issue Aug 9, 2021 · 2 comments · Fixed by #1499

Comments

@Martomate
Copy link

Expected behaviour

If a project uses the jdk.unsupported module (e.g. the sun.misc.Unsafe class) that module should be included in the JRE created by the JlinkPlugin.

Actual behaviour

The jdk.unsupported module is not included in the JRE.

I have found that the jdeps command returns the jdk.unsupported module, but the JlinkPlugin misses it. This happens here in JlinkPlugin.scala.

This is caused by the jdeps command returning JDK internal API (jdk.unsupported) but the JlinkPlugin expects only a module name. It only seems to occur in the three-column rows, and in all other places the module name is printed without any extra information. Here is an example:

   requires mandated java.base (@11-ea)
   requires java.desktop (@11-ea)
   requires java.xml (@11-ea)
   requires transitive javafx.base
   requires jdk.unsupported (@11-ea)
javafx.graphics -> java.base
javafx.graphics -> java.desktop
javafx.graphics -> java.xml
javafx.graphics -> javafx.base
javafx.graphics -> jdk.unsupported
   com.sun.marlin                                     -> java.util.concurrent.atomic                        java.base
   com.sun.marlin                                     -> sun.misc                                           JDK internal API (jdk.unsupported)
   com.sun.marlin.stats                               -> com.sun.marlin.stats                               javafx.graphics

Information

  • What sbt-native-packager are you using - 1.9.3
  • What sbt version - 1.5.5
  • What is your build system - Ubuntu
  • What package are you building - Universal
  • What is your target system - Ubuntu
@muuki88
Copy link
Contributor

muuki88 commented Aug 13, 2021

Thanks a lot for this very well researched bug report

I have no experience with jlink, but happy help with a pull request to fix this 😊

412b added a commit to 412b/sbt-native-packager that referenced this issue Feb 15, 2022
fixes sbt#1446

fix `jdk.unsupported`, sbt style and optimize allocations and additional tests added
@412b
Copy link
Contributor

412b commented Feb 15, 2022

@muuki88 I've got some dusty code for that issue and general optimizations for deps processing in JLinkPlugin
I will create PR shortly

412b added a commit to 412b/sbt-native-packager that referenced this issue Feb 15, 2022
fixes sbt#1446

fix `jdk.unsupported`, sbt style and optimize allocations and additional tests added
muuki88 pushed a commit that referenced this issue Feb 21, 2022
fixes #1446

fix `jdk.unsupported`, sbt style and optimize allocations and additional tests added
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants