Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.4.0-beta-3
-
None
-
Groovy Version: 2.4.0-beta-3 JVM: 1.8.0_25 Vendor: Oracle Corporation OS: Mac OS X
Description
In following code, STC error with variable x.
[Static type checking] - Cannot use diamond <> with anonymous inner classes
But diamond is not used for x.
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){} } }