On Fri, 13 Nov 2026 00:23:53 GMT, Brent Christian <[email protected]> wrote:

> > > I don't think we should go as far as to codify the current implementation 
> > > of `load()`
> > 
> > 
> > Isn't that what this PR does?
> 
> We are specifying how the method behaves, ("load() replaces values for keys 
> already in the Properties"). 

I believe `codify` encompasses "specify how the method behaves".

> It would have been better (back in JDK 1.0, or whenever) to describe what 
> `setProperty()` does, without including this implementation detail 

Perhaps inclusion of this detail  was intended so key/value pairs could be 
examined as they were added to the properties list. Of course it would have 
been better to be explicit about this feature, but generally the behavior is 
specified and the programmer uses that info as he/she see fit.

> I would not generally recommend relying on the implementation

Actually, I was relying on the spec, which says `put()` is used. The load spec 
doesn't say anything different, it's reasonable to assume put() is used for 
that as well.

You might want to look at the 3rd paragraph of the class description for 
cleanup, but I guess it's still accurate. Those methods can be used as 
described, even though they delegate to a different type of map structure.

> calling a particular overridable method as a way to customize behavior, e.g. 
> to add verification. (An exception would be cases where such support is 
> specifically called out.)

By saying that `put()` is used, it is being called out; no one should be 
surprised if it is used. I wouldn't expect the javadoc to specify all the 
various ways that it might be used.

> 
> Today, an overridden `put()` happens to be called by `load()`, but a future 
> version may not work that way. And FWIW, `Properties.put()` is not called by 
> `Properties.putAll()`.

It was with the Hashtable implementation. I guess that was broken with the JDK9 
implementation; and/or the javadoc wasn't updated. Depending on how you want to 
look at it.

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

PR Comment: https://git.openjdk.org/jdk/pull/33638#issuecomment-6841816777

Reply via email to