mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-07 13:39:36 +07:00
testdata for IDEA-139875
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user