testdata for IDEA-139875

This commit is contained in:
Anna Kozlova
2015-05-04 11:36:32 +02:00
parent 0d3371872b
commit 84a06d86a9
2 changed files with 51 additions and 0 deletions

View File

@@ -0,0 +1,47 @@
import java.util.List;
class GenericsError {
private static class ListHolder<T> {
private List<T> <warning descr="Private field 'list' is never assigned">list</warning>;
private void <warning descr="Private method 'forEach(GenericsError.Looper<? super T>)' is never used">forEach</warning>(final Looper<? super T> looper) {
for (final T item : list) {
looper.loopItem(item);
}
}
private void forEach(final DeletingLooper<? super T> looper) {
for (final T item : list) {
looper.loopItem(item);
}
}
}
private interface Looper<T> {
void loopItem(final T a);
}
private interface DeletingLooper<T> extends Looper<T> {
}
private static class MyDeletingLooper implements DeletingLooper<B> {
@Override
public void loopItem(final B a) {
}
}
private class A {
}
private class B extends A {
}
public static void main(final String[] args) {
final ListHolder<? extends B> aListHolder = new ListHolder<B>();
final DeletingLooper<? super B> bLooper = new MyDeletingLooper();
aListHolder.forEach(bLooper);
}
}