Skip to content

Commit 64fff46

Browse files
committed
docs: Rework list of JEPs and mention more projects
1 parent 995f8c6 commit 64fff46

File tree

1 file changed

+75
-51
lines changed

1 file changed

+75
-51
lines changed

_posts/2025-02-01-next-scala-lts.md

+75-51
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ by: Tomasz Godzik
77

88
**TLDR;**
99

10-
API used in lazy val implementation, will be removed in a future JDK thus one of
11-
the Scala 3 Next minors in 2025 Q4 and the next LTS will drop JDK 8 support.
10+
An API used in the `lazy val` implementation will be removed in a future JDK.
11+
Its replacement is only available on JDK 9+. Therefore, the Scala 3 Next minors
12+
in 2025 Q4 and the next LTS will drop JDK 8 support.
1213

1314
## Intro
1415

@@ -17,80 +18,103 @@ dropping support for JDK 8 and is considering which later JDK to use.
1718

1819
## Immediate motivation
1920

20-
One of the main reasons is that recent [JEP 471](https://openjdk.org/jeps/471)
21-
stated that the memory-access methods in sun.misc.Unsafe are scheduled for
22-
removal in a future release. Currently, Scala 3 uses sun.misc.Unsafe in its
23-
implementation of lazy values. This was needed due to compatibility with JDK 8.
24-
In order to support later versions of JDK we will need to drop usage of Unsafe,
25-
which is being investigated under
26-
[this issue](https://github.com/scala/scala3/issues/9013). It also started to
27-
dawn on the compiler team that we might consider stopping to support JDK 8
21+
The recent [JEP 471](https://openjdk.org/jeps/471) stated that the memory-access
22+
methods in sun.misc.Unsafe are scheduled for removal in a future release.
23+
Currently, Scala 3 uses sun.misc.Unsafe in its implementation of lazy values.
24+
This was needed due to compatibility with JDK 8. In order to support JDK 25+, we
25+
will need to drop usage of Unsafe. We are investigating the required changes
26+
under [this issue](https://github.com/scala/scala3/issues/9013). It also started
27+
to dawn on the compiler team that we might consider stopping to support JDK 8
2828
altogether in a future release of Scala 3.
2929

3030
## Long term motivation
3131

3232
Switching to a newer version of the JDK would allow both the compiler and the
3333
Scala ecosystem to start using new features and standard library improvements
34-
brought in by JDK 9+. This might include a number of JEPs, which will be
35-
investigated by the team the coming year. To check the current status take a
36-
look at the issues marked with the
34+
brought in by JDK 9+. brought in by JDK 9+. This might include a number of JEPs,
35+
which the compiler team will investigate during the coming year. To check the
36+
current status, take a look at the issues marked with the
3737
[JEP label](https://github.com/scala/scala3/issues?q=is%3Aissue+is%3Aopen+label%3Acompat%3Ajava%3Ajep).
3838

3939
Some of the features that might be interesting to the Scala community are:
4040

4141
- [JEP 181](https://github.com/scala/scala3/issues/22292) will allow classes
4242
that are logically part of the same code entity, but which are compiled to
43-
distinct class files, to access each other's private members without the need
44-
for Scala compiler to insert accessibility-broadening bridge methods. This is
45-
especially useful for nested classes or companions.
46-
- [JEP 334](https://github.com/scala/scala3/issues/22294) introduce an API to
47-
model nominal descriptions of key class-file and run-time artifacts, which can
48-
potentially help improve the internals of Scala 3 compiler.
49-
- [JEP 471](https://github.com/scala/scala3/issues/9013) which adds a new API
50-
for memory access, which can be used to replace the usage of sun.misc.Unsafe
51-
in Scala 3.
52-
53-
Another advantage would be reducing the maintenance burden on tooling and
54-
library authors that currently have to take into account a large number of
55-
different versions to test and make sure that their code is performant on all of
56-
them. Thus, the benefits of this change will be felt ecosystem-wide.
57-
58-
If we take a look at the timeline we'll see that JDK 8 was first published on
59-
18th March 2014, which is already over 10 years ago. Technology and especially
60-
JDKs have advanced greatly through that period and in order to stay competitive
61-
using those advancements is a must. A lot of the existing distributions are
62-
already stopping or will soon stop updating JDK 8 with security and other fixes,
63-
which might directly impact issues within your business applications.
43+
distinct class files, to access each other's private members. This is
44+
especially useful for nested classes or companions. Currently, the Scala
45+
compiler has to insert public bridge methods to broaden the accessibility of
46+
those members.
47+
- [JEP 409](https://github.com/scala/scala3/issues/22298) introduces sealed
48+
classes. It would allow the compiler to better represent Scala's sealed trait
49+
hierarchies.
50+
- [JEP 441](https://github.com/scala/scala3/issues/22450) introduces new
51+
bytecode shapes for pattern matching in Java. With them, we may be able to
52+
optimize the code resulting from Scala pattern matches.
53+
- [JEP 471](https://github.com/scala/scala3/issues/9013) adds a new API for
54+
memory access. We will use it to replace the usage of `sun.misc.Unsafe` in
55+
Scala 3.
56+
57+
Dropping JDK 8 will reduce the maintenance burden on tooling and library
58+
authors. They currently have to take into account a large number of different
59+
versions, both for correctness and performance. Thus, the benefits of this
60+
change will be felt ecosystem-wide.
61+
62+
JDK 8 was first published on 18th March 2014, over 10 years ago. JDKs have
63+
advanced greatly through that period. In order to stay competitive, using those
64+
advancements is a must. A lot of the existing distributions, such as
65+
[Oracle's one](https://www.oracle.com/java/technologies/java-se-support-roadmap.html),
66+
have already stopped or will soon stop updating JDK 8 with security and other
67+
fixes. Staying on JDK 8 might directly impact issues within your business
68+
applications.
6469

6570
Some larger projects within JVM and Scala ecosystems have already dropped JDK 8
66-
support. And while it's always possible to not update your libraries and Scala
67-
version, which will avoid having to switch to a newer JDK, it's highly
68-
discouraged as it will make you vulnerable to potential security risks.
71+
support in favor of JDK 11 or even 17. Some examples are:
72+
73+
- [Spark 4](https://github.com/apache/spark/pull/43005#issuecomment-1731344040)
74+
will require JDK 17
75+
- [Play Framework](https://github.com/playframework/playframework/issues/11078)
76+
requires JDK 11 and
77+
[will require JDK 17](<(https://github.com/playframework/playframework/issues/12179)>)
78+
in the next major release
79+
- [Akka](https://github.com/akka/akka/pull/32127) requires JDK 11
80+
- [Spring 6](https://spring.io/blog/2022/11/16/spring-framework-6-0-goes-ga)
81+
will require JDK 17
82+
- [Logback](https://logback.qos.ch/dependencies.html) requires JDK 11
83+
- [Apache Kafka](https://kafka.apache.org/documentation/#java) requires JDK 11
84+
- [Hibernate](https://hibernate.org/orm/releases/6.6/) requires JDK 11 and the
85+
next version will require JDK 17
86+
- [ZIO](https://github.com/zio/zio/pull/8434) requires JDK 11
87+
- [Li Haoyi's ecosystem](https://github.com/com-lihaoyi) requires JDK 11 across
88+
the board
89+
90+
It is always possible not to update your libraries and compiler version, which
91+
will avoid having to switch to a newer JDK. However, it is highly discouraged,
92+
as it will make you vulnerable to potential security risks.
6993

7094
## Plan for making the switch
7195

7296
The current plan is to drop support of JDK 8 in one of the future minor releases
73-
of Scala 3 and in the next LTS. The JDK will be either 11 or 17 depending on the
74-
community feedback and our investigations. The current estimate for the next LTS
75-
is Q4 2025.
97+
of Scala 3 and in the next LTS. The JDK will be either 11 or 17, depending on
98+
the community feedback and our investigations. The current estimate for the next
99+
LTS is Q4 2025.
76100

77-
One of the major challenges here will be making sure that we are still able to
78-
use libraries compiled with earlier JDK 8 compatible Scala 3 versions in the
79-
versions with a new implementation of lazy values, which is not reliant on
80-
sun.misc.Unsafe.
101+
One major challenge will be to preserve backward compatibility. As we change the
102+
encoding of `lazy val`s, we must still be able to use libraries compiled with
103+
earlier Scala 3 versions.
81104

82105
## How does it affect me?
83106

84-
If you are using Scala 3 on JDK 8 do let us know! However the current line of
85-
LTS under 3.3.x will be supported for at least another year after the release of
86-
the next LTS version, which should give you plenty of time to migrate.
107+
The current line of LTS under 3.3.x will be supported for at least another year
108+
after the release of the next LTS version. That should give you plenty of time
109+
to migrate. After that, no more security fixes will be available for Scala 3
110+
versions supporting JDK 8. If you are using Scala 3 on JDK 8, do let us know!
87111

88-
If it's not possible for you to switch, be sure to send us your feedback so that
89-
we can figure out a way to help you migrate.
112+
If it is not possible for you to switch, be sure to send us your feedback so
113+
that we can figure out a way to help you migrate.
90114

91115
## Discussions and further reading
92116

93117
You can track the current work related to lazy values under
94-
[this issue](https://github.com/scala/scala3/issues/9013) and discuss the topic
95-
under soon to be posted thread on the
118+
[this issue](https://github.com/scala/scala3/issues/9013). Discussions on the
119+
topic of dropping JDK 8 support will soon be available on the
96120
[Scala contributors forum](https://contributors.scala-lang.org/)

0 commit comments

Comments
 (0)