davsclaus commented on code in PR #31223:
URL: https://github.com/apache/camel/pull/31223#discussion_r4766621750


##########
components/camel-jandex/src/main/java/org/apache/camel/jandex/JandexPackageScanClassResolver.java:
##########
@@ -115,37 +149,19 @@ private void findByAnnotation(Class<? extends Annotation> 
c, Set<Class<?>> class
         }
     }
 
-    private void findBySubClass(Class<?> c, Set<Class<?>> classes) {
+    private static void addCandidate(ClassInfo ci, Set<String> names) {
+        // annotation types are abstract, so they are skipped too
+        if (ci.nestingType() == ClassInfo.NestingType.TOP_LEVEL && 
!ci.isAbstract()) {
+            names.add(ci.name().toString());
+        }
+    }
+
+    private void findBySubClass(Class<?> c, Set<String> names) {
         for (Index index : indexes) {
-            if (c.isInterface()) {
-                for (var ai : index.getAllKnownImplementations(c)) {
-                    if (!ai.asClass().isAbstract()) {
-                        String currentClass = ai.asClass().name().toString();
-                        for (ClassLoader cl : getClassLoaders()) {
-                            try {
-                                Class<?> clazz = cl.loadClass(currentClass);
-                                classes.add(clazz);
-                                break;
-                            } catch (ClassNotFoundException e) {
-                                // ignore
-                            }
-                        }
-                    }
-                }
-            } else {
-                for (var ai : index.getAllKnownSubclasses(c)) {
-                    if (!ai.isAbstract()) {
-                        String currentClass = ai.asClass().name().toString();
-                        for (ClassLoader cl : getClassLoaders()) {
-                            try {
-                                Class<?> clazz = cl.loadClass(currentClass);
-                                classes.add(clazz);
-                                break;
-                            } catch (ClassNotFoundException e) {
-                                // ignore
-                            }
-                        }
-                    }
+            var found = c.isInterface() ? index.getAllKnownImplementations(c) 
: index.getAllKnownSubclasses(c);
+            for (ClassInfo ci : found) {
+                if (!ci.isAbstract()) {

Review Comment:
   Same point as the earlier thread on `findBySubClass`, answered there: the 
classpath scan (`DefaultPackageScanClassResolver`) also finds concrete nested 
implementations, so keeping the subclass path without the `TOP_LEVEL` filter 
matches it. Resolving.
   
   _Claude Code on behalf of davsclaus_



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to