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

ambiguous method error for tap on null receiver

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.0.19, 5.0.0-alpha-2, 4.0.15
    • 3.0.20, 5.0.0-alpha-3, 4.0.16
    • None
    • None

    Description

      Consider the following:

      abstract class A {
        abstract  m(List list, String string)
      }
      class C extends A {
        @Override m(List list, String string) {
          print 'works'
        }
      }
      
      Object test(List list, String string) {
        list.tap {
          new C().m(it,string)
        }
      }
      test(null,"")
      

      "list.tap{" propagates NullObject into closure and then method selection falls down.

      Attachments

        1. DgmConverter.java
          12 kB
          Eric Milles

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: