Skip to content

scala3-library_3-3.3.4.jar is using jdk.unsupported apis and not compatible with Java 17/21 #23048

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

Closed
ilapavuluri opened this issue Apr 25, 2025 · 4 comments
Labels
area:jdk Issues tied to artifacts published under a particular jdk compat:java:jep Issues corresponding to a JEP (JDK Enhancement Proposal) itype:invalid stat:duplicate

Comments

@ilapavuluri
Copy link

Hi Team,

I am using scala3-library_3-3.3.4.jar in my application, when I run "jdeps --multi-release 21 -jdkinternals" scan I am getting below report:

scala3-library_3-3.3.4.jar -> jdk.unsupported
scala.runtime.LazyVals$ -> sun.misc.Unsafe JDK internal API (jdk.unsupported)

Warning: JDK internal APIs are unsupported and private to JDK implementation that are
subject to be removed or changed incompatibly and could break your application.
Please modify your code to eliminate dependence on any JDK internal APIs.
For the most recent update on JDK internal API replacements, please check:
https://wiki.openjdk.org/display/JDK8/Java+Dependency+Analysis+Tool

JDK Internal API Suggested Replacement


sun.misc.Unsafe See https://openjdk.org/jeps/260

Based on this report it looks like scala3-library_3-3.3.4.jar is not compatible with Java 17/21, correct me if I miss anything.

Appreciate any help on this.

@ilapavuluri ilapavuluri added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label labels Apr 25, 2025
@Gedochao
Copy link
Contributor

That doesn't seem right.
sun.misc.Unsafe JDK internal API did get deprecated for removal, yes, but only since JDK 23, in JEP-471 https://openjdk.org/jeps/471

We will be migrating from using the API in Scala 3.8, while we also bump the JDK to 17.
This is tracked under:

Also note that this will not be changed in Scala 3.3 LTS, so if you're interested in newest JDK compat, you should look toward Scala 3.9 LTS down the line.

If you've got further questions on this, feel free to comment under #9013.
Closing this as duplicate/invalid.

@Gedochao Gedochao added area:jdk Issues tied to artifacts published under a particular jdk compat:java:jep Issues corresponding to a JEP (JDK Enhancement Proposal) stat:duplicate itype:invalid and removed stat:needs triage Every issue needs to have an "area" and "itype" label itype:bug labels Apr 25, 2025
@ilapavuluri
Copy link
Author

Thank you @Gedochao, as a workaround for now, do I need to add "--add-opens or --add-exports" until I migrate to Scala 3.8 inorder to run my application in Java 21?

@Gedochao
Copy link
Contributor

Thank you @Gedochao, as a workaround for now, do I need to add "--add-opens or --add-exports" until I migrate to Scala 3.8 inorder to run my application in Java 21?

Your application should work on Java 21 without issue.
The deprecation comes online in Java 23, whereas runtime warnings arrive as late as Java 25.
The APIs won't actually get removed until at least Java 26, as per the JEP.

@ilapavuluri
Copy link
Author

ok thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:jdk Issues tied to artifacts published under a particular jdk compat:java:jep Issues corresponding to a JEP (JDK Enhancement Proposal) itype:invalid stat:duplicate
Projects
None yet
Development

No branches or pull requests

2 participants