RFR: 8298943: Missing escapes for single quote marks in compiler.properties [v4]

Jonathan Gibbons jjg at openjdk.org
Mon Dec 19 18:09:53 UTC 2022


On Mon, 19 Dec 2022 15:44:25 GMT, Archie L. Cobbs <duke at openjdk.org> wrote:

>> The source file `compiler.properties` contains the English message bundle for compiler warnings, errors, etc.
>> 
>> Since the strings in this file are format strings, any single quotes must be escaped by doubling them.
>> 
>> An example of a properly encoded entry is:
>> 
>> 
>> compiler.err.cant.assign.val.to.this=\
>>     cannot assign to ''this''
>> 
>> 
>> There are three entries that appear to be not escaped when they should be.
>
> Archie L. Cobbs has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains four additional commits since the last revision:
> 
>  - Merge branch 'master' into JDK-8298943
>  - Allow quoting of ',' characters.
>  - Add syntax checking of MessageFormat patterns in resouce bundles.
>  - Add missing escapes for single quotes.

Thanks for adding in the check.

At some point (not here and now in this review) we should maybe try and merge this with the copy-pasted version for javadoc, also called CheckResourceKeys.

test/langtools/tools/javac/diags/CheckResourceKeys.java line 345:

> 343:      * <p>
> 344:      * This checks for balanced braces and unnecessary quoting.
> 345:      * Code cut, pasted, & simplified from {@link java.text.MessageFormat#applyPattern}.

I'm guessing you copied it, not cut it .... :-)

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

Marked as reviewed by jjg (Reviewer).

PR: https://git.openjdk.org/jdk/pull/11712


More information about the compiler-dev mailing list