Seeking clarification on a bit of the spec? 'type_path_entry'

6 visningar
Hoppa till det första olästa meddelandet

Andrew Clement

oläst,
15 apr. 2013 20:18:582013-04-15
till jsr308-...@googlegroups.com
Hi all,

Hope this is the right place to post. I'm doing some implementation work around JSR308. I'm looking at type_paths. In Section 3.4 it gives the structure of a type_path_entry as:

struct type_path_entry {
  u1 type_path_kind;
    // 0: annotation is deeper in this array type
    // 1: annotation is deeper in this nested type
    // 2: annotation is on the bound of this wildcard type arg
    // 3: annotation is on the i'th type arg of this parameterized type
  u1 type_argument_index;
    // 0: ignore me
    // non-0: the 1st, 2nd, etc type arg of this parameterized type
}

In figure 2 it shows that for:

@A Map<@B Comparable<@F Object @C [] @D [] @E []>, @G List<@H Document>>

The type_path for @B is:

path_length: 1; path: [TYPE_ARGUMENT(3, 0)]

So, [1,3,0] encoded as a type_path. But the type_argument_index comment in the block above says '0' is ignore and non-0 means the 1st, 2nd, etc type arg.  I presume the comment is wrong/misleading and the type_argument_index starts at 0 for type arguments when the type_path_kind is 3 ? This seems to be what b81 javac does and what the example shows - I just found the comment confusing.

many thanks,
Andy


Michael Ernst

oläst,
16 apr. 2013 14:35:432013-04-16
till JSR308 Discussions, Andrew Clement
Andy-

You are correct that the comments in the type_path_entry struct were
incorrect. I apologize for the error.

The corrected struct is:

struct type_path_entry {
u1 type_path_kind;
// 0: annotation is deeper in this array type
// 1: annotation is deeper in this nested type
// 2: annotation is on the bound of this wildcard type arg
// 3: annotation is on a type argument of this parameterized type
u1 type_argument_index;
// 0, if type_path_kind is 0, 1, or 2
// the 0-based index of the type arg in this parameterized type,
if type_path_kind is 3
}

Thanks for pointing this out!

The corrected version of the spec will appear on the web around May 1.

-Mike


> Subject: Seeking clarification on a bit of the spec?
> 'type_path_entry'
> From: Andrew Clement <andrew....@gmail.com>
> To: jsr308-...@googlegroups.com
> Date: Mon, 15 Apr 2013 17:18:58 -0700 (PDT)
> --
>
> ---
> You received this message because you are subscribed to the Google
> Groups "Type
> annotations (JSR 308) discussions" group.
> To unsubscribe from this group and stop receiving emails from it,
> send an email
> to jsr308-discus...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
Svara alla
Svara författaren
Vidarebefordra
0 nya meddelanden