RFR: 8306914: Implement JEP 458: Launch Multi-File Source-Code Programs [v14]

Christian Stein cstein at openjdk.org
Mon Dec 4 09:09:57 UTC 2023


> Please review this change set implementing [JEP 458](https://openjdk.org/jeps/458) "Launch Multi-File Source-Code Programs" by introducing a new entry-point `SourceLauncher` in package `com.sun.tools.javac.launcher` of module `jdk.compiler`. The former `Main` entry-point is kept as-is in order to preserve (and possibly fall back to) existing behaviour of launching single-file source-code programs.
> 
> The code of the new entry-point and other new classes introduced by this pull request is based on the original implementation. It extends it to dynamically resolve required types "on-the-fly" using an in-memory class loader capable to compile Java source files - applying a strict name-based pattern as described in the JEP.
> 
> ### OpenJDK's Demo Programs
> 
> OpenJDK's demo programs can be found in the [src/demo/share/jfc](https://github.com/openjdk/jdk/tree/master/src/demo/share/jfc) directory. These multi-file source-code programs can be launched via `java ${PROGRAM}` once this implementation is integrated; with `${PROGRAM}` being one of the following files:
> 
> - [x] `src/demo/share/jfc/CodePointIM/CodePointIM.java`
> - [x] `src/demo/share/jfc/FileChooserDemo/FileChooserDemo.java`
> - [x] `src/demo/share/jfc/Font2DTest/Font2DTest.java`
> - [x] `src/demo/share/jfc/J2Ddemo/java2d/J2Ddemo.java`
> - [x] `src/demo/share/jfc/Metalworks/Metalworks.java`
> - [x] `src/demo/share/jfc/Notepad/Notepad.java`
> - [x] `src/demo/share/jfc/SampleTree/SampleTree.java`
> - [x] `src/demo/share/jfc/SwingSet2/SwingSet2.java`
> - [x] `src/demo/share/jfc/TableExample/TableExample3.java`
> - [x] `src/demo/share/jfc/TableExample/TableExample4.java`
> - [x] `src/demo/share/jfc/TransparentRuler/transparentruler/Ruler.java`
> 
> The following demo programs do not start out of the box:
> 
> - `src/demo/share/jfc/TableExample/TableExample.java` — requires a database driver on the class path
> - `src/demo/share/jfc/TableExample/TableExample2.java` —  requires a database driver on the class path
> - `src/demo/share/jfc/Stylepad/Stylepad.java` — requires `src/demo/share/jfc/Notepad/Notepad.java`

Christian Stein has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains ten commits:

 - Merge remote-tracking branch 'openjdk/master' into JDK-8306914-javac-multi-file-launcher
   
   # Conflicts:
   #	test/langtools/tools/javac/launcher/GetResourceTest.java
   #	test/langtools/tools/javac/launcher/src/p/q/CLTest.java
 - Update tests, again
 - Update test/langtools/tools/javac/launcher/src/p/q/CLTest.java
   
   Co-authored-by: Jan Lahoda <51319204+lahodaj at users.noreply.github.com>
 - Update tests
 - Delete superseded single-file launcher
 - Address review comments
 - Lower number of composed gatherers
   
   Prevent stack overflows on 32-bit machines
 - Update test for implicit classes
   
   Preview notes normally emitted by `javac` are
   suppressed now, as they contain hints that
   does not apply to the source launcher and will
   lead to errors. For example: `-Xlint:preview`
 - 8306914: Launch Multi-File Source-Code Programs

-------------

Changes: https://git.openjdk.org/jdk/pull/13712/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=13712&range=13
  Stats: 3364 lines in 27 files changed: 2504 ins; 841 del; 19 mod
  Patch: https://git.openjdk.org/jdk/pull/13712.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/13712/head:pull/13712

PR: https://git.openjdk.org/jdk/pull/13712


More information about the compiler-dev mailing list