Code Review Request for 6578042

Alan Bateman Alan.Bateman at
Sat Nov 12 12:14:38 UTC 2011

On 11/11/2011 19:37, Darryl Mocek wrote:
> Returning null if the value is not a String gives the impression that 
> there was no property with that key when the property may have been 
> there and may in fact have been removed. 
That's a fair point and probably enough to conclude that this approach 
should be dismissed.

The toString approach is inconsistent so I think this brings us back to 
the original suggestion which is to specify that CCE is thrown (as it 
always has) but without side effects (meaning it doesn't remove the 
property). I think this is the best we can do with this broken API.

> I would prefer it if Properties didn't allow non-String keys and 
> values at all since they're supposed to be Strings (by API 
> implication) and that Properties not extend Hashtable or extends 
> Hashtable<String, String>, but I digress.
Properties goes back to JDK1.0 and has a warning in its javadoc for many 
years to discourage inserting keys or values that are not Strings. I'm 
not sure whether we can do much about it now without risking 
compatibility issues.


More information about the core-libs-dev mailing list