You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Konstantin Nisht (Jira)" <ji...@apache.org> on 2021/10/14 08:59:00 UTC

[jira] [Updated] (GROOVY-10305) Groovy records do not allow creating non-compact constructors with signature matching the record one

     [ 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" }}
{{  }}}
{{}}}

{{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.

  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" }}
> {{  }}}
> {{}}}
> {{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.



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