Search for methods returning a certain type?

Hi,
when I am working on a class I often want to find all methods which have a return type of the current class.

For example:

I am working on class / interface X. Now I would like to find all methods of my project which return X.

Is there a way I can do this with IntelliJ 10.5?

Thanks a lot,
Wallaby

6 comments
Comment actions Permalink

Thank you for your reply.

To me the structural search feature is one of the most opaque features of IntelliJ.
I already tried to define such a search but couldn't find a solution. Do you know of more examples how to defined my own structural search?

Another problem is that I want to call this kind of search often for different types. Is there a way to bind a
structural search to a keyboard shortcut and to set the requested return type in the search to the type where the text caret is?

Thanks,
Wallaby

0
Comment actions Permalink

wallaby.pouch wrote:

Thank you for your reply.

To me the structural search feature is one of the most opaque features of IntelliJ.
I already tried to define such a search but couldn't find a solution. Do you know of more examples how to defined my own structural search?

The easiest way is to grab existing template ('class-based' - 'methods of the class' in your use-case) and adjust its variable(s) ('ReturnType' at the mentioned template).

wallaby.pouch wrote:

Another problem is that I want to call this kind of search often for different types. Is there a way to bind a
structural search to a keyboard shortcut and to set the requested return type in the search to the type where the text caret is?

Thanks,
Wallaby


AFAIK it's not possible at the moment. Feel free to submit corresponding feature request. I would state that like 'expand SSR templates setup with ability to indicate that particular variable should be resolved from element under caret'.

Denis

0
Comment actions Permalink

Another way is to find usages > method return type? Is it appropriate?

regards, Alex

0
Comment actions Permalink

That sounds great, I can't find that option, though.

I placed the caret on a java.util.list and called Search->Find usages. All it offers is Usages, Usages of methods, Usages of fields, Implementing classes and derived interfaces.

I can't see the method return type option here.

Thanks,
Wallaby

0
Comment actions Permalink

As i see, it works only for implementations, not for abstract ones.

regards, Alex

0

Please sign in to leave a comment.