How to search annotations in eclipse java search

I would like to find all the annotations used in the project (annotations that are assigned to a type, field or method ). I was hoping a Java search would help me with this, but I was not able to do the job.

PS I can't just search @ because it is also used in javadocs.

PS 2. I do not know all the annotations that are used in the project, so I can not find it by name.

+6
source share
1 answer

Try: CTRL-H -> File Search, check case and regular expression and type:

  • @ [AZ] for containing text
  • *. java for file name patterns
  • may limit the scope to selected resources (and choose your project earlier)

This way you will find all occurrences of the type "@ followed by any uppercase character." Usually this should leave out javadocs and leave you with real annotation events.

+6
source

Source: https://habr.com/ru/post/902100/


All Articles