[ https://issues.apache.org/jira/browse/GROOVY-7159?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Cédric Champeau resolved GROOVY-7159. ------------------------------------- Resolution: Fixed Fix Version/s: 2.4.4 > 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 > Fix For: 2.4.4 > > 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)