[
https://issues.apache.org/jira/browse/GROOVY-12301?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Paul King resolved GROOVY-12301.
--------------------------------
Fix Version/s: 6.0.0-beta-4
Assignee: Paul King
Resolution: Fixed
> 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: 6.0.0-alpha-1, 5.0.3, 4.0.31
> Reporter: Björn Kautler
> Assignee: Paul King
> Priority: Major
> Fix For: 6.0.0-beta-4
>
>
> 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)