RFR: 8298044: Fix hidden but significant trailing whitespace in properties files for langtools code
Justin Lu
jlu at openjdk.org
Tue Feb 6 18:43:01 UTC 2024
On Tue, 6 Feb 2024 16:24:53 GMT, Magnus Ihse Bursie <ihse at openjdk.org> wrote:
>> According to [the specification](https://docs.oracle.com/en/java/javase/19/docs/api/java.base/java/util/Properties.html#load(java.io.Reader)) trailing whitespaces in the values of properties files are (somewhat surprisingly) actually significant.
>>
>> We have multiple files in the JDK with trailing whitespaces in the values. For most of this files, this is likely incorrect and due to oversight, but in a few cases it might actually be intended (like "The value is: ").
>>
>> After a discussion in the PR for [JDK-8295729](https://bugs.openjdk.org/browse/JDK-8295729), the consensus was to replace valid trailing spaces with the corresponding unicode sequence, `\u0020`. (And of course remove non-wanted trailing spaces.)
>>
>> Doing so has a dual benefit:
>>
>> 1) It makes it clear to everyone reading the code that there is a trailing space and it is intended
>>
>> 2) It will allow us to remove all actual trailing space characters, and turn on the corresponding check in jcheck to keep the properties files, just like all other source code files, free of trailing spaces.
>>
>> Ultimately, the call of whether a trailing space is supposed to be there, or is a bug, lies with the respective component teams owning these files. Thus I have split up the set of properties files with trailing spaces in several groups, to match the JDK teams, and open a JBS issue for each of them. This issue is for code I believe belongs with the langtools team.
>
> For the record, when I tried to revive this, it turned out that all changes proposed here were already implemented in master.
Hi @magicus, the trailing white space in all .properties files between the localized and un-localized versions was standardized in [8300719](https://bugs.openjdk.org/browse/JDK-8300719) as part of the L10n translations. The changes there likely included the proposed changes here as well.
For context, there was no removal of questionable trailing white space, only the standardization that the localized versions matched the original version. And similar to this patch, `/u0020` was used in replacement of ` `. We usually see that the external translation tool causes inconsistency in trailing white space, so we re-run our white space tool during each L10n translation drop.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/11487#issuecomment-1930543225
More information about the compiler-dev
mailing list