Find all anonymous classes throughout my project in IntelliJ

Basil Bourque :

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.

Strelok :

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

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=88539&siteId=1