You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Daniel Sun (JIRA)" <ji...@apache.org> on 2017/08/09 04:50:00 UTC

[jira] [Commented] (GROOVY-8228) JSR308 grammar changes

    [ https://issues.apache.org/jira/browse/GROOVY-8228?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16119409#comment-16119409 ] 

Daniel Sun commented on GROOVY-8228:
------------------------------------

Same code, different result :(

travis-ci succeeds:  https://travis-ci.org/apache/groovy/builds/262506189
teamcity fails:          http://ci.groovy-lang.org/viewLog.html?buildId=41265&tab=buildResultsDiv&buildTypeId=Groovy_Jdk8Build_PlusSnapshotDeploy
                               http://ci.groovy-lang.org/viewLog.html?buildId=41260&tab=buildResultsDiv&buildTypeId=Groovy_Jdk8Build_PlusSnapshotDeploy
                               http://ci.groovy-lang.org/viewLog.html?buildId=41257&tab=buildResultsDiv&buildTypeId=Groovy_Jdk8Build_PlusSnapshotDeploy

I guess the difference is related to the version of JDK8 deployed(Maybe it is a bug of Java8)

> 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: 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
(v6.4.14#64029)