groovy / groovy/groovy-eclipse

Issue with "Call Hierarchy" and Groovy properties

Open
#936 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Java
Stars
681
Forks
197
PR merge metrics
No merged PRs in 30d

Description

Maybe this is related to the improvements you made for 3.4.0 and you cite in the release notes (paragraph "Call Hierarchy and Find Occurrences"), but I feel like there's a problem with Call Hierarchy invoked on class properties on recent builds (maybe it has always worked like this? I can't check).

Consider the same example code as in #935: if I invoke Ctrl+Alt+H on MyBean.foo I don't get any results, while I would expect to find the access at Test53.doSomething(), which is indeed an implicit setter call.

I don't know the internals, but it seems like invoking Call Hierarchy on a field causes that view to be set in "property access" mode rather than in "method call" mode. And, from this point of view, what I see for the example in #935 is correct (i.e.: there's no direct field access). However with Groovy, since we indeed have implicit getter and setter methods generated for that property, an actual "method call" reference exists for MyBean.foo and it's the one I would expect to find in the Call Hierarchy.

Indeed, I would have assumed "Call Hierarchy" just shows "method Calls": in fact when I read the 3.4.0 release notes I did not agree with the change you mention about implicit-this references, because for that case Groovy uses direct field accesses, not method calls. However I just realised that "Call Hierarchy" actually shows field accesses when invoked on class fields, so you are right and I was wrong... Nevertheless, I feel there's something unexpected here.

What do you think? Is there a way to make Call Hierarchy work in a "mixed" mode, showing both field accesses and implicit method calls for class properties?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the Call Hierarchy behavior described for MyBean.foo and Test53.doSomething(), using the example from #935. Trace the Call Hierarchy entry point and compare property-access results with the expected implicit setter call; done means the intended property and method references are consistently shown.

Written by the indexing model from the issue text.

Assessment

Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.