RFR: JDK-8328339: Static import prevents source launcher from finding class with main method [v4]
Jan Lahoda
jlahoda at openjdk.org
Thu Mar 21 16:58:24 UTC 2024
On Tue, 19 Mar 2024 18:36:43 GMT, Christian Stein <cstein at openjdk.org> wrote:
>> 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 one additional commit since the last revision:
>
> Streamline program descriptor factory
Looks sensible.
-------------
Marked as reviewed by jlahoda (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/18345#pullrequestreview-1952825965
More information about the compiler-dev
mailing list