On Tue, 18 Aug 2026 16:30:53 GMT, Sean Mullan <[email protected]> wrote:

>> Properties.load/save is read/write and doesn't support round trip. The 
>> semantics here is a transformation that retains the comments and whitespace, 
>> allowing inline replace of values. It would requite significant refactor to 
>> provide this via a jdk.internal package exported to jdk.jlink. Not opposed 
>> to this but I think first explore if there a generally useful API for 
>> Properties to expose to allow programs do these types of transformations.
>> 
>> As regards the processProperties loop then I think it will need to handle 
>> the 3 possible separators.
>
> My intention was to focus on supporting the syntax that is currently used in 
> the JDK `java.security` file. Alan correctly notes that the semantics of this 
> use case is quite different than what the current `Properties` API supports, 
> so it is not as simple as just reusing and making the 
> `java.util.Properties::load0` method more accessible. I'm not inclined to 
> significantly increase the scope of this enhancement.
> 
> So I think it makes sense to add support for additional separators and 
> document any other differences. If any of these become critical parsing 
> issues later, we can always consider adding support for them at that time.

I've added support for these delimeters (':', '=', whitespace). I added support 
for comments beginning with '!' or '#' and blank lines containing just 
whitespace. I think this brings it closer to the syntax specified by 
`java.util.Properties.load(Reader)`. I'll go over it again, and document any 
differences in the next round of changes.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/31884#discussion_r3847268887

Reply via email to