On Wed, 4 Nov 2026 19:54:52 GMT, Brent Christian <[email protected]> wrote:
> > Duplicate `key` detection, or `key`/`value` validation, with `Properties` > > is possible by overriding the `put` method. Could that be explicitly > > specified? > > I don't think we should go as far as to codify the current implementation of > `load()` Isn't that what this PR does? > (for instance by stating something like, "the `put()` method is called for > each load()ed key/element pair."). Note javadoc currently says `setProperty(String key, String value) Calls the Hashtable method put.` Adding "the `put()` method is called for each load()ed key/element pair." corrects an inconsistency with `setProperty` and reveals the path for validation. Documenting that `put()` is used, and not mentioning using it for validation and/or dup detection would be good enough, but pointing out how it could be used seems better. Having load invoke `setProperty()`, and documenting that, is another approach. > > Overriding `put()` for performing validation and/or dup detection may happen > to work at present, but I would not consider it future-proof. ------------- PR Comment: https://git.openjdk.org/jdk/pull/33638#issuecomment-6644291569
