On Dec 26, 2008, at 2:20 PM, jlaskow...@apache.org wrote:

+ public List<Class> findInheritedAnnotatedClasses(Class<? extends Annotation> annotation) {
+        classesNotLoaded.clear();
+        List<Class> classes = new ArrayList<Class>();
+        for (ClassInfo classInfo : classInfos) {
+            try {
+                Class clazz = classInfo.get();
+                do {
+                    if (clazz.isAnnotationPresent(annotation)) {
+                        classes.add(classInfo.get());
+                        break;
+                    }
+                    clazz = clazz.getSuperclass();
+                } while (clazz != null && clazz != Object.class);
+            } catch (ClassNotFoundException e) {
+                classesNotLoaded.add(classInfo.getName());
+            } catch (NoClassDefFoundError e) {
+                classesNotLoaded.add(classInfo.getName());
+            }
+        }
+        return classes;
+    }

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.

-David

Reply via email to