JDK-8353437 : Implement JEP 512: Compact Source Files and Instance Main Methods
  • Type: CSR
  • Component: tools
  • Sub-Component: javac
  • Priority: P4
  • Status: Closed
  • Resolution: Approved
  • Fix Versions: 25
  • Submitted: 2025-04-01
  • Updated: 2025-05-05
  • Resolved: 2025-05-01
Related Reports
CSR :  
Relates :  
Relates :  
Relates :  
Relates :  
Description
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 the `java.io` package to the `java.lang` package.
- Change the implementation of the `IO` class so that printing and reading are based on `System.out` and `System.in`, respectively. (In the JDK 24 preview, the methods of the `IO` class were thin wrappers around their equivalents in the `Console` class.)
- Compact source files to no longer implicitly import the `static` methods from the `IO` 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.

The API specdiff is attached as specdiff.00.zip, and is also available for convenience here:
https://cr.openjdk.org/~jlahoda/8344706/specdiff.00/overview-summary.html

The `--enable-preview` flag will no longer be required at compile or run time to use the Compact Source Files, Instance Main Methods or `java.lang.IO`.


Comments
Moving to Approved.
01-05-2025

Removal of (preview) java.io.IO and addition of java.lang.IO look OK.
29-04-2025

Moving to Provisional, not Approved. From a paperwork perspective, are the API changes going to be done under this same bug/CSR or a different one? If it is this one, the "Interface Kind" section should be updated to indicate an API is involved.
11-04-2025