trouble in usage of the generic methods
I have a method declared as below
<T> T getA开发者_如何学运维dapter(Adaptable adaptable, Class<T> extensionInterface);
and I'm calling it with below argumants
adapterManager.getAdapter(new AWScoreAdapterImpl(null), AWScoreAdapter.class);
Can someone help me understand why the above line is causing the below compile time error
The method getAdapter(Adaptable, Class) in the type AdapterManager is not applicable for the arguments (AWScoreAdapterImpl, Class)
It's nothing to do with generics - your AWScoreAdapterImpl
isn't of type Adaptable
. Either implement its interface, or extend it if it's a class.
Are you able to post your class definitions here? In particular, Adaptable
, AWScoreAdapterImpl
and AdapterManager
.
精彩评论