Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.1.0-beta-1
-
None
Description
In following code, I expect no STC error at (A).
import groovy.transform.* @TypeChecked // or @CompileStatic class ccc { List<String> list = null // (A) List list2 = null // OK String str = null // OK public static void main(String [] args) { List<String> list = null // OK } }
but compiler says:
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
/Users/uehaj/work/201301/gastha_magazine/ccc.groovy: 4: [Static type checking] - Incompatible generic argument types. Cannot assign java.lang.Object to: java.util.List <String>
@ line 4, column 23.
List<String> list = null
^1 error
Of course I can avoid this error by modify the code to:
List<String> list = (List<String>)null