I suppose it depends whether you want to do this at compile time or runtime, and whether it's enought to do this while using your own development tools, or you need to more general platform-independent solution. Using IntelliJ IDEA, for example, you can just right-click on an annotation and search for uages in the project. I assume something similar is possible in Eclipse as well. You may also be interested in the jdk's
annotation processing tool. Or you can use reflection. With all these, you need to somehow specify the input source files or class files to be scanned (though in the case of your
IDE, you've already done that). I'm not sure which of these approaches might be closest to what you're looking for.