Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-6428

AutoCloneStyle.SIMPLE doesn't play well with generics

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.2.0-rc-3
    • 2.2.1
    • None
    • None

    Description

      The SIMPLE style of autocloning doesn't like generics. The following code will fail compilation:

      @AutoClone(style=AutoCloneStyle.SIMPLE)
      class Book {
          String isbn
          String title
          List<String> authors
          Date publicationDate
      }
      

      The error is a typical AST transformation failure due to the reuse of generics (missing call to getPlainNodeReference):

      A transform used a generics containing ClassNode Book for the method protected void cloneOrCopyMembers(Book other) throws java.lang.CloneNotSupportedException { ... } directly. You are not supposed to do this. Please create a new ClassNode referring to the old ClassNode and use the new ClassNode instead of the old one. Otherwise the compiler will create wrong descriptors and a potential NullPointerException in TypeResolver in the OpenJDK. If this is not your own doing, please report this bug to the writer of the transform.
      

      Attachments

        Activity

          People

            paulk Paul King
            melix Cédric Champeau
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: