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

IncompatibleClassChangeError when implementing a class instead of extending it

    XMLWordPrintableJSON

Details

    Description

      Inside a script, I was writing a new Builder class, by extending BuilderSupport, but I mistakenly implemented the base class, instead of extending it, and I got this error:

      IncompatibleClassChangeError: Implementing class

      The solution was to replace "implements" with "extends" but the error was misleading and not obious.

      Here is a script which shows the problem in action:

      println "error"

      class GrammarBuilder implements BuilderSupport {
      def createNode(name, Map map, closure) {}
      void setParent(name, closure) {}
      def createNode(name, Map map) {}
      Object createNode(name, closure) {}
      Object createNode(name) {}
      }

      Attachments

        Activity

          People

            blackdrag Jochen Theodorou
            guillaume Guillaume Sauthier
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: