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

Paul King resolved GROOVY-4356.
-------------------------------
       Resolution: Fixed
         Assignee: Paul King
    Fix Version/s: 2.5.0-beta-1

While technically a bug fix I will make this change just on master to target 
Groovy version 2.5 since even in our own code base we were sloppy with using 
some class-level generics within static methods - just example test code. So, 
there might be existing code that will (and should) break. The expectations 
about breakages are slightly greater for more major releases.

But feedback welcome and I am certainly open to porting back to the 2_4_X 
branch if there is sufficient demand.

> Static members should not be able to access class-level generic types
> ---------------------------------------------------------------------
>
>                 Key: GROOVY-4356
>                 URL: https://issues.apache.org/jira/browse/GROOVY-4356
>             Project: Groovy
>          Issue Type: Bug
>          Components: class generator
>    Affects Versions: 1.8-beta-1
>            Reporter: Roshan Dawrani
>            Assignee: Paul King
>             Fix For: 2.5.0-beta-1
>
>
> The following code compiles, but it shouldn't because T is a non-static 
> generic type, and difference instances of Outer will have different concrete 
> representations of T. Hence it makes no sense that static inner classes 
> should be able to use such generic type variables.
> {code}
> class Outer<T> {
>     T ofoo
>     static class Inner {
>         T ifoo
>     }
> }
> {code}
> Similarly, all the cases below should not compile as well:
> {code}
> class Test1<T> {
>     static T f1
> }
> class Test2<T> {
>     static foo(T param1) {}
> }
> class Test3<T> {
>     static foo() {
>         T localVar1
>     }
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to