[type-annos-observers] error: enclosing static nested class cannot be annotated ??
Alex Buckley
alex.buckley at oracle.com
Tue Oct 8 13:59:19 PDT 2013
On 10/7/2013 8:27 PM, Werner Dietl wrote:
> On 10/07/2013 11:12 PM, Srikanth S Adayapalam wrote:
>> 2. I would not expect an error at annotation site of @LegalTypeUseParam:
>> I would expect
>> that the TYPE_USE target to be silently discarded and the PARAMETER
>> target to be honored.
>> Y.Z foo3(@IllegalTypeUse @LegalParam Y.Z z) { //Illegal
Srikanth, @LegalTypeUseParam doesn't appear here. The @IllegalTypeUse is
illegal as Werner confirmed.
If the signature really was "foo3(@LegalTypeUseParam @LegalParam Y.Z
z)", then the spec would say that:
- Syntactically, @LegalTypeUseParam is parsed as a VariableModifier of
the FormalParameter production.
- Semantically, @LegalTypeUseParam is deemed to be a modifier for the
declaration (because LegalTypeUseParam is applicable in the PARAMETER
declaration context) _and_ a decorator for the type of the declared
entity (because LegalTypeUseParam is applicable in the type context
provided by a formal parameter declaration).
- It so happens that the type Y.Z is not annotatable, but no error is
due because LegalTypeUseParam is applicable more widely than type
contexts. So, @LegalTypeUseParam applies to the formal parameter
declaration as usual. (I may have some spec tweaking to do here.)
Alex
More information about the type-annotations-spec-observers
mailing list