GRECLIPSE
  1. GRECLIPSE
  2. GRECLIPSE-1244

Open declaration on static method in parent class from child method selects child class name

    Details

    • Type: Bug Bug
    • Status: Resolved Resolved
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 2.5.2.Release
    • Fix Version/s: 2.6.1.M1
    • Component/s: Inferencing Engine
    • Labels:
      None
    • Number of attachments :
      0

      Description

      In Parent.groovy:

      class Parent {
          static p() {}
      }
      

      In Child.groovy:

      class Child extends Parent {
          def c() {
              p()
          }
      }
      

      Control-clicking (or pressing F3) on p in Child.groovy will select Child and not navigate to Parent.p

        Activity

        Hide
        Andrew Eisenberg added a comment -

        Thanks for this. It is reproducible and is likely a regression (although I apparently don't have any tests for this). I'm bumping up the priority.

        It looks like it is a bug in the code select logic since searching and mark occurrences work as expected.

        Show
        Andrew Eisenberg added a comment - Thanks for this. It is reproducible and is likely a regression (although I apparently don't have any tests for this). I'm bumping up the priority. It looks like it is a bug in the code select logic since searching and mark occurrences work as expected.
        Hide
        Andrew Eisenberg added a comment -

        Hmmm...a quick look is showing that the AST is incorrect at the location of the method call. The AST node of the p() is of type StaticMethodCall. An instance of this type has a method getOwner, which should point to the type that declares the static method. However, in this case, the getOwner is of type Child (even though it should be Parent).

        I need to look deeper into the compiler this to see why this is happening. I definitely could work around this problem, but I'd prefer to find the root cause.

        Show
        Andrew Eisenberg added a comment - Hmmm...a quick look is showing that the AST is incorrect at the location of the method call. The AST node of the p() is of type StaticMethodCall . An instance of this type has a method getOwner , which should point to the type that declares the static method. However, in this case, the getOwner is of type Child (even though it should be Parent ). I need to look deeper into the compiler this to see why this is happening. I definitely could work around this problem, but I'd prefer to find the root cause.
        Hide
        Andrew Eisenberg added a comment -

        My assumption about what the correct AST should look like was wrong. And so the code that you pasted above never worked. I created a fix for this. Now, type inferencing does not choose the declaring type based on the owner, rather it actually searches for the real definition of the static method. This appears to work and I have a few regression tests. Will commit shortly.

        Show
        Andrew Eisenberg added a comment - My assumption about what the correct AST should look like was wrong. And so the code that you pasted above never worked. I created a fix for this. Now, type inferencing does not choose the declaring type based on the owner , rather it actually searches for the real definition of the static method. This appears to work and I have a few regression tests. Will commit shortly.
        Hide
        Andrew Eisenberg added a comment -

        Committed fix.

        Show
        Andrew Eisenberg added a comment - Committed fix.

          People

          • Assignee:
            Andrew Eisenberg
            Reporter:
            Bob Tiernay
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: