• Post Reply Bookmark Topic Watch Topic
  • New Topic

Doubt in reflection  RSS feed

 
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]
 
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.
 
Sheriff
Posts: 21135
87
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
Boost this thread!