Grails

Error starting Grails console if domain class is annotated with groovy.transform.Canonical

Details

  • Type: Bug Bug
  • Status: In Progress In Progress
  • Priority: Critical Critical
  • Resolution: Unresolved
  • Affects Version/s: 2.0-RC1
  • Fix Version/s: 2.0.2
  • Component/s: Project infrastructure
  • Labels:
  • Environment:
    Windows XP SP3, JDK 1.6.0_29

Description

When starting console in an application that has a domain class annotated with @Canonical the following error occurs:

Compiling 37 source files
Compiling 11 source files.....
Error Error executing script Console: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'grailsApplication': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.codehaus.groovy.grails.commons.DefaultGrailsApplication]: Constructor threw exception; nested exception is java.lang.ClassFormatError: Duplicate method name&signature in class file Person (Use --stacktrace to s
ee the full trace)

Activity

Hide
Matthias Hryniszak added a comment -

To recreate the issue just unzip the application and run grails console. It's 100% reproducible.

Show
Matthias Hryniszak added a comment - To recreate the issue just unzip the application and run grails console. It's 100% reproducible.
Hide
Robert Kasanicky added a comment -

It's the @TupleConstructor part of @Canonical that triggers the problem, @EqualsAndHashcode and @ToString work as expected.

Show
Robert Kasanicky added a comment - It's the @TupleConstructor part of @Canonical that triggers the problem, @EqualsAndHashcode and @ToString work as expected.
Hide
Mihael Koep added a comment -

I get the same error message with a constructor with default parameter in a domain class, e.g.:

public Deadline(Date deadline = new Date()) { this.deadline = deadline }

Show
Mihael Koep added a comment - I get the same error message with a constructor with default parameter in a domain class, e.g.: public Deadline(Date deadline = new Date()) { this.deadline = deadline }
Hide
Cédric Champeau added a comment -

Also it's important to notice that @TupleConstructor doesn't create any constructor if one already exists in the class.

Show
Cédric Champeau added a comment - Also it's important to notice that @TupleConstructor doesn't create any constructor if one already exists in the class.
Hide
Graeme Rocher added a comment -

@Cedric that seems to indicate to me that my transformation is running after @TupleConstructor so in that case do local transforms run before global ones?

Show
Graeme Rocher added a comment - @Cedric that seems to indicate to me that my transformation is running after @TupleConstructor so in that case do local transforms run before global ones?

People

Vote (3)
Watch (2)

Dates

  • Created:
    Updated:
    Last Reviewed: