我编写了以下代码,将泛型集成到以下方法中。很明显,我是Generics的新手(之前没有创建过它们)。以下方法产生奇怪的警告
private static PublishSubject mPublishSubject;
public <T> void register(final Class<T> type, Action1<T> observerAction) {
mPublishSubject.filter(new Func1<T, Boolean>() {
@Override
public Boolean call(T o){
Timber.e("Filter(): object type: %s typeClass is: %s", o.getClass(), type);
if(o.getClass().equals(type)) {
Timber.e("Filer() return true");
return true;
}
Timber.e("Filer() return false");
return false;
}
}).map(new Func1<T, T>() {
@Override
public T call(@NonNull T o) {
Timber.e("Map(): object received from filter: %s", o);
return o;
}
}).subscribe(observerAction);
}
以下是我收到的警告。
Unchecked call to map(Func1(<? super T, ? extends R>) as a member of raw type rx.Observable.
Unchecked call to subscribe(Action1(<? super T>) as a member of raw type rxObservable.
这些警告意味着什么?我在哪里弄错了?