changeset 6186:09bef1e118e3

8003851: MethodHandleNatives dependency on java.sql.DriverManager Reviewed-by: alanb, dholmes
author mchung
date Wed, 28 Nov 2012 10:49:15 -0800
parents 262b3b2f3aa3
children 80ddee59a21d
files src/share/classes/java/lang/invoke/MethodHandleNatives.java
diffstat 1 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/java/lang/invoke/MethodHandleNatives.java	Wed Nov 28 10:08:31 2012 -0800
+++ b/src/share/classes/java/lang/invoke/MethodHandleNatives.java	Wed Nov 28 10:49:15 2012 -0800
@@ -448,7 +448,7 @@
         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;
@@ -482,4 +482,14 @@
         }
         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);
+        }
+    }
 }