On Tue, 25 Jul 2023 21:01:03 GMT, Mandy Chung <[email protected]> wrote:
>> Sean Coffey has updated the pull request incrementally with two additional
>> commits since the last revision:
>>
>> - Incorporate review feedback
>> - modify -X output for :all
>
> src/java.base/share/classes/sun/launcher/LauncherHelper.java line 191:
>
>> 189:
>> 190: // case-sensitive check of input flag
>> 191: List<String> validOpts = Arrays.stream(Option.values())
>
> The logic can be simplified by building a map of option name to `Option`.
>
>
> Map<String, Option> validOpts = Arrays.stream(Option.values())
> .filter(o -> !o.equals(Option.EMPTY)) // non-valid option
> .collect(Collectors.toMap(o -> o.name()
> .toLowerCase(Locale.ROOT)
> .replace("_", ":"),
> Function.identity()));
>
> String optStr = optionFlag.substring("-XshowSettings:".length());
> Option component = validOpts.get(optStr);
> if (component == null) {
> abort(null, "java.launcher.bad.option", optStr);
> }
> return component;
good suggestion Mandy! Incorporated this with latest changes.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/15001#discussion_r1274649094