src/share/classes/java/lang/invoke/MethodHandleNatives.java

Print this page

        

@@ -446,11 +446,11 @@
             return defc == java.lang.Class.class;
         case "getConnection":
         case "getDriver":
         case "getDrivers":
         case "deregisterDriver":
-            return defc == java.sql.DriverManager.class;
+            return defc == getClass("java.sql.DriverManager");
         case "newUpdater":
             if (defc == java.util.concurrent.atomic.AtomicIntegerFieldUpdater.class)  return true;
             if (defc == java.util.concurrent.atomic.AtomicLongFieldUpdater.class)  return true;
             if (defc == java.util.concurrent.atomic.AtomicReferenceFieldUpdater.class)  return true;
             break;

@@ -480,6 +480,16 @@
         case "clearCache":
             return defc == java.util.ResourceBundle.class;
         }
         return false;
     }
+
+    // avoid static dependency to a class in other modules
+    private static Class<?> getClass(String cn) {
+        try {
+            return Class.forName(cn, false,
+                                 MethodHandleNatives.class.getClassLoader());
+        } catch (ClassNotFoundException e) {
+            throw new InternalError(e);
+        }
+    }
 }