aspose file tools
The moose likes Java in General and the fly likes Unused Generic causing problem Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "Unused Generic causing problem" Watch "Unused Generic causing problem" New topic
Author

Unused Generic causing problem

John Greenwood
Greenhorn

Joined: May 01, 2008
Posts: 2
I have a method in a parent class...


... which I choose to override in a subclass:


So far, so good. Now, I want to introduce a type parameter to the parent, so I change its header to ...

...and this gives me a compile-time error in the child (method has the same erasure as the parent, but does not over-ride it.)

Why? TIA.
Garrett Rowe
Ranch Hand

Joined: Jan 17, 2006
Posts: 1295
OK, I can understand a lot of things about generics, but this one is beyond me. As you stated, this does not compile.


Even though the type parameter on the specified list seemingly has nothing to do with the type paramter of the class. But something funny is going on because this compiles:

and obviously this compiles:
I have no idea whats going on.
[ May 01, 2008: Message edited by: Garrett Rowe ]

Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them. - Laurence J. Peter
John Greenwood
Greenhorn

Joined: May 01, 2008
Posts: 2
Thanks Garrett.

I submitted this to Sun's bug database, and they finally confirmed it as a new bug, ID 6760983.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 32620
    
    4
Originally posted by John Greenwood:
I submitted this to Sun's bug database.
Nice one!
 
I agree. Here's the link: jrebel
 
subject: Unused Generic causing problem
 
Similar Threads
Polymorphism - InstanceOf
same method inheritance
Difference between Hidden and overriden methods.
Overriding/overloading
question from nikos blog(generics)