5

Is there a way for IntelliJ to locate all the places in my code that define an anonymous class?

I am asking just about finding, not changing. I am not asking about converting to lambdas, lambdas are irrelevant here.

Bas Leijdekkers
  • 23,709
  • 4
  • 70
  • 68
Basil Bourque
  • 303,325
  • 100
  • 852
  • 1,154
  • 1
    https://blog.jetbrains.com/idea/2011/11/navigate-to-anonymous-classes-with-intellij-idea-11-eap-build-110291/ may be helpful. – Gimhani Sep 06 '18 at 05:57

1 Answers1

8

Yep. You can use the Structural Search feature.

Edit -> Find -> Search Structurally…

There is already a default template for "Anonymous Classes".

  • Click Existing Templates
  • Under Java -> Class-based choose anonymous classes
  • Click OK
  • Tweak the search options (if you need) and click Find

enter image description here

enter image description here

Basil Bourque
  • 303,325
  • 100
  • 852
  • 1,154
Strelok
  • 50,229
  • 9
  • 102
  • 115