You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2015/05/07 22:50:00 UTC

[jira] [Commented] (GROOVY-7159) STC claims non-existent Diamond in Anonymous Inner Class with Generics

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

ASF GitHub Bot commented on GROOVY-7159:
----------------------------------------

Github user asfgit closed the pull request at:

    https://github.com/apache/incubator-groovy/pull/1


> STC claims non-existent Diamond in Anonymous Inner Class with Generics
> ----------------------------------------------------------------------
>
>                 Key: GROOVY-7159
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7159
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static Type Checker
>    Affects Versions: 2.4.0-beta-3
>         Environment: Groovy Version: 2.4.0-beta-3 JVM: 1.8.0_25 Vendor: Oracle Corporation OS: Mac OS X
>            Reporter: UEHARA Junji
>            Assignee: Cédric Champeau
>         Attachments: Test.groovy
>
>
> In following code, STC error with variable x.
> {quote}
> [Static type checking] - Cannot use diamond <> with anonymous inner classes
> {quote}
> But diamond is not used for x.
> {code}
> interface Cls<T> {
>     void foo(T t)
> }
> @groovy.transform.TypeChecked
> def func() {
>     Cls<String> x = new Cls<String>(){ // [Static type checking] - Cannot use diamond <> with anonymous inner classes
>                                        // why?
>         void foo(String t){}
>     }
>     Cls y = new Cls<String>(){ // OK
>         void foo(String t){}
>     }
>     Cls<String> z = new Cls<>(){ // [Static type checking] - Cannot use diamond <> with anonymous inner classes
>                                  // fair enough
>         public void foo(String t){}
>     }
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)