6723444: javac fails to substitute type variables into a constructor's throws clause
Mark Mahieu
mark at twistedbanana.demon.co.uk
Wed Jul 23 05:58:54 PDT 2008
Hi,
Is anyone already working on this bug? I see the bug entry now has
an evaluation.
If not, I believe I have a fix for it, as well as for a related issue
which occurs when the class being instantiated is an anonymous class
(flow analysis of the class def also encounters unsubstituted type
variables) - note the two errors reported in this derivative of the
bug's example:
public class Hello {
static class Foo<X> {}
<X extends Throwable> Hello(Foo<X> foo) throws X {}
public static void main(String[] args) throws Exception {
new Hello(new Foo<Exception>()) {};
}
}
Hello.java:7: unreported exception X in default constructor
new Hello(new Foo<Exception>()) {};
^
Hello.java:7: unreported exception X; must be caught or declared to
be thrown
new Hello(new Foo<Exception>()) {};
^
2 errors
I should be able to submit a patch and jtreg test case in the next
day or so if it's of interest.
Best regards,
Mark
More information about the compiler-dev
mailing list