[type-annos-observers] Constraining type annotations to occur just before type
Jonathan Gibbons
jonathan.gibbons at oracle.com
Thu Mar 21 10:28:29 PDT 2013
On 03/21/2013 10:21 AM, Michael Ernst wrote:
> But, here are a few downsides:
> * More grammatical ambiguity and more parsing complexity.
> * Any change so late in the game carries risks and extra work. The work
> includes grammar changes and compiler changes.
> * Source code incompatibility with pre-Java-8 hacks that use
> declaration annotations to stand for type annotations.
> Are there other downsides I am missing?
You don't have to fix this in the parser -- and indeed, you can't,
because at parse time you cannot differentiate between
declaration annotations and type annotations. This just means
you have to be tolerant in the parser and apply the checks later on.
One option would be to use -Xlint or similar techniques to encourage
good style, without mandating it.
-- Jon
More information about the type-annotations-spec-observers
mailing list