[ 
https://issues.apache.org/jira/browse/GROOVY-8228?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Paul King closed GROOVY-8228.
-----------------------------

> 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
>            Priority: Major
>             Fix For: 2.6.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
(v7.6.3#76005)

Reply via email to