On Dec 29, 2008, at 3:54 PM, Jacek Laskowski wrote:

On Mon, Dec 29, 2008 at 6:52 PM, David Blevins <david.blev...@visi.com> wrote:

Unfortunately, we can't do it this way as it will cause every class in the classpath to be loaded. We need to do the search with the metadata we keep
from scanning the byte code with asm.

Yeah, I wish I knew how to do it. I tried some asm woodoo, but after a
couple of hours scratching my head I ended up with the
not-so-brilliant-but-working solution. I didn't know how to traverse
the inheritance hierarchy with asm. Wait, should I do/while as it is
now, but instead of clazz.isAnnotationPresent run some asm parsing
woodoo? I'd like to work on it, but need some advice.

Sure, no problem. We already do all the asm voodoo in the ClassFinder constructor and the ClassInfo object you were calling the get() method on is part of the resulting metadata we collected from ASM. The code you have could be adapted to call methods of ClassInfo instead of Class. I'd call ClassFinder.isAnnotationPresent() real quick before doing a search just to see if it's worth the time. It will be limited unfortunately to situations where the parent class containing the annotation is in scope of the ClassFinder (i.e. if they put it in a different jar and classfinder wasn't told to look there, then it won't come up as having that annotation as we won't have asm data for it).

-David

Reply via email to