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

Konstantin Nisht updated GROOVY-10305:
--------------------------------------
    Description: 
The following code

 

{{record X(int a) {}}
{{  public X(int a) {}}
{{    println "abcd"}}
{{  }}}
{{}}}

{{def x = new X(10)}}

 

fails to run with an exception "java.lang.ClassFormatError: Duplicate method 
name "<init>" with signature "(I)V" in class file X". Similar code in java 
works fine.

  was:
The following code

{{record X(int a) {}}
{{  public X(int a) }}{{{ }}
{{    println "abcd" }}
{{  }}}
{{}}}

{{new X(1)}}

fails to run with an exception "java.lang.ClassFormatError: Duplicate method 
name "<init>" with signature "(I)V" in class file X". Similar code in java 
works fine.


> Groovy records do not allow creating non-compact constructors with signature 
> matching the record one
> ----------------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-10305
>                 URL: https://issues.apache.org/jira/browse/GROOVY-10305
>             Project: Groovy
>          Issue Type: Bug
>          Components: Compiler
>    Affects Versions: 4.0.0-beta-1
>            Reporter: Konstantin Nisht
>            Priority: Major
>
> The following code
>  
> {{record X(int a) {}}
> {{  public X(int a) {}}
> {{    println "abcd"}}
> {{  }}}
> {{}}}
> {{def x = new X(10)}}
>  
> fails to run with an exception "java.lang.ClassFormatError: Duplicate method 
> name "<init>" with signature "(I)V" in class file X". Similar code in java 
> works fine.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to