Zemian, If the subclass used different parameter types, it wouldn't override the method. This goes back to the pre Java 5 days. When generics were introduced, they tried to keep backward compatibility with existing code that was using the Object API.
To be honest, I agree with Zemian. The only reason why old code would break if it were a Hashtable<String,String> would be if programmers put Objects directly into the Properties object using the put method. IMHO, that would mean using a Properties object in a way it wasn't meant to be used.
Yes, but the thing it, it is possible that people used put(Object, Object). Illogical as that may be, it's perfectly legal. It would have been better if Properties did not extend Hashtable in the first place - it should have contained one instead. But it's one of those bad design decisions that Sun made long ago, and now we're stuck with it. And Sun does take their backward compatibility very seriously, even here.
"I'm not back." - Bill Harding, Twister
posted 11 years ago
Right, backward compatibility. I was going to guess that. Well, I am glad some of you agree what I found. It just bugs me that with new Generic added, I still can't loop a Properties without casting.