Can I do this with Structural Search?

The goal: find all calls of a static method "foo" on any classes derived from BaseClass.

I have a BaseClass that has many many derived classes (D1, D2, ... Dn). Each of the derived classes has its own static method called "foo" with a varying number of arguments. The name of the method is the same in all cases, but the signatures are totally different (different arguments)

I want Structural Search to find all occurences of (D1,D2...Dn).foo($anyargs$). I tried the following template:

$Instance$.$method$($arg$)

(This was copied from the standard template.)

$Instance$: Text constraint "BaseClass", applied w/in type hierarchy
$method$: Text constraint "foo", 1 occurance
$args$: no text constraint, unlimited occurence count



This partially works if I remove the $Instance$ constraint: It finds all methods named "foo". But that's too general, as there's other classes/instances that have methods called "foo" on them.

I'm beginning to think that Structural Search only works for instance methods, not static methods. In which case it can't help me. True?

2 comments
Comment actions Permalink

Hi,

Seems like a bug, will fix shortly

jpelly wrote:

The goal: find all calls of a static method "foo" on any classes derived from BaseClass.

I have a BaseClass that has many many derived classes (D1, D2, ... Dn). Each of the derived classes has its own static method called "foo" with a varying number of arguments. The name of the method is the same in all cases, but the signatures are totally different (different arguments)

I want Structural Search to find all occurences of (D1,D2...Dn).foo($anyargs$). I tried the following template:

$Instance$.$method$($arg$)

(This was copied from the standard template.)

$Instance$: Text constraint "BaseClass", applied w/in type hierarchy
$method$: Text constraint "foo", 1 occurance
$args$: no text constraint, unlimited occurence count



This partially works if I remove the $Instance$ constraint: It finds all methods named "foo". But that's too general, as there's other classes/instances that have methods called "foo" on them.

I'm beginning to think that Structural Search only works for instance methods, not static methods. In which case it can't help me. True?



--
Best regards,
Maxim Mossienko
IntelliJ Labs / JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"

0
Comment actions Permalink

http://www.jetbrains.net/jira/browse/IDEADEV-6705

jpelly wrote:

The goal: find all calls of a static[/b] method "foo" on any classes derived from BaseClass.

I have a BaseClass that has many many derived classes (D1, D2, ... Dn). Each of the derived classes has its own static[/b] method called "foo" with a varying number of arguments. The name of the method is the same in all cases, but the signatures are totally different (different arguments)

I want Structural Search to find all occurences of (D1,D2...Dn).foo($anyargs$). I tried the following template:

$Instance$.$method$($arg$)

(This was copied from the standard template.)

$Instance$: Text constraint "BaseClass", applied w/in type hierarchy
$method$: Text constraint "foo", 1 occurance
$args$: no text constraint, unlimited occurence count



This partially[/i] works if I remove the $Instance$ constraint: It finds all methods named "foo". But that's too general, as there's other classes/instances that have methods called "foo" on them.

I'm beginning to think that Structural Search only works for instance methods, not static methods. In which case it can't help me. True?



--
Best regards,
   Maxim Mossienko
IntelliJ Labs / JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"

0

Please sign in to leave a comment.