• Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem making interface a generic type  RSS feed

 
Mark markwoon
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm getting a compile error that makes no sense to me. Can anyone shed some light on the problem in the following piece of code?




If you eliminate the generic (<T>) from the interface, then it compiles just fine.

It also compiles if I use the implementation and not interface.

The <T> doesn't affect the getStrings() method which is what makes this so confusing.

Any help would be greatly appreciated.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have to either use

or


Otherwise, the compiler won't know that you are using a BadBase of Strings.
 
Mark markwoon
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the quick response, but getStrings() has nothing to do with the generic type. Can you explain why it would affect getStrings()?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!