Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.0.0
-
None
-
Windows 7
Eclipse
Groovy Eclipse 2.7.1.xx-20120915
Description
package example import groovy.transform.TypeChecked import java.nio.charset.Charset @TypeChecked class PotentialTypeCheckerIssueExample { private static Charset ISO_8859_1_CHARSET = Charset.forName("ISO-8859-1") static void main(String[] args) { new PotentialTypeCheckerIssueExample().printCharset() } def printCharset(){ println ISO_8859_1_CHARSET } }
The type checker reports
Groovy:[Static type checking] - Cannot assign value of type
java.lang.Class to variable of type
java.nio.charset.Charset PotentialTypeCheckerIssueExample.groovy /GroovyTests/src/example line
9 Java Problem
The code runs fine without @TypeChecked, the IDE shows the right
return type (Charset).
What's wrong here?