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

Inconsistency in method selection with @CompileStatic

    XMLWordPrintableJSON

    Details

      Description

      Running

      playground.groovy
      class A {
          void bar(String s) {
              println("A#bar(String)")
          }
      }
      
      class B extends A {
          void bar(Object o) {
              println("B#bar(Object)")
          }
      }
      
      //@groovy.transform.CompileStatic
      void usage() {
          new B().bar("") 
      }
      usage()
      

      prints A#bar(String) which is correct.

      And with uncommented @CompileStatic:

      Cannot choose between [void B#bar(java.lang.Object), void A#bar(java.lang.String)]
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                daniilo Daniil Ovchinnikov
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated: