jdk/src/share/classes/java/lang/invoke/MemberName.java
changeset 9752 88ab34b6da6d
parent 9646 5ebbe5ab084f
child 10419 12c063b39232
--- a/jdk/src/share/classes/java/lang/invoke/MemberName.java	Tue May 17 19:48:19 2011 -0700
+++ b/jdk/src/share/classes/java/lang/invoke/MemberName.java	Thu May 26 17:37:36 2011 -0700
@@ -506,8 +506,18 @@
         if (from != null)  message += ", from " + from;
         return new IllegalAccessException(message);
     }
-    public ReflectiveOperationException makeAccessException(String message) {
-        message = message + ": "+ toString();
+    private String message() {
+        if (isResolved())
+            return "no access";
+        else if (isConstructor())
+            return "no such constructor";
+        else if (isMethod())
+            return "no such method";
+        else
+            return "no such field";
+    }
+    public ReflectiveOperationException makeAccessException() {
+        String message = message() + ": "+ toString();
         if (isResolved())
             return new IllegalAccessException(message);
         else if (isConstructor())
@@ -641,7 +651,7 @@
             MemberName result = resolveOrNull(m, searchSupers, lookupClass);
             if (result != null)
                 return result;
-            ReflectiveOperationException ex = m.makeAccessException("no access");
+            ReflectiveOperationException ex = m.makeAccessException();
             if (ex instanceof IllegalAccessException)  throw (IllegalAccessException) ex;
             throw nsmClass.cast(ex);
         }