scala / scala-dev

Scala 2 team issues. Not for user-facing bugs or directly actionable user-facing improvements. For build/test/infra and for longer-term planning and idea tracking. Our bug tracker is at https://github.com/scala/bug/issues
Apache License 2.0
130 stars 14 forks source link

Support features of JDK 11+ #139

Open retronym opened 8 years ago

retronym commented 8 years ago

In general, Scala now works just fine on JDK 11

For the current support status of each JDK version, see https://docs.scala-lang.org/overviews/jdk-compatibility/overview.html

JDK9 JEP list

SethTisue commented 5 years ago

@retronym I'm retargeting this for 2.13.1, please open new tickets for any pieces that must make 2.13.0-RC1 or 2.13.0

cekvenich commented 4 years ago

It has been almost a year. Is there any ETA on JDK 11 support? Or we wait for Scala 3?

smarter commented 4 years ago

@cekvenich Scala 2 works on JDK 11 already, this bug report is about specific new features of the JDK that could be supported, are you interested in one of these features in particular?

cekvenich commented 4 years ago

@smarter No. I was just planning on installing Scala, and home pages says use Java 8, but I already have 11 and did not want issues. So should work w/11. OK, thanks.

SethTisue commented 4 years ago

perhaps it's time for us to tone down or remove the JDK 11 cautions at https://www.scala-lang.org/download/ and https://docs.scala-lang.org/overviews/jdk-compatibility/overview.html#jdk-11-compatibility-notes . the current language in both locations was put in place quite some time ago

SethTisue commented 4 years ago

I've added "In general, Scala now works just fine on JDK 11" right at the top of this page.

I also changed the ticket title and tags to reflect that we don't care about 9 and 10 anymore, only 11 and higher.

schrepfler commented 4 years ago

Does the "just works" cover running on top of JDK 11 or also developing on top of it? I remember having some issues around module support with the satellite scala packages (java8-compat, scala-parser-combinators etc.) when trying to build stuff on it (I was on JDK 13 when I was trying this).

nigredo-tori commented 4 years ago

@schrepfler, I've been developing/running on top of JDK 11 for a while now (both with 2.11 and 2.12, and with some Java libraries in the mix). Most of the issues I encounter are caused by external libraries not built for Java 11 (e.g. ByteBuffer API has changed somewhere between 8 and 11), missing modules (solved by adding them to classpath as managed/unmanaged dependencies), and class loader changes. JPMS is not an issue unless you want to really dig into it and build your own modules.

Basically, nothing prevents you from working with JDK 11. You'll encounter some annoying issues - but those are not unique to Scala. Some JPMS-related features are not supported - but everything that was possible with JDK 8 should be possible with JDK 11 after some fiddling.

SethTisue commented 4 years ago

@schrepfler it's not uncommon for a random Scala OSS repo to fail to build on JDK 13 without tweaks, usually trivial ones like bumping the SBT version or disambiguating a now-ambiguous import, that kind of thing. so if you're working in other people's repos, you'll probably want to have JDK 8 and/or 11 on your system as a fallback plan, in case the needed tweaks aren't obvious

some repos may also fail to build on 11, but I think that has become much less common

I agree with @nigredo-tori 's remarks as well.

raboof commented 4 years ago

external libraries not built for Java 11 (e.g. ByteBuffer API has changed somewhere between 8 and 11)

(kindof offtopic, but since it was mentioned: if a library has a problem with ByteBuffer.clear when running under JDK8, this is likely because it was built with JDK11 targeting JDK8, but using the JDK11 bootclasspath. Using the --release/-release flags for javac/scalac while compiling the library that calls ByteBuffer.clear should fix this, but IIRC there was some problem with this on scalac versions before 2.12.8/2.13.1)