You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2022/11/21 20:53:00 UTC

[jira] [Commented] (GROOVY-10789) Collected TupleConstructor causes internal compiler error

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

Eric Milles commented on GROOVY-10789:
--------------------------------------

You probably want this:
{code:groovy}
@AnnotationCollector(mode = AnnotationCollectorMode.PREFER_EXPLICIT_MERGED)
@TupleConstructor(defaults = false)
@interface Collector {
}
{code}

I should be able to handle the {{DUPLICATE}} case (the default) gracefully.

> Collected TupleConstructor causes internal compiler error
> ---------------------------------------------------------
>
>                 Key: GROOVY-10789
>                 URL: https://issues.apache.org/jira/browse/GROOVY-10789
>             Project: Groovy
>          Issue Type: Bug
>          Components: Compiler
>    Affects Versions: 4.0.5
>            Reporter: Christopher Smith
>            Assignee: Eric Milles
>            Priority: Major
>
> I have an in-house annotation collector that applies some of the usual transforms (TupleConstructor, ToString, CompileStatic/POJO). There's a particular class where I want a no-arg constructor available, and I expected that I could "override" the annotation's values like this:
> {code:groovy}
> class TcBug {
>     @AnnotationCollector
>     @TupleConstructor(defaults = false)
>     @interface Collector {}
>     @Collector
>     @TupleConstructor(defaults = true)
>     static class Foo {
>         Integer value
>     }
> }
> {code}
> However, this results in the following error message. I had thought that the above would work; if it isn't "supposed to", then a clearer error message (with location) would be helpful.
> {code}
> TcBug.groovy: -1: Unable to compile class com.example.TcBug$Foo due to hash collision in constructors @ line -1, column -1.
> {code}



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