<i18n dev> RFR: 8314483: Optionally override copyright header in generated source [v2]

Erik Joelsson erikj at openjdk.org
Thu Aug 24 17:40:28 UTC 2023


On Thu, 24 Aug 2023 04:46:31 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> Erik Joelsson has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Suggestion from dholmes
>
> make/jdk/src/classes/build/tools/generatelsrequivmaps/EquivMapsGenerator.java line 62:
> 
>> 60:                     StandardCharsets.UTF_8);
>> 61:             i++;
>> 62:         } else if (args.length != 3) {
> 
> This is not very robust for detecting malformed invocations. It won't even detect a simple typo in the argument name. I would suggest something more elaborate e.g.
> 
> int i  0;
> boolean valid = true;
> if (args.length != 5 && args.length !=3) {
>   valid = false;
> } else if (args.length == 5) {
>   if ( ! "-jdk-header-template".equals(args[i])) {
>     valid = false;
>   } else {
>     jdkHeaderTemplate = new String(Files.readAllBytes(Paths.get(args[++i])),
>                     StandardCharsets.UTF_8);
>      i++;
>   }
> }
> if (!valid) {
>   System.err.println(...);
>    System.exit(1);
> }
> String lsrFile = args[i++];
> ...

I think it actually will, but your suggestion is clearer to read, so I have applied it.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/15346#discussion_r1304664443


More information about the i18n-dev mailing list