Question

Eclipse JDT has a 'call hierarchy' feature -- start from a field/method and it recursively finds all references.

IntelliJ also implements this, but it only works from methods. For fields, you can only 'Find Usages', so if you want to dig deeper you have to do additional searches.

Tried 'Dataflow to here', but it's not what I'm looking for.

Am I missing something? Is there a better way to explore field usage in IntelliJ?

Was it helpful?

Solution

EDIT

The issue below has been resolved and IntelliJ IDEA 2019.3 will have this feature.

EDIT 2

I downloaded:

IntelliJ IDEA 2019.3 EAP (Community Edition)
Build #IC-193.3793.14, built on September 25, 2019

But it seems this issue was not fixed correctly, the call hierarchy for fields does not take you to the actual usage of the field in the method rather to the line of the method definition.

See: https://youtrack.jetbrains.net/issue/IDEA-160274#focus=streamItem-27-3721096.0-0

Original answer

IntelliJ doesn't have this feature, however there is a feature request here: https://youtrack.jetbrains.com/issue/IDEA-160274

If you would like the feature implemented, you can vote there.

OTHER TIPS

Select the method you're interested in and then use from the top menu "Navigate > Call Hierarchy" or simply Ctrl+Alt+H.

AFAIK this doesn't work for fields, because when I select a field, the "Navigate > Call Hierarchy" option becomes grayed-out. The only similar featutes I'm aware of for fields are "Edit > Find > Find Usages" (Alt+F7) and "Edit > Find > Show Usages" (Ctrl+Alt+F7).

"Dataflow to here" and "Dataflow from here" give you a recursive view of data flowing in to, and out of, fields (or local variables).

I think that these two features, in fact, are what you're after. If not, can you rephrase the question in less IDE-specific terms? In other words: what information do you want to extract from your codebase?

Use "Find Usages" feature (Alt+F7)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top