Paul King created GROOVY-12771:
----------------------------------

             Summary: A member class inherited by a class is not resolved by 
its simple name in a class nested within it
                 Key: GROOVY-12771
                 URL: https://issues.apache.org/jira/browse/GROOVY-12771
             Project: Groovy
          Issue Type: Bug
            Reporter: Paul King


A class can use a member class it inherits by its simple name, but a class 
nested within it cannot, with or without static compilation:

{code:groovy}
class Outer {
    class Inner { }
    static class StaticInner { }
}

class Sub extends Outer {
    Inner a                    // resolves
    static class Nested {
        StaticInner b          // unable to resolve class StaticInner
        Inner c                // unable to resolve class Inner
    }
}
{code}

The same happens for an inner (non-static) class or a record nested in {{Sub}}, 
and when {{Outer}} is generic ({{class Sub extends Outer<String>}}). Reproduced 
with 4.0.33, 5.1.3 and 6.0.0; javac compiles the equivalent Java code, since 
the member classes of {{Sub}}, including inherited ones, are in scope 
throughout its body (JLS 6.3, 8.5).




--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to