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 2023/01/18 00:04:00 UTC

[jira] [Updated] (GROOVY-10464) Wrong cast for type parameter in generated stubs

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

Eric Milles updated GROOVY-10464:
---------------------------------
    Fix Version/s: 2.5.21

> Wrong cast for type parameter in generated stubs
> ------------------------------------------------
>
>                 Key: GROOVY-10464
>                 URL: https://issues.apache.org/jira/browse/GROOVY-10464
>             Project: Groovy
>          Issue Type: Bug
>          Components: Stub generator / Joint compiler
>    Affects Versions: 3.0.9, 4.0.0
>            Reporter: Eric Milles
>            Assignee: Eric Milles
>            Priority: Major
>             Fix For: 3.0.10, 4.0.1, 2.5.21
>
>
> Consider the following:
> {code:groovy}
> abstract class A<T> {
>   A(Class<T> t) {
>   }
> }
> class C extends A<E> {
>   C() {
>     super(E) // stubgen: "super((Class<T>)null);"
>   }
> }
> enum E {
> }
> {code}
> When class C is used by java sources, the joint compiler / stub generator creates an error for the java source.  I was only able to work around this by changing "Class<T>" to "Class" which is no longer type-safe.  In the case of the example given in the comments of GROOVY-10122 where the type parameter T is the type of the constructor parameter, it would need to be changed to Object.



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