RFR: 8344708: Compiler Implementation of Module Import Declarations [v7]
Jan Lahoda
jlahoda at openjdk.org
Tue Apr 29 12:34:00 UTC 2025
On Tue, 29 Apr 2025 10:13:39 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:
>> src/jdk.jshell/share/classes/jdk/internal/jshell/tool/Startup.java line 345:
>>
>>> 343: boolean hasModuleImports = source == null ||
>>> 344: Feature.MODULE_IMPORTS.allowedInSource(source);
>>> 345: int idx = preview ? 2 : !hasModuleImports ? 1 : 0;
>>
>> It feels like this would be cleaner with an if/else if/else? I'm also not a big fan of hardcoded constants into an array. Maybe this code can benefit from stable values (when they are integrated).
>
> (in the interim, maybe using an enum with the possible values, instead of indices, and then turning `defaultStartup` into an EnumMap might make the code slightly clearer?)
Thanks for the comments, attempted to fix here:
https://github.com/openjdk/jdk/pull/23801/commits/4f9575564c3761b251288c3dec0132cbe0a16139
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/23801#discussion_r2066219206
More information about the compiler-dev
mailing list