[ https://issues.apache.org/jira/browse/GROOVY-7170?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Pascal Schumacher resolved GROOVY-7170. --------------------------------------- Resolution: Fixed Assignee: Pascal Schumacher (was: Cédric Champeau) Fix Version/s: 2.4.6 TargetTypeTestGroovy passes on 2.4.6, therefore I'm closing this issue. Thanks for reporting! > STC error If we use java.lang.Integer as Target Type with method generics > ------------------------------------------------------------------------- > > Key: GROOVY-7170 > URL: https://issues.apache.org/jira/browse/GROOVY-7170 > 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: Pascal Schumacher > Fix For: 2.4.6 > > Attachments: TargetTypeTestGroovy.groovy, TargetTypeTestJava.java > > > Target type inference makes an STC Error when the target is java.lang.Integer: > {code} > static <T> T empty() {..} > Integer i = empty(); //[Static type checking] - Cannot assign value of > type T to variable of type java.lang.Integer > {code} > Even if we specify the type explicitly, STC says same error: > {code} > Integer i2 = TargetTypeTestGroovy.<Integer>empty(); // [Static type > checking] - Cannot assign value of type T to variable of type > java.lang.Integer > {code} > If we use java.lang.String instead of java.lang.Integer, it's OK. > Both of cases are worked well in java. -- This message was sent by Atlassian JIRA (v6.3.4#6332)