Closed CarlosMOGoncalves closed 1 year ago
check this option may solve this problem.
I expect that an occurence of a method call is calculated in the same way as "Open Call Hierarchy" option or at least that shows the call occurences in the workspace.
I agree.
Hello @humphreygao,
Thanks for the quick reply. Indeed, this prevents those results to be counted as matches. Solves it, basically.
However, I think this brings up the point: should these kind of "potential matches" be considered in Code Minings? Because I think Code Minings is extremely useful for quick checking references to methods (and types, fields), specially to quickly understand and consider dependencies... but these results must be very accurate or they risk losing their value.
Surely, showing potential matches, by default, is not what is expected and potentially highly misleading.
Here's an example. This is a screenshot from a somewhat more complex project I have. There is a JPA entity that has a method called getType(), similar to the one in the issue description. On Code Minings this shows 123 references (!!!), but most of those are in fact from 3rd party libraries which my project depend on which naturally cannot be referencing my project. Check below:
The actual expected results for this Code Mining is rather this (now with potential matches disabled):
All of these references are actually in my own project, which is what is correct and expected.
What do the developers think about this? Wouldn't it be much more accurate to perform the Code Minings default reference search withous "potential matches"?
What do the developers think about this? Wouldn't it be much more accurate to perform the Code Minings default reference search withous "potential matches"?
Could ask @angelozerr as he is the original developer of code mining https://github.com/angelozerr/jdt-codemining
@jdneo 在写代码时,Eclipse的codelens跳来跳去的,处于几乎不可用状态,但是VS Code就好多了,是怎么做到的?
@humphreygao VS Code has a dedicated job for document update. When trying to resolve the code lens, we will first wait the document update job is finished.
Take the debugger's Run | Debug
code lens as an example: https://github.com/microsoft/java-debug/blob/42f9ac7d4843b75b1fdde64762d8c5ce4a4c51b2/com.microsoft.java.debug.plugin/src/main/java/com/microsoft/java/debug/plugin/internal/ResolveMainMethodHandler.java#L51-L55
| What do the developers think about this? | Wouldn't it be much more accurate to perform the Code Minings default reference search withous "potential matches"?
I think this could be accomplished by adding a specific option to the Code Minings preferences and not rely on the Search settings which are in another preference page which is unintuitive. This option could be set to Ignore by default. What do you think?
Hello @jjohnstn ,
Those are my thoughts exactly. As a user I think this would definitely be more intuitive. All functionality related to Code Minings should be inside the Code Minings preferences.
A lot can be said about the sheer amout of Preferences in Eclipse out of the box, with a lot of them being really hard to find, some being contraditory and a lot of overlapping.
But this particular case is one that would really benefit from not relying on other settings.
Thanks @jjohnstn
Description
Hello there,
I noticed Code Minings is not calculating correct occurences of, at least, methods. This has likely something to do with the way occurences are found. I don't know when it started working like this.
Expected Outcome
I expect that an occurence of a method call is calculated in the same way as "Open Call Hierarchy" option or at least that shows the call occurences in the workspace.
Current Outcome
Some methods, depending on their name and/or signature will be marked has having
"X occurences"
but these don't match any actual call of that method, but rather any other method with the same name that can be somehow found in the classpath.Steps to reproduce
I have prepared a sample application that has a very simple Payara Micro application, whose kind is irrelevant to the case in point. It can be found here
This app does nothing special. It has a Jakarta REST endpoint but that is just for show.
mvn clean install
on itNumericUtils.java
, methodgetType()
:TestResource#get()
:Final note
Environment