RFR: 8295729: Add jcheck whitespace checking for properties files
Magnus Ihse Bursie
ihse at openjdk.org
Thu Oct 20 18:48:17 UTC 2022
On Thu, 20 Oct 2022 18:38:43 GMT, Andy Goryachev <angorya at openjdk.org> wrote:
>> Properties files is essentially source code. It should have the same whitespace checks as all other source code, so we don't get spurious trailing whitespace changes.
>>
>> With the new Skara jcheck, it is possible to increase the coverage of the whitespace checks (in the old mercurial version, this was more or less impossible).
>>
>> The only manual change is to `.jcheck/conf`. All other changes were made by running `find . -type f -iname "*.properties" | xargs gsed -i -e 's/[ \t]*$//'`.
>
> I would vote against this change. Per java properties spec
> https://github.com/openjdk/jdk/pull/10792
>
>
> White space following the property value is not ignored, and is treated as part of the property value.
>
>
> This change might break localization or messages where trailing whitespace is important (example: "Label: ")
>
> edit: sorry, the link above is not a spec. looking at the Properties.load(Reader) javadoc:
> https://docs.oracle.com/javase/10/docs/api/java/util/Properties.html#load(java.io.Reader)
>
>
> Any white space after the key is skipped; if the first non-white space character after the key is '=' or ':', then it is ignored and any white space characters after it are also skipped. All remaining characters on the line become part of the associated element string;
@andy-goryachev-oracle Oh, I did not know that. Is this really how it is implemented, or is there a discrepancy between the spec and the implementation? The haphazard placement of trailing spaces seems to indicate that they are ignored.
-------------
PR: https://git.openjdk.org/jdk/pull/10792
More information about the build-dev
mailing list