[ https://issues.apache.org/jira/browse/GROOVY-8228?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16055128#comment-16055128 ]
Daniel Sun commented on GROOVY-8228: ------------------------------------ I mean it is valid in Java. > JSR308 grammar changes > ---------------------- > > Key: GROOVY-8228 > URL: https://issues.apache.org/jira/browse/GROOVY-8228 > Project: Groovy > Issue Type: Sub-task > Reporter: Paul King > Assignee: Daniel Sun > Fix For: 3.0.0-alpha-1 > > > Potential cases to consider. > Known to pass with the current grammar: > {code} > // method receiver parameters (works with existing grammar) > void tempCalc(@ReadOnly Weather this){ ... } > // on arrays > // Annotating the int type: > @ReadOnly int [] nums; > {code} > Fail with `unexpected token: @ at line: xx, column: yy`: > {code} > // constructor usage > Forecast currentForecast = new @Interned Forecast() > // type casts > Object myObject = (@NotNull Object) obj > // exception in catch block > catch (@Critical Exception e) { ... } > // on arrays > // Annotating the array type int[]: > int @ReadOnly [] nums > // Annotating the array type int[][]: > int @ReadOnly [][] nums > // Annotating the type int[], which is a component type of int[][]: > int [] @ReadOnly [] nums > {code} > Fail with `unexpected token: < at line: xx, column: yy`: > {code} > // generics > List<@NonNull Integer> nums = [] > List<? extends @NonNull File> fileList = null > {code} > Fail with 'expecting an identifier, found '@' at line: xx, column: yy': > {code} > // inheritance > class MyForecast<T> implements @NonEmpty List<T> > {code} > Fails with 'unexpected token: throws at line: xx, column: yy': > {code} > // exception in method declaration > def foo() throws @NonNull Exception { } > {code} > Adapted mostly from: > http://www.oracle.com/technetwork/articles/java/ma14-architect-annotations-2177655.html -- This message was sent by Atlassian JIRA (v6.4.14#64029)