RFR: 8231640: (prop) Canonical property storage [v7]

Alan Bateman Alan.Bateman at oracle.com
Fri Sep 10 07:42:36 UTC 2021


On 10/09/2021 08:01, Robert Scholte wrote:
> Looking at the discussion I see a fear of extending the Properties 
> API, where every solution comes with its own little ugliness.
>
> There's one topic that hasn't been mentioned yet: is Properties 
> responsible for writing its own content?
> While breaking up the JDK into modules, an weird thing was exposed: 
> storeToXML, which would need a dependency on java.xml but java.base 
> does not.
>
> Should there be a new class for writing Properties, where we have the 
> control for specifying a new clean API?

Properties is a Map so anyone can write the mappings out in any format 
they want. The properties format that the store methods are specified to 
write involve escaping characters that aren't in Latin-1 so a bit 
tricky, but not impossible. The storeToXML method is unfortunate but we 
have an implementation in java.base so all good.

A number of us discussed this topic yesterday and converged on change 
the existing store methods to have a standard property to configure the 
timestamp. Separately, we can explore a 1-arg store method that does not 
write any comments. There is more on the PR on this.

-Alan


More information about the core-libs-dev mailing list