RFR: JDK-8328339: Static import prevents source launcher from finding class with main method [v3]
Christian Stein
cstein at openjdk.org
Tue Mar 19 16:37:36 UTC 2024
> Please review this fix for finding the program class in case the first top-level type has no main method and the order of type compilation does not match the order in the source file - for example by a static import statement being present.
>
> Here's an excerpt from [JEP 458](https://openjdk.org/jeps/458#Launch-time-semantics-and-operation)'s "Launch-time semantics and operation" section describing the process:
>> 5. Determine the launch class of the initial .java file. If the first top level class in the initial file declares a standard main method (`public static void main(String[])` or other standard main entry points as defined in [JEP 463](https://openjdk.org/jeps/463#A-flexible-launch-protocol)), then that class is the launch class. Otherwise, if another top level class in the initial file declares a standard main method and has same name as the file, that class is the launch class. Otherwise, there is no launch class, and the launcher reports an error and stops.
Christian Stein has updated the pull request incrementally with three additional commits since the last revision:
- Update src/jdk.compiler/share/classes/com/sun/tools/javac/launcher/SourceLauncher.java
Co-authored-by: Jan Lahoda <51319204+lahodaj at users.noreply.github.com>
- Update src/jdk.compiler/share/classes/com/sun/tools/javac/launcher/ProgramDescriptor.java
Co-authored-by: Jan Lahoda <51319204+lahodaj at users.noreply.github.com>
- Update src/jdk.compiler/share/classes/com/sun/tools/javac/launcher/MemoryContext.java
Co-authored-by: Jan Lahoda <51319204+lahodaj at users.noreply.github.com>
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/18345/files
- new: https://git.openjdk.org/jdk/pull/18345/files/65fba8d6..47b851ab
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=18345&range=02
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=18345&range=01-02
Stats: 3 lines in 3 files changed: 0 ins; 0 del; 3 mod
Patch: https://git.openjdk.org/jdk/pull/18345.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/18345/head:pull/18345
PR: https://git.openjdk.org/jdk/pull/18345
More information about the compiler-dev
mailing list