J2SE API: Missing/broken functionality?

Ah, but you’re missing the point that the Properties is designed for storing Strings. I guess it’s evolved out of system properties in the form of environment variables. The only real difference between Properties and the superclass Hashtable is a few convenience methods (which rely on all keys/values being Strings) and read/write methods.

Considering there’s no obvious conversion between a String and an Object, if you want to move arbitrary data to/from a filesystem, I expect what you really want is a serialized HashMap<Object, Object>.

And yes, Properties aren’t safe to allow anyone else to access - if you pass the reference to any external code you have to assume it’s compromised. If they use the Hashtable’s put(Object, Object) method on it, you’ll likely experience a fatal error at some point in the future. Maybe you’ll be accessing data you put in before, maybe you’ll be trying to save the properties to a file. Bang. Nice.

[quote]Ah, I spotted that Properties was completely fscked from a design POV years ago,

[snip]

The main one we use these days is a tree-structured TreeProperties that is able to encapsulate child elements in the obvious manner - IMHO only a very inexperienced programmer would have thought that it was safe to have a flat-file properties system. It converts into standard Properties format using a codec, the main one being the obvious
[/quote]
You too, huh? ;D

Many years ago, around 1998 or so, I had one of my developers build a complete replacement properties system along the lines similar to yours. Since we’d all come from X11 programming, we build a class system that mimiced the X11 wildcarding system so that we could use it to control every aspect of our application display (a small project involving about 300 different windows, about a few million lines of code). I’m sure I’ve still got the code around here somewhere if people are interested in having a look at what we did. It performed pretty well then, back in the interpreted VM days. I reckon it would absolutely fly now.