H
HK
import java.util.*;
public class Bla<T> {
private List<T>[] ary = new ArrayList[10];
private class InnerClass<T> {
public void boo() {
List<T> et = ary[0];
}
}
}
Bla.java:8: incompatible types
found : java.util.List<T>
required: java.util.List<T>
List<T> et = ary[0];
It took me some time to realize that the <T> of
InnerClass is a completely different one from
the <T> of Bla. I wonder if the compiler should
rather complain that type variable <T> is
redefined at InnerClass<T>.
Harald.
public class Bla<T> {
private List<T>[] ary = new ArrayList[10];
private class InnerClass<T> {
public void boo() {
List<T> et = ary[0];
}
}
}
Bla.java:8: incompatible types
found : java.util.List<T>
required: java.util.List<T>
List<T> et = ary[0];
It took me some time to realize that the <T> of
InnerClass is a completely different one from
the <T> of Bla. I wonder if the compiler should
rather complain that type variable <T> is
redefined at InnerClass<T>.
Harald.