|
| 1 | +--- |
| 2 | +category: announcement |
| 3 | +permalink: /news/next-scala-lts.html |
| 4 | +title: "Next Scala 3 LTS version" |
| 5 | +by: Tomasz Godzik |
| 6 | +--- |
| 7 | + |
| 8 | +**TLDR;** |
| 9 | + |
| 10 | +sun.misc.Unsafe, re-used in lazy val implementation, will be removed in a future |
| 11 | +JDK one of the Scala 3 Next minors in 2025 Q4 and the next LTS will drop JDK 8 |
| 12 | +support |
| 13 | + |
| 14 | +## Intro |
| 15 | + |
| 16 | +For the compiler’s second LTS version, the Scala 3 compiler team will be |
| 17 | +dropping support for JDK 8 and is considering which later JDK to use. |
| 18 | + |
| 19 | +## Reasons for the change |
| 20 | + |
| 21 | +One of the main reasons is that recent [JEP 471](https://openjdk.org/jeps/471) |
| 22 | +stated that the memory-access methods in sun.misc.Unsafe are scheduled for |
| 23 | +removal in a future release. Currently, Scala 3 uses sun.misc.Unsafe in its |
| 24 | +implementation of lazy values. This was needed due to compatibility with JDK 8. |
| 25 | +In order to support later versions of JDK we will need to drop usage of Unsafe, |
| 26 | +which is being investigated under |
| 27 | +[this issue](https://github.com/scala/scala3/issues/9013). It also started to |
| 28 | +dawn on the compiler team that we might consider stopping to support JDK 8 |
| 29 | +altogether in a future release of Scala 3. |
| 30 | + |
| 31 | +## Advantages |
| 32 | + |
| 33 | +Switching to a newer version of the JDK would allow both the compiler and the |
| 34 | +Scala ecosystem to start using new features brought in by JDK 9+. This might |
| 35 | +include a number of JEPs, which will be investigated by the team the coming |
| 36 | +year. To check the current status take a look at the issues marked with the |
| 37 | +[JEP label](https://github.com/scala/scala3/issues?q=is%3Aissue+is%3Aopen+label%3Acompat%3Ajava%3Ajep). |
| 38 | + |
| 39 | +Another advantage would be reducing the maintenance burden on tooling and |
| 40 | +library authors that currently have to take into account a large number of |
| 41 | +different versions to test and make sure that their code is performant on all of |
| 42 | +them. |
| 43 | + |
| 44 | +If we take a look at the timeline we'll see that JDK 8 was first published on |
| 45 | +18th March 2014, which is already over 10 years ago. Technology and especially |
| 46 | +JDKs have advanced greatly through that period and in order to stay competitive |
| 47 | +using those advancements is a must. A lot of the existing distributions are |
| 48 | +already stopping or will soon stop updating JDK 8 with security and other fixes, |
| 49 | +which might directly impact issues within your business applications. |
| 50 | + |
| 51 | +Some larger projects within JVM and Scala ecosystems have already dropped JDK 8 |
| 52 | +support. And while it's always possible to not update your libraries and Scala |
| 53 | +version, which will avoid having to switch to a newer JDK, it's highly |
| 54 | +discouraged as it will make you vulnerable to potential security risks. |
| 55 | + |
| 56 | +## Plan for making the switch |
| 57 | + |
| 58 | +The current plan is to drop support of JDK 8 in one of the future minor releases |
| 59 | +of Scala 3 and in the next LTS. The JDK will be either 11 or 17 depending on the |
| 60 | +community feedback and our investigations. The current estimate for the next LTS |
| 61 | +is Q4 2025. |
| 62 | + |
| 63 | +One of the major challenges here will be making sure that we are still able to |
| 64 | +use libraries compiled with earlier JDK 8 compatible Scala 3 versions in the |
| 65 | +versions with a new implementation of lazy values, which is not reliant on |
| 66 | +sun.misc.Unsafe. |
| 67 | + |
| 68 | +## How does it affect me? |
| 69 | + |
| 70 | +If you are using Scala 3 on JDK 8 do let us know! However the current line of |
| 71 | +LTS under 3.3.x will be supported for at least another year after the release of |
| 72 | +the next LTS version, which should give you plenty of time to migrate. |
| 73 | + |
| 74 | +If at any point it turns out it's not possible for you to switch, be sure to |
| 75 | +send us your feedback. |
| 76 | + |
| 77 | +## Summary |
| 78 | + |
| 79 | +You can track the current work related to lazy values under |
| 80 | +[this issue](https://github.com/scala/scala3/issues/9013) and discuss the topic |
| 81 | +under soon to be posted thread on the |
| 82 | +[Scala contributors forum](https://contributors.scala-lang.org/) |
0 commit comments