You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was trying to understand the checker framework behavior for the following scenario. Is this the expected behavior, is it a bug, or is there a way to annotate the code to get rid of the error?
For this snippet,
import java.util.function.Consumer;
import java.util.Iterator;
class IteratorForEach<T> {
private final Iterator<? extends T> it;
public IteratorForEach(Iterator<? extends T> iterator) {
this.it = iterator;
}
public void test(Consumer<? super T> action) {
it.forEachRemaining(action);
}
}
where signature for Iterator::forEachRemaining is
default void forEachRemaining(Consumer<? super E> action);
checker framework reports,
error: [argument] incompatible argument for parameter action of Iterator.forEachRemaining.
it.forEachRemaining(action);
^
found : @Tainted Consumer<capture#03 extends @Tainted Object super T extends @Tainted Object>
required: @Tainted Consumer<? extends @Tainted Object super capture#04 extends T extends @Tainted Object>
Note that I was working with tainting checker. But the reported error is not tainting-specific; the same error is reported for other checkers as well.
The text was updated successfully, but these errors were encountered:
I was trying to understand the checker framework behavior for the following scenario. Is this the expected behavior, is it a bug, or is there a way to annotate the code to get rid of the error?
For this snippet,
where signature for
Iterator::forEachRemaining
ischecker framework reports,
Note that I was working with tainting checker. But the reported error is not tainting-specific; the same error is reported for other checkers as well.
The text was updated successfully, but these errors were encountered: