You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2022/11/19 17:31:00 UTC

[jira] [Updated] (GROOVY-10797) Stubs with raw type parameters generated through joint compilation cannot be compiled by javac

     [ https://issues.apache.org/jira/browse/GROOVY-10797?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Eric Milles updated GROOVY-10797:
---------------------------------
    Component/s:     (was: Compiler)
                 Stub generator / Joint compiler

> Stubs with raw type parameters generated through joint compilation cannot be compiled by javac
> ----------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-10797
>                 URL: https://issues.apache.org/jira/browse/GROOVY-10797
>             Project: Groovy
>          Issue Type: Bug
>          Components: Stub generator / Joint compiler
>    Affects Versions: 4.0.6
>            Reporter: Luke Bemish
>            Priority: Major
>
> Stubs generated by groovyc for joint compilation that contain parameterized types as return values that use a raw type as a type parameter cannot be compiled by javac, even though the code generating these may compile just fine without joint compilation.
> I am compiling against a java library that has two classes that look something like as follows:
> {code:java}
> public class Inner<T> {
> }
> {code}
> {code:java}
> public class Outer<T extends Inner<?>> {
> }
> {code}
> My own class has the following method, which normally compiles fine:
> {code:groovy}
> static <T extends Inner> Outer<T> methodName() {
>     return null
> }
> {code}
> If joint compilation is enabled and a stub is generated for the class with that method, the following stub is generated:
> {code:java}
> public static <T extends Inner> Outer<T> someMethod() { return (Outer<T>)null;}
> {code}
> This throws the following error when compiled with javac:
> {code:java}
> error: type argument T#1 is not within bounds of type-variable T#2
>     public static <T extends Inner> Outer<T> someMethod() { return (Outer<T>)null;}
>                                           ^
>   where T#1,T#2 are type-variables:
>     T#1 extends Inner declared in method <T#1>someMethod()
>     T#2 extends Inner<?> declared in class Outer{code}



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