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

@Delegate to a method with optional params

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.4.0-rc-1
    • 4.0.0-beta-1, 2.5.16, 3.0.10
    • xforms
    • None

    Description

      Groovyc fails to compile this code with a message like 'method foo is already defined in B'

      class A {
        def foo(a = ''){}
      }
      
      class B {
        @Delegate A a = new A()
        def foo(){}
      }
      

      while these snippets are compiled pretty well

      class A {
        def foo(a){}
        def foo(){}
      }
      
      class B {
        @Delegate A a = new A()
        def foo(){}
      }
      
      class A {
        def foo(a=''){}
      }
      
      class B extends A{
        def foo(){}
      }
      

      IMHO there should be a warning (or nothing at all) instead of the compilation error.

      Attachments

        Activity

          People

            emilles Eric Milles
            mxm-groovy Maxim Medvedev
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: