Summary
It is proposed to finalise the Compact Source Files and Instance Main Methods JEP in JDK 25.
This JEP contains the following improvements to the fourth preview version that appeared in JDK 24:
- The new
IO
class to be moved from thejava.io
package to thejava.lang
package. - Change the implementation of the
IO
class so that printing and reading are based onSystem.out
andSystem.in
, respectively. (In the JDK 24 preview, the methods of theIO
class were thin wrappers around their equivalents in theConsole
class.) - Compact source files to no longer implicitly import the
static
methods from theIO
class.
Problem
The current experience with the previous rounds of the Compact Source Files and Instance Main Methods feature suggest the feature can be finalized.
Solution
The Compact Source Files and Instance Main Methods feature, along with the new class java.lang.IO
will finalise in JDK 25. Other than the improvements listed above, there are no changes from the fourth preview.
Specification
Draft specification documents are attached here.
Preliminary specdiff is attached as specdiff.preliminary.00.zip, and is also available for convenience here: https://cr.openjdk.org/~jlahoda/8344706/specdiff.preliminary.00/overview-summary.html
The --enable-preview
flag will no longer be required to at compile or run time to use the Compact Source Files, Instance Main Methods or java.lang.IO
.
- csr of
-
JDK-8344706 Compiler Implementation of Compact Source Files and Instance Main Methods
-
- Open
-
- relates to
-
JDK-8319044 CSR JEP 463: Core Reflection API changes for Implicitly Declared Classes (Second Preview)
-
- Closed
-
-
JDK-8329606 Implement Implicitly Declared Classes and Instance Main Methods (Third Preview)
-
- Closed
-
-
JDK-8341725 Implement Simple Source Files and Instance Main Methods (Fourth Preview)
-
- Closed
-
-
JDK-8342937 Enhance java.io.IO with parameter-less println() and readln()
-
- Closed
-