@@ -7,16 +7,15 @@ by: Tomasz Godzik
7
7
8
8
** TLDR;**
9
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
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.
13
12
14
13
## Intro
15
14
16
15
For the compiler’s second LTS version, the Scala 3 compiler team will be
17
16
dropping support for JDK 8 and is considering which later JDK to use.
18
17
19
- ## Reasons for the change
18
+ ## Immediate motivation
20
19
21
20
One of the main reasons is that recent [ JEP 471] ( https://openjdk.org/jeps/471 )
22
21
stated that the memory-access methods in sun.misc.Unsafe are scheduled for
@@ -28,18 +27,33 @@ which is being investigated under
28
27
dawn on the compiler team that we might consider stopping to support JDK 8
29
28
altogether in a future release of Scala 3.
30
29
31
- ## Advantages
30
+ ## Long term motivation
32
31
33
32
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
33
+ 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
37
37
[ JEP label] ( https://github.com/scala/scala3/issues?q=is%3Aissue+is%3Aopen+label%3Acompat%3Ajava%3Ajep ) .
38
38
39
+ Some of the features that might be interesting to the Scala community are:
40
+
41
+ - [ JEP 181] ( https://github.com/scala/scala3/issues/22292 ) will allow classes
42
+ 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
+
39
53
Another advantage would be reducing the maintenance burden on tooling and
40
54
library authors that currently have to take into account a large number of
41
55
different versions to test and make sure that their code is performant on all of
42
- them.
56
+ them. Thus, the benefits of this change will be felt ecosystem-wide.
43
57
44
58
If we take a look at the timeline we'll see that JDK 8 was first published on
45
59
18th March 2014, which is already over 10 years ago. Technology and especially
@@ -71,10 +85,10 @@ If you are using Scala 3 on JDK 8 do let us know! However the current line of
71
85
LTS under 3.3.x will be supported for at least another year after the release of
72
86
the next LTS version, which should give you plenty of time to migrate.
73
87
74
- If at any point it turns out it 's not possible for you to switch, be sure to
75
- send us your feedback .
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 .
76
90
77
- ## Summary
91
+ ## Discussions and further reading
78
92
79
93
You can track the current work related to lazy values under
80
94
[ this issue] ( https://github.com/scala/scala3/issues/9013 ) and discuss the topic
0 commit comments