RFR: 8231640: (prop) Canonical property storage [v14]
Jaikiran Pai
jpai at openjdk.java.net
Tue Sep 14 13:28:16 UTC 2021
On Tue, 14 Sep 2021 13:17:42 GMT, Daniel Fuchs <dfuchs at openjdk.org> wrote:
>> Jaikiran Pai has updated the pull request incrementally with two additional commits since the last revision:
>>
>> - Add a @implNote to specify the order in which the properties are written out
>> - update the javadoc to clarify how line terminator characters are handled in the value of the java.util.Properties.storeDate system property
>
> src/java.base/share/classes/java/util/Properties.java line 822:
>
>> 820: * {@link System#lineSeparator() line separator} and if the next
>> 821: * character in comments is not character {@code #} or character {@code !} then
>> 822: * an ASCII {@code #} is written out after that line separator.
>
> Should something be done for comments ending with \ (backslash) ? It might otherwise suppress the first property assignment that follows.
There has been no change in how we deal with this aspect. The existing specification (stated in the `load` method) says:
> * Properties are processed in terms of lines. There are two
> * kinds of line, <i>natural lines</i> and <i>logical lines</i>.
> * A natural line is defined as a line of
> * characters that is terminated either by a set of line terminator
> * characters ({@code \n} or {@code \r} or {@code \r\n})
> * or by the end of the stream. A natural line may be either a blank line,
> * a comment line, or hold all or some of a key-element pair. A logical
> * line holds all the data of a key-element pair, which may be spread
> * out across several adjacent natural lines by escaping
> * the line terminator sequence with a backslash character
> * {@code }. **Note that a comment line cannot be extended
> * in this manner;**
(emphasis on that last sentence).
I'll anyway go ahead and add new tests around this to be sure that this works as advertised.
-------------
PR: https://git.openjdk.java.net/jdk/pull/5372
More information about the core-libs-dev
mailing list