Type annotations in multicatch
Werner Dietl
wdietl at gmail.com
Thu Jan 10 14:53:08 PST 2013
Thanks for the clarification, Alex!
So far I only looked at the start_pc and didn't notice that the
entries differed in catch_type;
see methods com.sun.tools.javac.jvm.Code.fillExceptionParameterPositions
and findExceptionIndex.
I will have to investigate how I can keep track of the annotation
position. The Code.LocalVar that I currently use doesn't seem to have
enough information - this is only one local variable for the
multicatch.
cu, WMD.
On Thu, Jan 10, 2013 at 1:14 PM, Alex Buckley <alex.buckley at oracle.com> wrote:
> 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
--
http://www.google.com/profiles/wdietl
More information about the type-annotations-dev
mailing list