RFR: 8266666: Implementation for snippets [v23]
Pavel Rappo
prappo at openjdk.java.net
Wed Sep 15 13:39:56 UTC 2021
On Mon, 13 Sep 2021 18:59:48 GMT, Jonathan Gibbons <jjg at openjdk.org> wrote:
>> 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);
> 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.
You are completely right. In fact, I was going to internationalize those messages initially in this PR, but then decided to postpone it until the https://bugs.openjdk.java.net/browse/JDK-8273544 follow-up bug. I removed the respective FIXMEs in one of the updates either to this PR or the originating sandbox branch.
One reason I was postponing internationalization is that I was sure neither about the wording nor about the granularity of the messages. But I guess, it's not that big a deal to amend either of those later.
-------------
PR: https://git.openjdk.java.net/jdk/pull/4795
More information about the compiler-dev
mailing list