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

AIC in default argument expression of static method causes class cast exception

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 3.0.0-rc-1, 2.5.16
    • None
    • None

    Description

      Consider the following:

      class Main {
        static main(args) {
          this.meth()
        }
        static void meth(Runnable action = new Runnable() {
          @Override void run() {
            print 'works'
          }
        }) {
          action.run()
        }
      }
      

      Compiling and executing this class results in org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object 'class Main' with class 'java.lang.Class' to class 'Main'.

      See also GROOVY-6777, GROOVY-6809, GROOVY-7609 and GROOVY-9168

      Attachments

        Activity

          People

            Unassigned Unassigned
            emilles Eric Milles
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: