richardstartin commented on a change in pull request #7400:
URL: https://github.com/apache/pinot/pull/7400#discussion_r705193813



##########
File path: 
pinot-spi/src/main/java/org/apache/pinot/spi/plugin/PluginClassLoader.java
##########
@@ -31,27 +32,53 @@
 public class PluginClassLoader extends URLClassLoader {
 
   private final ClassLoader _classLoader;
+  private Method _addUrlMethod = null;
 
   public PluginClassLoader(URL[] urls, ClassLoader parent) {
     super(urls, parent);
     _classLoader = PluginClassLoader.class.getClassLoader();
+    
+    /**
+     * ClassLoader in java9+ does not extend URLClassLoader.
+     * If the class is not found in the parent classloader,
+     * it will be found in this classloader via findClass().
+     *
+     * @see https://bit.ly/2WROm1s
+     */
+
+    if (_classLoader instanceof URLClassLoader) {
+      try {
+        _addUrlMethod = URLClassLoader.class.getDeclaredMethod("addURL", 
URL.class);
+      } catch (NoSuchMethodException e) {
+        //this should never happen
+        ExceptionUtils.rethrow(e);
+      }
+      
+      _addUrlMethod.setAccessible(true);

Review comment:
       Whilst this is common in the pinot codebase, doing things like this 
prevents use on JDK16+, creating obstacles to adoption of highly relevant JDK 
innovations (Vector API, foreign memory access, foreign function interface and 
so on).  




-- 
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: commits-unsubscr...@pinot.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org
For additional commands, e-mail: commits-h...@pinot.apache.org

Reply via email to