RFR: 8325558: Add jcheck whitespace checking for properties files
Magnus Ihse Bursie
ihse at openjdk.org
Fri Feb 9 13:55:09 UTC 2024
On Fri, 9 Feb 2024 13:35:55 GMT, Magnus Ihse Bursie <ihse at openjdk.org> wrote:
> This is an attempt to finally implement the idea brought forward in JDK-8295729: 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 or leading tabs instead of spaces.
>
> With Skara jcheck, it is possible to increase the coverage of the whitespace checks.
>
> However, this turned out to be problematic, since trailing whitespace is significant in properties files. That issue has mostly been sorted out in a series of PRs, and this patch will finish the job with the few remaining files, and actually enable the check in jcheck.
src/java.base/unix/classes/sun/net/www/content-types.properties line 1:
> 1: #sun.net.www MIME content-types table
I have converted all leading tabs to 8 spaces.
src/java.base/windows/classes/sun/net/www/content-types.properties line 1:
> 1: #sun.net.www MIME content-types table
I have converted all leading tabs to 8 spaces.
src/java.desktop/share/classes/com/sun/imageio/plugins/common/iio-plugin.properties line 11:
> 9: ImageUtil0=The supplied Raster does not represent a binary data set.
> 10: ImageUtil1=The provided sample model is null.
> 11: ImageUtil2=The provided image cannot be encoded using:
While it seems like this could have been significant, the code that uses it looks like this:
throw new IIOException(I18N.getString("ImageUtil2")+" "+
writer.getClass().getName());
so it will end up with a double space right now.
src/java.scripting/share/classes/com/sun/tools/script/shell/messages.properties line 1:
> 1: #
I have converted all leading tabs to 8 spaces.
src/java.sql.rowset/share/classes/com/sun/rowset/RowSetResourceBundle.properties line 73:
> 71: cachedrowsetimpl.numrows = Number of rows is less than zero or less than fetch size
> 72: cachedrowsetimpl.startpos = Start position cannot be negative
> 73: cachedrowsetimpl.nextpage = Populate data before calling
This sounded like it could potentially be followed by a name, but this is not the case.
src/java.sql.rowset/share/classes/com/sun/rowset/RowSetResourceBundle.properties line 128:
> 126: crswriter.params1 = Value of params1 : {0}
> 127: crswriter.params2 = Value of params2 : {0}
> 128: crswriter.conflictsno = conflicts while synchronizing
This sounded like it could potentially be followed by a string, but this is not the case.
src/java.sql.rowset/share/classes/com/sun/rowset/RowSetResourceBundle_de.properties line 1:
> 1: #
The changes in this and the following files are just to align the file with the English master copy.
src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/msg/DOMMessages.properties line 24:
> 22:
> 23: BadMessageKey = The error message corresponding to the message key can not be found.
> 24: FormatFailed = An internal error occurred while formatting the following message:\n
At first glance, it might look like something should follow the `:`, but note that there is a `\n` so if anything this will only make the next line improperly indented.
src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/msg/DOMMessages_de.properties line 1:
> 1: #
The changes in this and the following files are just to align the file with the English master copy.
src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/msg/SAXMessages_de.properties line 1:
> 1: #
The changes in this and the following files are just to align the file with the English master copy.
src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/msg/XIncludeMessages.properties line 20:
> 18: # Messages for message reporting
> 19: BadMessageKey = The error message corresponding to the message key can not be found.
> 20: FormatFailed = An internal error occurred while formatting the following message:\n
At first glance, it might look like something should follow the :, but note that there is a \n so if anything this will only make the next line improperly indented.
src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/msg/XIncludeMessages_de.properties line 1:
> 1: #
The changes in this and the following files are just to align the file with the English master copy.
src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/msg/XMLMessages.properties line 27:
> 25:
> 26: BadMessageKey = The error message corresponding to the message key can not be found.
> 27: FormatFailed = An internal error occurred while formatting the following message:\n
Same here with `:\n`...
src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/msg/XPointerMessages.properties line 24:
> 22: # Messages for message reporting
> 23: BadMessageKey = The error message corresponding to the message key can not be found.
> 24: FormatFailed = An internal error occurred while formatting the following message:\n
Same here with `:\n`...
src/jdk.compiler/share/classes/sun/tools/serialver/resources/serialver.properties line 1:
> 1: #
I have converted all leading tabs to 8 spaces.
src/jdk.jartool/share/classes/sun/tools/jar/resources/jar.properties line 49:
> 47: 'u' flag requires manifest, 'e' flag or input files to be specified!
> 48: error.bad.eflag=\
> 49: 'e' flag and manifest with the 'Main-Class' attribute cannot be specified \n\
Here were two lines that used tab instead of space; I converted them to 8 spaces.
test/jaxp/javax/xml/jaxp/unittest/common/config/files/catalog2.properties line 4:
> 2: # XML Library (java.xml) Configuration File
> 3: #
> 4: # This file is in java.util.Properties format and typically located in the conf
These spaces at the end of comment lines has crept in since I cleaned all such out in [JDK-8298047](https://bugs.openjdk.org/browse/JDK-8298047). It's a good example of why we need the jcheck verification to keep this from regressing once more.
test/jdk/sanity/client/lib/SwingSet3/src/com/sun/swingset3/demos/table/resources/TableDemo.properties line 12:
> 10:
> 11: TableDemo.noDataStatusLabel=No data loaded
> 12: TableDemo.loadingStatusLabel=Loading data:\u0020
According to https://github.com/openjdk/jdk/pull/11488/files#r1038605801 the latter two are actually needed as spaces, and the first might be; so keeping it as well seems to be the safe choice.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/17789#discussion_r1484326435
PR Review Comment: https://git.openjdk.org/jdk/pull/17789#discussion_r1484326568
PR Review Comment: https://git.openjdk.org/jdk/pull/17789#discussion_r1484327614
PR Review Comment: https://git.openjdk.org/jdk/pull/17789#discussion_r1484327859
PR Review Comment: https://git.openjdk.org/jdk/pull/17789#discussion_r1484329632
PR Review Comment: https://git.openjdk.org/jdk/pull/17789#discussion_r1484329770
PR Review Comment: https://git.openjdk.org/jdk/pull/17789#discussion_r1484330650
PR Review Comment: https://git.openjdk.org/jdk/pull/17789#discussion_r1484332081
PR Review Comment: https://git.openjdk.org/jdk/pull/17789#discussion_r1484332649
PR Review Comment: https://git.openjdk.org/jdk/pull/17789#discussion_r1484334629
PR Review Comment: https://git.openjdk.org/jdk/pull/17789#discussion_r1484334259
PR Review Comment: https://git.openjdk.org/jdk/pull/17789#discussion_r1484335061
PR Review Comment: https://git.openjdk.org/jdk/pull/17789#discussion_r1484335669
PR Review Comment: https://git.openjdk.org/jdk/pull/17789#discussion_r1484337306
PR Review Comment: https://git.openjdk.org/jdk/pull/17789#discussion_r1484338418
PR Review Comment: https://git.openjdk.org/jdk/pull/17789#discussion_r1484339114
PR Review Comment: https://git.openjdk.org/jdk/pull/17789#discussion_r1484341847
PR Review Comment: https://git.openjdk.org/jdk/pull/17789#discussion_r1484345466
More information about the core-libs-dev
mailing list