-
Bug
-
Resolution: Cannot Reproduce
-
P4
-
None
-
6
-
generic
-
generic
javac fails to reject this program. There may also be a specification bug.
class Hole<T> {
class X extends RuntimeException {
T t;
X(T t) { this.t = t; }
}
T foo() {
try {
bar();
return null;
} catch (X x) {
return x.t;
}
}
void bar() {
throw new Hole<Integer>().new X(3);
}
public static void main(String[] args) {
System.out.println (new Hole<String>().foo());
}
}
class Hole<T> {
class X extends RuntimeException {
T t;
X(T t) { this.t = t; }
}
T foo() {
try {
bar();
return null;
} catch (X x) {
return x.t;
}
}
void bar() {
throw new Hole<Integer>().new X(3);
}
public static void main(String[] args) {
System.out.println (new Hole<String>().foo());
}
}
- relates to
-
JDK-6558763 8.1.2: Disallow generic exception types by specifying generic inner classes
-
- Open
-