Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Doubt in reflection

 
Shridhar Raghavan
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is the signature of a method in a utility class.

Now given below is another hierarchy



Both with 1 & 2 i get an error
// The method (in the util class) select(Class<Object> clazz) is not applicable for the arguments select(<Class<capture#1-of ? extends BaseEntity>)

[Edit - added code tags - MB]
 
Matthew Brown
Bartender
Posts: 4568
9
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're not passing in a Class<Object> - the generic part is wrong. Try declaring the method with Class<?> instead.
 
Rob Spoor
Sheriff
Pie
Posts: 20667
65
Chrome Eclipse IDE Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Or perhaps even better, add a method generic type:
If you provide BaseEntity.class the result will be a List<BaseEntity>, etc.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic