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

Incorrect resolve of category property for String

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.4.0-rc-1
    • 4.0.0-beta-1, 3.0.9
    • Compiler
    • None

    Description

      Assume you have two category methods with String and CharSequence as first parameters respectively. The bug is that Groovy prefers the 'CharSequence' method for String qualifier.
      The bug is reproduced only for String and CharSequence types.
      Direct accessor invoking returns correct result.

      class Cat {
        static getFoo(String s) {'String'}
        static getFoo(CharSequence s) {'CharSequence'}
      }
      
      use (Cat) {
        assert 'abc'.getFoo() == 'String'   //works
        assert 'abc'.foo      == 'String'   //fails
      }
      

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: