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

default closure parameter causes BUG! exception in phase 'class generation'

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.6-rc-3, 1.6.1
    • 1.6.2, 1.7-beta-1
    • None
    • None

    Description

      When I'm calling the following closure making the range of days of a month:

      test.gr
      month = { String date = new Date().format("yyyyMM") ->
          GregorianCalendar.instance.with {
              time = Date.parse("yyyyMM", date)
              (time .. time+(getActualMaximum(Calendar.DAY_OF_MONTH)-1))
          }
      }
      
      month("200101")
      

      I'm getting the following exception:

      Caught: BUG! exception in phase 'class generation' in source unit 'C:\Groovy\test.gr' ClassNode#getTypeClass for Date is called before the type class is set

      When I'm making the same in method:

      def getDays(String date = new Date().format("yyyyMM")) {
       ...
      }
      

      everything works fine.

      Tried both 1.6.1 and 1.6

      Attachments

        Activity

          People

            roshandawrani Roshan Dawrani
            san Alexander Kleymenov
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: