[ https://issues.apache.org/jira/browse/GROOVY-9204?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16902173#comment-16902173 ]
Eric Milles commented on GROOVY-9204: ------------------------------------- When trying to resolve the type of the {{theField}} in the method call expression, this call returns Object instead of F: org.codehaus.groovy.transform.stc.StaticTypeCheckingVisitor.visitVariableExpression(VariableExpression) {code:java} ClassNode actualType = findActualTypeByGenericsPlaceholderName( fieldNode.getOriginType().getUnresolvedName(), makeDeclaringAndActualGenericsTypeMap(fieldNode.getDeclaringClass(), typeCheckingContext.getEnclosingClassNode()) ); {code} > Compiler loses type info of superclass field > -------------------------------------------- > > Key: GROOVY-9204 > URL: https://issues.apache.org/jira/browse/GROOVY-9204 > Project: Groovy > Issue Type: Bug > Components: Static compilation, Static Type Checker > Affects Versions: 2.5.7 > Reporter: Daniil Ovchinnikov > Priority: Blocker > > {code:java|title=foo/bar/classes.java} > package foo.bar; > class F { > void hi() {} > } > abstract class Base<T extends F> { > protected T theField; > } > abstract class Middle<T extends F> extends Base<T> {} > abstract class Concrete extends Middle<F> {} > {code} > {code:java|title=foo/bar/GroovyUsage.groovy} > package foo.bar > @groovy.transform.CompileStatic > class GroovyUsage extends Concrete { > def usage() { > theField.hi() // Error:(7, 9) Groovyc: [Static type checking] - > Cannot find matching method java.lang.Object#hi(). Please check if the > declared type is correct and if the method exists. > } > } > {code} > Note this was working with 2.4.17. -- This message was sent by Atlassian JIRA (v7.6.14#76016)