Thodoris Sotiropoulos created GROOVY-10956:
----------------------------------------------

             Summary: Initialization of non-static inner class fails
                 Key: GROOVY-10956
                 URL: https://issues.apache.org/jira/browse/GROOVY-10956
             Project: Groovy
          Issue Type: Bug
          Components: Static Type Checker
            Reporter: Thodoris Sotiropoulos


I have the following program

{code}
class Foo {
    public class Bar {
        Bar() {}

    }

}

public class Test {
    void test() {
        Foo.Bar x = new Foo().new Bar(); // works
        Foo y = new Foo();
        Foo.Bar z = y.new Bar(); // doesn't work

    }
}
{code}

h3. Actual behavior

{code}
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
test.groovy: 14: unable to resolve class Bar
 @ line 14, column 21.
           Foo.Bar z = y.new Bar(); // works
                       ^

1 error
{code}

h3. Expected behavior

Compile successfully

Tested against master (commit: c27927c1e99f9f814aea9fe26fb85c4e3a624978)



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

Reply via email to