[JSR308] Others possible syntaxes for type annotations
Eugene Kuleshov
eu at javatx.org
Thu May 17 14:01:35 EDT 2007
Maxim Kizub wrote:
> The proposition was about using uniform syntax for type parameters and
> annotations.
> In this way type annotation syntax IS non-ambiguous, uniform and
> logical. Compare
> 1) @A String @B string;
> 2) @A String<@B> string;
> The case (1) has strange reading rules, because it looks like (@A
> String) (@B string), but must be read as @A (String @B) string.
> In contrast, in case (2) it's obvious, that @B belongs to type String,
> not to the variable.
Maxim, can you please provide more details for the suggested grammar
changes? I.e. what are you suggesting to add into the existing grammar.
See http://docs.oracle.com/javase/specs/jls/se5.0/html/syntax.html#18.1
Example with a string type is rather limited, so I wonder how
generified types would look like in your proposal.
Say, in something like Map<Foo<Boo>, Map<String, Boo>> how would you
separately annotate each Map, Foo and Boo types? Maybe I am just
confused by use of <> and it may worth investigating use of some other
token? Though there is no single-char "bracket" tokens left and we'll
have to use some multi-char token, and that won't look pretty...
regards,
Eugene
More information about the JSR308
mailing list