• Post Reply Bookmark Topic Watch Topic
  • New Topic

Why is java.util.EventObject not generified?  RSS feed

 
Michael Herrmann
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm currently trying to tame the Tiger and one of the first things I noticed when playing around with generics is that java.util.EventObject is not generified. This means that if for instance a java.awt.event.WindowEvent occurs you have to cast the return value of WindowEvent's getSource() to Window if you want to be able to perform Window-specific operations (I haven't tried it, to be honest, but I'm very sure). This wouldn't be necessary if EventObject looked like



and if WindowEvent looked like(simplified, of course)



, would it?

Am I right or am I mistaken? Does my approach have any disadvantages?
[ May 14, 2005: Message edited by: Michael Herrmann ]
 
Michael Herrmann
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please folks, tell me your opinion. Tell me especially if you can't explain it either.

Thanks
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
At first glance, I'd agree with you. It may be an oversight, or it may be that certain existing classes -- and here I'm thinking of AWTEventMultiplexer -- might not be compatible with this.
 
Alan Moore
Ranch Hand
Posts: 262
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sounds like a good idea to me. It doesn't strike me as a high-priority item, though. Since it would affect all of AWT and Swing, with the potential for creating hundreds of bugs, I can understand if the people at Sun aren't in a hurry to implement it.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!