Return-Path: Delivered-To: apmail-geronimo-xbean-dev-archive@locus.apache.org Received: (qmail 36716 invoked from network); 30 Dec 2008 00:28:21 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 30 Dec 2008 00:28:21 -0000 Received: (qmail 77948 invoked by uid 500); 30 Dec 2008 00:28:21 -0000 Delivered-To: apmail-geronimo-xbean-dev-archive@geronimo.apache.org Received: (qmail 77909 invoked by uid 500); 30 Dec 2008 00:28:21 -0000 Mailing-List: contact xbean-dev-help@geronimo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: xbean-dev@geronimo.apache.org Delivered-To: mailing list xbean-dev@geronimo.apache.org Received: (qmail 77898 invoked by uid 99); 30 Dec 2008 00:28:21 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 29 Dec 2008 16:28:21 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of david.blevins@visi.com designates 208.42.176.212 as permitted sender) Received: from [208.42.176.212] (HELO g2host.com) (208.42.176.212) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 30 Dec 2008 00:28:12 +0000 Received: from [71.106.81.39] (account dblevins@visi.com HELO [192.168.42.13]) by mailfront1.g2host.com (CommuniGate Pro SMTP 5.1.16) with ESMTPSA id 80021471 for xbean-dev@geronimo.apache.org; Mon, 29 Dec 2008 18:27:51 -0600 Message-Id: <46AE8DAD-1BBA-4E75-8949-B840C7CB3C85@visi.com> From: David Blevins To: xbean-dev@geronimo.apache.org In-Reply-To: <1b5bfeb50812291554q701bc4a4laf2f10b34f4c2aa5@mail.gmail.com> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v929.2) Subject: Re: svn commit: r729546 - in /geronimo/xbean/trunk/xbean-finder/src: main/java/org/apache/xbean/finder/ClassFinder.java test/java/org/acme/foo/FamilyHalloween.java test/java/org/acme/foo/Holiday.java test/java/org/apache/xbean/finder/ClassFinderTest. Date: Mon, 29 Dec 2008 16:27:47 -0800 References: <1b5bfeb50812291554q701bc4a4laf2f10b34f4c2aa5@mail.gmail.com> X-Mailer: Apple Mail (2.929.2) X-Virus-Checked: Checked by ClamAV on apache.org On Dec 29, 2008, at 3:54 PM, Jacek Laskowski wrote: > On Mon, Dec 29, 2008 at 6:52 PM, David Blevins > 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