[ 
https://issues.apache.org/jira/browse/GROOVY-11485?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17885400#comment-17885400
 ] 

Eric Milles commented on GROOVY-11485:
--------------------------------------

When no constructor is declared for the inner class, one is generated (in 
{{InnerClassCompletionVisitor}}) with code like:
{code:groovy}
Foo(Test $p$) {
  super();
  {
    this$0 = $p$
  }
}
{code}

It is the "super()" call that does not work for the superclass, which only 
declares "Test(String)".

> 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
>            Priority: Minor
>
> 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