changeset 24222:a86e69d2d92e

ClassNotFoundException thrown by CompilerToVM.lookupType() should be converted to a LinkageError (JDK-8186459)
author Doug Simon <doug.simon@oracle.com>
date Fri, 18 Aug 2017 21:16:58 +0200
parents f32391b837d5
children 1f8fa81f0c7d
files jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/CompilerToVM.java jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIRuntime.java
diffstat 2 files changed, 10 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/CompilerToVM.java	Fri Aug 18 17:27:07 2017 +0200
+++ b/jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/CompilerToVM.java	Fri Aug 18 21:16:58 2017 +0200
@@ -156,7 +156,7 @@
      * @return the type for {@code name} or 0 if resolution failed and {@code resolve == false}
      * @throws LinkageError if {@code resolve == true} and the resolution failed
      */
-    native HotSpotResolvedObjectTypeImpl lookupType(String name, Class<?> accessingClass, boolean resolve);
+    native HotSpotResolvedObjectTypeImpl lookupType(String name, Class<?> accessingClass, boolean resolve) throws ClassNotFoundException;
 
     /**
      * Resolves the entry at index {@code cpi} in {@code constantPool} to an object.
--- a/jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIRuntime.java	Fri Aug 18 17:27:07 2017 +0200
+++ b/jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIRuntime.java	Fri Aug 18 21:16:58 2017 +0200
@@ -366,13 +366,17 @@
 
         // Resolve non-primitive types in the VM.
         HotSpotResolvedObjectTypeImpl hsAccessingType = (HotSpotResolvedObjectTypeImpl) accessingType;
-        final HotSpotResolvedObjectTypeImpl klass = compilerToVm.lookupType(name, hsAccessingType.mirror(), resolve);
+        try {
+            final HotSpotResolvedObjectTypeImpl klass = compilerToVm.lookupType(name, hsAccessingType.mirror(), resolve);
 
-        if (klass == null) {
-            assert resolve == false;
-            return HotSpotUnresolvedJavaType.create(this, name);
+            if (klass == null) {
+                assert resolve == false;
+                return HotSpotUnresolvedJavaType.create(this, name);
+            }
+            return klass;
+        } catch (ClassNotFoundException e) {
+            throw (NoClassDefFoundError) new NoClassDefFoundError().initCause(e);
         }
-        return klass;
     }
 
     public JVMCIBackend getHostJVMCIBackend() {