cushon commented on code in PR #16604:
URL: https://github.com/apache/kafka/pull/16604#discussion_r1692301633


##########
connect/runtime/src/main/java/org/apache/kafka/connect/runtime/isolation/ReflectionScanner.java:
##########
@@ -72,58 +75,92 @@ public class ReflectionScanner extends PluginScanner {
 
     private static <T> String versionFor(Class<? extends T> pluginKlass) 
throws ReflectiveOperationException {
         T pluginImpl = pluginKlass.getDeclaredConstructor().newInstance();
+        log.info("sx versionFor: ")
+        log.info(pluginKlass.getName());
         return versionFor(pluginImpl);
     }
 
     @Override
     protected PluginScanResult scanPlugins(PluginSource source) {
-        ConfigurationBuilder builder = new ConfigurationBuilder();
-        builder.setClassLoaders(new ClassLoader[]{source.loader()});
-        builder.addUrls(source.urls());
-        builder.setScanners(Scanners.SubTypes);
-        builder.setParallel(true);
-        Reflections reflections = new Reflections(builder);
-
-        return new PluginScanResult(
-                getPluginDesc(reflections, PluginType.SINK, source),
-                getPluginDesc(reflections, PluginType.SOURCE, source),
-                getPluginDesc(reflections, PluginType.CONVERTER, source),
-                getPluginDesc(reflections, PluginType.HEADER_CONVERTER, 
source),
-                getTransformationPluginDesc(source, reflections),
-                getPredicatePluginDesc(source, reflections),
-                getServiceLoaderPluginDesc(PluginType.CONFIGPROVIDER, source),
-                getServiceLoaderPluginDesc(PluginType.REST_EXTENSION, source),
-                
getServiceLoaderPluginDesc(PluginType.CONNECTOR_CLIENT_CONFIG_OVERRIDE_POLICY, 
source)
-        );
+        ClassGraph classGraphBuilder = new ClassGraph().enableClassInfo()
+                .overrideClassLoaders(new ClassLoader[]{source.loader()})

Review Comment:
   The use of `overrideClassLoaders` and `overrideClasspath` below is 
preventing ClassGraph from processing other classes that are necessary to make 
`getSubclasses` and getClassImplementing` work.
   
   I was able to get `PluginScannerTest` using 
`.addClassLoader(source.loader())` and making a few other changes, I have a 
demo in https://github.com/apache/kafka/pull/16690 that is make progress on CI.
   
   What do you think?



-- 
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