Name: ngR10089 Date: 01/27/2004
The latest spec of "Adding Generics to the Java Programming Language: Public
Draft Specification, Version 2.0", 2.2 reads:
"Since the throw and catch mechanism of the JVM works only with
unparameterized classes, we require that parameterized types may not
inherit directly or indirectly from java.lang.Throwable."
However javac (jdk1.5.0-b35) successfully compile test below.
> java -version
java version "1.5.0-beta2"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta2-b35)
Java HotSpot(TM) Client VM (build 1.5.0-beta2-b35, mixed mode)
novo41%
> javac -d . -source 1.5 test.java
> java -Xfuture p.test
p.clss42102a 44
>
--------------- test.java-------------
package p;
import java.io.PrintStream;
class clss42102a<A> extends Throwable {
A value;
}
public class test {
public static void main(String argv[]) {
System.exit(run(argv, System.out) + 95/*STATUS_TEMP*/);
}
public static int run(String argv[],PrintStream out) {
clss42102a<Integer> p = new clss42102a<Integer>();
p.value = new Integer(44);
try {
if (true) throw p;
} catch (clss42102a e) {
out.println(e + " " + e.value);
}
return 0/*STATUS_PASSED*/;
}
}
---------------------------------------
New JCK tests
lang/CLSS/clss421/clss42101/clss42101.html
lang/CLSS/clss421/clss42102/clss42102.html
fail due to this bug.
======================================================================