< prev index next >

src/java.base/share/classes/java/lang/invoke/MemberName.java

Print this page

        

@@ -953,18 +953,22 @@
     }
     public ReflectiveOperationException makeAccessException() {
         String message = message() + ": "+ toString();
         ReflectiveOperationException ex;
         if (isResolved() || !(resolution instanceof NoSuchMethodError ||
-                              resolution instanceof NoSuchFieldError))
+                              resolution instanceof NoSuchFieldError  ||
+                              resolution instanceof NoClassDefFoundError)) {
             ex = new IllegalAccessException(message);
-        else if (isConstructor())
+        } else if (resolution instanceof NoClassDefFoundError) {
+            ex = new ClassNotFoundException(message);
+        } else if (isConstructor()) {
             ex = new NoSuchMethodException(message);
-        else if (isMethod())
+        } else if (isMethod()) {
             ex = new NoSuchMethodException(message);
-        else
+        } else {
             ex = new NoSuchFieldException(message);
+        }
         if (resolution instanceof Throwable)
             ex.initCause((Throwable) resolution);
         return ex;
     }
 

@@ -1067,11 +1071,11 @@
                 // REFC view on PTYPES doesn't matter, since it is used only as a starting point for resolution and doesn't
                 // participate in method selection.
                 m = MethodHandleNatives.resolve(m, lookupClass);
                 m.checkForTypeAlias(m.getDeclaringClass());
                 m.resolution = null;
-            } catch (ClassNotFoundException | LinkageError ex) {
+            } catch (LinkageError ex) {
                 // JVM reports that the "bytecode behavior" would get an error
                 assert(!m.isResolved());
                 m.resolution = ex;
                 return m;
             }
< prev index next >