Storing annotations on exception parameters
Jonathan Gibbons
jonathan.gibbons at oracle.com
Tue Jan 22 19:00:33 PST 2013
On 11/27/2012 06:26 PM, Jonathan Gibbons wrote:
> On 11/27/2012 05:49 PM, Werner Dietl wrote:
>> As discussed on the type-annotations-spec-experts list (see
>> http://mail.openjdk.java.net/pipermail/type-annotations-spec-experts/2012-November/000038.html)
>>
>> Section 3.3.8 of the JSR 308 specification will stay unchanged.
>>
>> For local variables, method:
>>
>> com.sun.tools.javac.jvm.Code.fillLocalVarPosition(LocalVar)
>>
>> determines the necessary information.
>>
>> Could somebody point me to a place where I could determine the
>> exception table index for an exception parameter?
>> I found method
>>
>> com.sun.tools.javac.jvm.Gen.genCatch(JCCatch, Env<GenContext>, int,
>> int, List<Integer>)
>>
>> but I didn't see an exception table index there.
>>
>> Thanks,
>> cu, WMD.
>>
>
> Werner,
>
> I believe the data structure you should be looking at is this one in
> Code.java
>
> /** A buffer for expression catch data. Each enter is a vector
> * of four unsigned shorts.
> */
> ListBuffer<char[]> catchInfo = new ListBuffer<char[]>();
>
> And this method:
>
> /** Add a catch clause to code.
> */
> public void addCatch(
> char startPc, char endPc, char handlerPc, char catchType) {
> catchInfo.append(new char[]{startPc, endPc, handlerPc,
> catchType});
> }
>
> So, on the face of it, the index in the catchInfo array is the value
> you want. But life is never that simple, since there's this method too:
>
> public void compressCatchTable() {
>
> which can eliminate some entries. You may need to search catchInfo for
> the handler you need.
>
> -- Jon
Werner,
Did this earlier response help you in determining type annotation
positions for multicatch catch clauses?
-- Jon
More information about the type-annotations-dev
mailing list