I'm trying to use search structurally to find interfaces that could be annotated with @FunctionalInterface
since they only contain a single abstract method but aren't annotated yet.
My current structural search template looks like this:
@$TheAnnotation$
interface $Interface$ {
$ReturnType$ $Method$ ($ParameterType$ $Parameter$);
}
I've added the following filters
- Parameters: count ->
[0, ∞]
- TheAnnotation: script ->
TheAnnotation.getClass() != FunctionalInterface.class
but that does not seem to work as the result will contain classes annotated with @FunctionalInterface nevertheless.
IntelliJ IDEA has a "Interface may be annotated @FunctionalInterface" inspection, you may want to use instead. It has a quick fix to add the
@FunctionalInteface
annotation.But if you insist on using Structural Search, here's a template that should work:
(copy the xml and using the "Import Template from Clipboard" action under the tool button in the Structural Search dialog)