-
Notifications
You must be signed in to change notification settings - Fork 193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Default arguments: wrong Call Hiearchy results found for method call in Java class #794
Comments
ready to test |
Tested with 3.9.0.v202008162300-e1912 (the latest one found with "check for updates") but I see no change in behaviour. Should I wait for a new build? |
Sorry, yes Eclipse 2019-12 and prior have been moved to 5 daily builds (Sun-Thurs). These changes will not be available in 2019-12 until later this evening. |
OK, so I tested with 3.9.0.v202008180254-e2006 now and this is what I see. This is coherent and correct from a "binary" point of view, however since we're talking about source navigation I'm not sure this is what the user expects. I mean, what I would expect is that
IMHO Call Hierarchy is one of the most precious tool to use when you're studying some source code and/or you're evaluating some refactoring. With current behaviour the fact that |
Providing the choice dialog was the most cross-compatible solution. Searching the methods that are created from a single declaration with default values can be done with a |
How this works for Java varargs methods? There we have a single source method which can be called with a variable number of arguments too. Even if the implementation is different (a single method exists in binaries with a last array argument), isn't it a similar problem from a source analysis point of view? |
For a variadic method, there is only one method with an array as the parameter type, with a special flag set to indicate "...". It is possible for search and rename to seek out multiple targets. I have asked about Call Hierarchy and have no answer as to why it does not support extra participants. So I find that Call Hierarchy is the lowest common denominator and try to design solutions with that in mind. |
Some of this is discussed as part of #936 |
A method with default arguments is somewhere in between a variadic method and, for example, a Groovy property. As noted in #936 the same gap exists for a Groovy property as was raised by this issue. That is, Call Hierarchy is showing results for only one AST node but the single source element is represented by multiple AST nodes. I found that code select (the action behind ctrl+clicking on or hovering over a source element) can return multiple items. Unfortunately, I also found that returning more than one triggers the choice dialog instead of an "or" search. So I put this change out there to see if the choice dialog was a workable solution with the intent of applying the same solution to Groovy properties if so. As it stands, we don't have a great experience from a Call Hierarchy perspective. But at least I was able to get navigation, searching and refactoring working the same if initiated from Java or Groovy source. I will try to circle back to this and #936 if/when I can find a way to enhance the Call Hierarchy search. |
Follow up from #773.
Consider this:
And this Java class:
Put the cursor over
test42.GBean.doSomething(String, String)
and hit Ctrl+Alt+H: it finds onlyb2.doSomething("foo", "bar")
, but notb2.doSomething("foo")
.Put the cursor over
doSomething
inb2.doSomething("foo")
: references for a methodGBean.doSomething(String)
are searched, but this method does not exist in sources (similar to #776, where the call was from Groovy code however).Similar case is for the
GBean
constructors: no call is detected forGBean(String, String)
, and references for a constructorGBean(String)
(which does not exist in sources) is performed when invoking from the call site inTest43J
.The text was updated successfully, but these errors were encountered: