RFR: JDK-8328339: Static import prevents source launcher from finding class with main method [v2]

Christian Stein cstein at openjdk.org
Thu Mar 21 12:31:23 UTC 2024


On Mon, 18 Mar 2024 17:40:15 GMT, Jan Lahoda <jlahoda at openjdk.org> wrote:

>> Christian Stein has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Ensure source-order of declared types in program source file
>>   
>>   Move computation of declared types into program descriptor factory.
>
> src/jdk.compiler/share/classes/com/sun/tools/javac/launcher/ProgramDescriptor.java line 66:
> 
>> 64:             var task = compiler.getTask(null, standardFileManager, diagnostic -> {}, null, null, units);
>> 65:             for (var tree : task.parse()) {
>> 66:                 for (var decl : tree.getTypeDecls()) {
> 
> Not terribly important, but you could first compute the package name, and then compute the declared types. That would permit creating the fully qualified `declaredTypeNames` in one step, rather than putting the simple names into a List and then going through them again to qualify them.

Refactored as suggested.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/18345#discussion_r1533813680


More information about the compiler-dev mailing list