Reputation: 1842
I'm trying to use IntelliJ 10.5's "structural search" feature to find classes that implement an interface, A but do not implement another interface, B.
By searching first for classes that implement A, and then limiting the search scope to 'previous search results,' it's easy to reduce this to just searching for classes that do not implement B, which is conceptually pretty simple. Unfortunately, I haven't yet managed to pull it off.
If I search for
class $clazz$ implements $B$ {}
and then tick 'invert condition' in the text constraints for variable B, it seems to find 'all classes that implement something other than B' even if they also implement B. I've also tried ticking 'invert condition' on the 'complete match' variable, and its effect is not immediately obvious, but definitely not what I'm looking for.
Inicidentaly, someone else asked a similar question on the IntelliJ forums, but got no love. Help me out, stackoverflow!
Upvotes: 6
Views: 3655
Reputation: 678
To find classes that implement InterfaceA, but don't implement InterfaceB, I did the following:
Note I had problems when I tried to use the Edit Query button at step 8. I didn't research/retry, but going back to the menu and selecting Search > Search Structurally definitely worked.
Upvotes: 3