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

trait conflict resolution not available for static methods

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.0.0-alpha-1, 3.0.6
    • Component/s: None
    • Labels:
      None

      Description

      If the case mentioned in https://docs.groovy-lang.org/latest/html/documentation/#_default_conflict_resolution used static methods instead of instance methods, "T.super.m()" disambiguation is not available.

      Consider the following:

      trait A {
        static m() { 'A' }
      }
      trait B {
        static m() { 'B' }
      }
      class C implements A, B {
        void test() {
          print m() // prints "B"
          print A.super.m() // java.lang.IllegalArgumentException or some other compiler problem
          print B.super.m() // java.lang.IllegalArgumentException or some other compiler problem
        }
      }
      new C().test()‚Äč
      

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 20m
                20m