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

Groovy 3.x - @AutoClone breaks in Java17 for File properties

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • 3.0.9
    • 3.0.11
    • None
    • None
    • Java11 vs Java17
      Windows10, Ubuntu

    Description

      The following code works on Java11 but breaks on Java17

       

      import groovy.transform.AutoClone
      @AutoClone
      class Foo {
          File file
          String string
      }
      def foo = new Foo(file: new File('bar'), string: 'qux')
      foo.clone()
      

      The error is

      groovy.lang.MissingMethodException: No signature of method: java.lang.Object.clone() is applicable for argument types: () values: []
      Possible solutions: collect(), collect(groovy.lang.Closure), collect(java.util.Collection, groovy.lang.Closure), find(), any(), use([Ljava.lang.Object;)

      This can be reproduced in GroovyConsole

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              scottheiberg Scott
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: