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

Problem by extends class in groovy 1.5

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Blocker
    • Resolution: Fixed
    • 1.5
    • 1.5.1
    • None
    • None
    • Windows XP

    Description

      Hello everyone,

      A massive change in the attitude of groovy 1.5 to groovy 1.1B3

      Consider the following 3 files

      ---------- Basis ------------------------------
      Superclass sc = new Extendclass()

      println sc.sayName()
      -----------------------------------------------

      ---------- Superklasse ------------------------
      class Superclass {
      def sayName = {
      return this.getClass().getName()
      }
      }
      -----------------------------------------------

      --------- abgeleitete Klasse ------------------
      class Extendclass extends Superclass {
      def sayName = {
      return "Ich bin Extendclass"
      }
      }
      -----------------------------------------------

      Here are the console outputs:

      ==================== 1.1B3 ==========================

      $groovy -v
      Groovy Version: 1.1-beta-3 JVM: 1.6.0_02-b06

      $groovy -cp %cd% callclass.groovy
      Ich bin Extendclass

      $

      ==================== 1.5 ==========================

      $groovy -v
      Groovy Version: 1.5.0 JVM: 1.6.0_02-b06
      $groovy -cp %cd% callclass.groovy
      Extendclass
      $

      Now this is really bad!
      Apparently are the named Closures not overwritten!

      Can anyone understand this? Or I am making a mistake?

      Please see also the thread "http://www.nabble.com/Problem-by-extends-class-in-groovy-1.5-to14290776.html#a14293842 " in Nabble.

      \ ^ / ili
      (Wilhelm Nagy)

      Attachments

        Activity

          People

            blackdrag Jochen Theodorou
            wnagy Wilhelm Nagy
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: