RFR: 8266666: Implementation for snippets [v23]

Jonathan Gibbons jjg at openjdk.java.net
Mon Sep 13 19:02:59 UTC 2021

On Mon, 13 Sep 2021 18:34:59 GMT, Jonathan Gibbons <jjg at openjdk.org> wrote:

>> Pavel Rappo has updated the pull request incrementally with one additional commit since the last revision:
>>   Remove trailing whitespace to satisfy jcheck
> src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/snippet/ParseException.java line 50:
>> 48:      * @param position the approximate position
>> 49:      */
>> 50:     public ParseException(String message, int position) {
> I know it is common to use English-only strings in exceptions that are not intended to be seen in normal use by an end user, but here, you're using `ParseException` to contain content that is intended to appear in end-user error messages, triggered by errors in the content provided by an end-user.   As such, it is close to a firm requirement that these messages can be localized.

One possible solution at this time that would be minimally invasive would be to replace `new ParseException(String message, int pos)` with use of a method that localizes the string first, as in,

ParseException newParseException(int pos, String resourceKey, Object... args)

so the code becomes something like

   throw newParseException(pos, key, args);


PR: https://git.openjdk.java.net/jdk/pull/4795

More information about the compiler-dev mailing list