10

Say I have two Java classes, TradeType and InstrumentType. I know that somewhere in my codebase there is a method that maps from TradeType to InstrumentType.

How can I use Structural Search in Intellij to say

"find me all methods that have a single parameter of type TradeType and which return InstrumentType"

Mike Hogan
  • 9,933
  • 9
  • 41
  • 71

1 Answers1

15

Search template:

class $Class$ { 
    InstrumentType $MethodName$(TradeType $Parameter$);
}

Then click Edit variables..., and set the following for the MethodName variable:

  • Occurrences count: Unlimited
  • This variable is target of the search

Also pay attention to what the scope of the search is.

zagyi
  • 17,223
  • 4
  • 51
  • 48
  • 2
    This was really helpful to get me started with structural search. The docs just weren't all that useful – smac89 Apr 18 '18 at 22:59