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

Builder with Initializer strategy and no properties results in ClassFormatError

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.4.3
    • Fix Version/s: 2.4.5
    • Component/s: None
    • Labels:
      None

      Description

      This script:

      import groovy.transform.builder.*
      @Builder(builderStrategy=InitializerStrategy) class Foo { }
      assert Foo.createInitializer().class.name == 'Foo$FooInitializer'
      

      gives this error during compilation:

      java.lang.ClassFormatError: Duplicate method name&signature in class file Foo$FooInitializer
      

      Creating a builder for a class with no properties using this strategy doesn't really make sense; however, we should give a sensible error message in this case.

        Attachments

          Activity

            People

            • Assignee:
              paulk Paul King
              Reporter:
              paulk Paul King
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: