Preliminary compatibility with JDK 9#2951
Merged
Conversation
This is the start of an effort to make SBT 0.13.x compatible with JDK 9. The system property java.ext.dirs no longer exists now that JEP-220 has removed the extension and endorsed classpath facilities. It is also forbidden to manually set this to an empty string from the command line. This commit treats the absense of this property as an empty extension classpath.
JEP-201 describes the new modularized Java Standard Library in Java 9. By default, java.xml.bind is no longer on the default classpath; it needs to be added explicitly with a JVM option `--add-modules java.xml.bind`, or with a dependency declaration in the module-info.java file if you package your own code up as a Jigsaw module. This commit traps the linkage error and (reflectively) uses the java.util.Base64, which is the recommended way to encode/decode since 1.8.
This was referenced Feb 5, 2017
eed3si9n
approved these changes
Feb 5, 2017
dwijnand
approved these changes
Feb 5, 2017
Member
|
Notes in #2952 |
Member
|
We need to forward port these. |
This was referenced Feb 14, 2017
This was referenced Apr 4, 2017
Merged
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request cleans up two small issues that stood in the way of using the soon-to-be-released Java 9 with SBT.
java.ext.dirsjava.xml.bindnot part of thejava.basedefault classpathScala compiler versions prior to 2.12.1 do not tolerate the absence of
rt.jarfrom the JDK. But we can appease them a little manual setup.First, we can extract an equivalent JAR with a tool I've written:
Then, we can feed that to the compilation classpath of Scala compilers used within SBT with the
scala.ext.dirsSystem property.Note that this doesn't actually require you to use Scala 2.12.1 in your application, 2.11.8 is able to use Java 9.
Also note that
scalacdoes not yet enforce the stricter module accessibility rules imposed by JEP-261, so your code might typecheck and compile but incurLinkageError-s at runtime if you are calling non-exported APIs.