Type annotations in multicatch
Alex Buckley
alex.buckley at oracle.com
Thu Jan 10 13:14:47 PST 2013
On 1/9/2013 6:57 PM, Werner Dietl wrote:
>> I found another one. A type annotation on the 2nd type in a union type of a
>> multicatch crashes javac.
>> I attached a test case to this mail. Basically, something like
>>
>> catch(@A E1 | @A E2 e) {}
>>
>> causes javac to crash. The stack trace from the test is below.
>> If I put it on the first one it is okay, but anything on the 2nd crashes.
>> It will eventually show up as 8005959 on bugs.sun.com.
>
> Thanks for this test case, Steve!
>
> I can't reproduce the crash in my current setup, but I see why it
> would happen in trunk.
> It looks like there is only one exception table entry for a multicatch.
> Therefore, it seems to me that only storing the exception table index
> is not enough to distinguish between multiple annotations in a
> multicatch.
> Does the JSR 308 spec need some addition in Sec. 3.3.8? Or am I not
> looking at the exception table correctly?
The catch clause above will produce two entries in Code.exception_table.
Their start_pc, end_pc, and handler_pc items will be identical, but
their catch_type items will be different (E1 v. E2).
So in Code.RuntimeInvisibleTypeAnnotations.annotations[], there should
be two type_annotation entries of target_type EXCEPTION_PARAMETER. Each
should point to one of the exception_table entries.
Alex
More information about the type-annotations-dev
mailing list