6723444: javac fails to substitute type variables into a constructor's throws clause

Jonathan Gibbons Jonathan.Gibbons at Sun.COM
Wed Jul 23 07:27:26 PDT 2008


Mark,

Thank you for offering to help.
Please note that before we can look at any submission, you need to  
sign the Sun SCA.
You can find information here: https://sca.dev.java.net/

-- Jon

On Jul 23, 2008, at 5:58 AM, Mark Mahieu wrote:

> 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