Björn Kautler created GROOVY-12301:
--------------------------------------

             Summary: STC does not resolve generic return type properly
                 Key: GROOVY-12301
                 URL: https://issues.apache.org/jira/browse/GROOVY-12301
             Project: Groovy
          Issue Type: Bug
    Affects Versions: 4.0.31, 5.0.3, 6.0.0-alpha-1
            Reporter: Björn Kautler


Given this snippet:
{code:java}
@Grab('org.jboss.weld:weld-spock:4.0.4.Final')
import org.jboss.weld.spock.WeldInitiator
import org.jboss.weld.spock.WeldInitiator.Builder
  
@groovy.transform.CompileStatic
class Foo {
  def foo() {
    Builder builder = 
WeldInitiator.from(WeldInitiator.createWeld()).inject(this)
    println(builder)
  }
}
new Foo().foo() {code}
STC complains
{code:java}
Cannot assign value of type 
org.jboss.weld.junit.AbstractWeldInitiator$AbstractBuilder to variable of type 
org.jboss.weld.spock.WeldInitiator$Builder {code}
IntelliJ knows the type of the {{inject}} result properly as {{{}Builder{}}}, 
and in Java it also compiles fine.

(This time I verified it still happens in 6.0.0-alpha-1 which is available in 
groovyconsole.dev :))



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to