Find all method calls with a specific parameter type using IntelliJ

I have this code base, which is quite large (+/- 500 thousand lines). I look in it for all method calls that use one parameter, and this parameter is a specific type.

This means that I want to find method calls, for example:

public class Foo { }
public class Bar { }

public class Doer{
  public void doSomethingFoo(Foo foo) {  }
  public void doSomethingObject(Object object) {  }
}

public class Usage {
  Doer doer = new Doer();
  public doSomething() {
    Foo anObject = new Foo();
    Bar bar = new Bar();

    doer.doSomethingFoo(anObject);
    doer.doSomethingObject(anObject);

    doer.doSomethingObject(bar);
  }
}

Because both doer.doSomethingFoo(anObject)and are called doer.doSomethingObject(anObject), both of these sentences must be returned by the search. Similarly, it doer.doSomethingObject(bar)does not return. Of course, I do not know what exists doer.

I am trying to use IntelliJ Structural Search for this. I used the following template $Instance$.$Method$($Parameter$)with the following parameters:

$Instance$  -> Text/regexp   = .*
$Method$    -> Text/regexp   = .*
$Parameter$ -> Text/regexp   = Foo
               Minimum count = 1     // Minimum one Foo parameter
               Maximum count = 1     // Maximum one Foo parameter

, foo ( , ). , , - . ? , foo?

+4
1

. , , Expression type (regexp) $Parameter $to Foo Text/regexp . , Apply constraint within type hierarchy, Foo .

, Text/regexp . .*.

+2

All Articles