I have this API which I can't change:
public interface A<T> {
void onClick(T widget);
}
public interface B<T> {
void use(A<T> a);
}
public interface C {
B<?> apply();
}
I have an instance c of a C object, and I need to call apply(), and then call use() on the result and provide an Anonymous Inner Type. Here is what I tried:
B<Object> b = (B<Object>) c.apply();
b.use(new A<Object>() {
onClick(Object o) {
}
});
This works, however it produces a unchecked warning. Is it possible to avoid it?
Thanks