Yash
Yash

Reputation: 5325

Intellij Structural search functional interfaces

I've finally changed the java version of my android project to 8. Now, I want to use structural search to find all existing functional interfaces and replace them with lambdas.

I've reached till the point where I can find the Anonymous classes :

new $AnonymousClass$() {
    @Override
    public void $MethodName$() {
        $Expr$;
    }
}

But, the problem is it'll list those anonymous classes also which are not functional interfaces and therfore can't be converted to lambdas.

How do I refine my query to find only the functional interfaces?

Upvotes: 0

Views: 97

Answers (1)

Bas Leijdekkers
Bas Leijdekkers

Reputation: 26462

Have you tried using the built-in inspections
Java | Java language level migration aids | Java 8 | Anonymous type can be replaced with lambda and Java | Java language level migration aids | Java 8 | Anonymous type has shorter lambda alternative? Those also have quick fixes to do the replacing for you.

Upvotes: 1

Related Questions