Thodoris Sotiropoulos created GROOVY-11485:
----------------------------------------------

             Summary: undefined default constructor of outer class causes 
runtime exception
                 Key: GROOVY-11485
                 URL: https://issues.apache.org/jira/browse/GROOVY-11485
             Project: Groovy
          Issue Type: Bug
          Components: Static Type Checker
            Reporter: Thodoris Sotiropoulos


I have the following program
{code:java}
class Test {
  Test(String x) {}
  class Foo extends Test {}

  public static void main(String[] args) {
    Test x = new Test("");
    Test.Foo y = x.new Foo();
  }
} {code}
h3. Actual behavior

The code compiles, but there's a runtime error
{code:java}
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Index 0 
out of bounds for length 0
    at Test$Foo.<init>(test.groovy)
    at Test.main(test.groovy:8) {code}
h3. Expected behavior

The code should have been rejected.



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

Reply via email to