1.1 --- a/src/share/vm/runtime/sharedRuntime.hpp Wed Apr 08 00:12:59 2009 -0700 1.2 +++ b/src/share/vm/runtime/sharedRuntime.hpp Wed Apr 08 10:56:49 2009 -0700 1.3 @@ -212,10 +212,32 @@ 1.4 static char* generate_class_cast_message(JavaThread* thr, const char* name); 1.5 1.6 /** 1.7 + * Fill in the message for a WrongMethodTypeException 1.8 + * 1.9 + * @param thr the current thread 1.10 + * @param mtype (optional) expected method type (or argument class) 1.11 + * @param mhandle (optional) actual method handle (or argument) 1.12 + * @return the dynamically allocated exception message 1.13 + * 1.14 + * BCP for the frame on top of the stack must refer to an 1.15 + * 'invokevirtual' op for a method handle, or an 'invokedyamic' op. 1.16 + * The caller (or one of its callers) must use a ResourceMark 1.17 + * in order to correctly free the result. 1.18 + */ 1.19 + static char* generate_wrong_method_type_message(JavaThread* thr, 1.20 + oopDesc* mtype = NULL, 1.21 + oopDesc* mhandle = NULL); 1.22 + 1.23 + /** Return non-null if the mtype is a klass or Class, not a MethodType. */ 1.24 + static oop wrong_method_type_is_for_single_argument(JavaThread* thr, 1.25 + oopDesc* mtype); 1.26 + 1.27 + /** 1.28 * Fill in the "X cannot be cast to a Y" message for ClassCastException 1.29 * 1.30 * @param name the name of the class of the object attempted to be cast 1.31 * @param klass the name of the target klass attempt 1.32 + * @param gripe the specific kind of problem being reported 1.33 * @return the dynamically allocated exception message (must be freed 1.34 * by the caller using a resource mark) 1.35 * 1.36 @@ -224,7 +246,8 @@ 1.37 * The caller (or one of it's callers) must use a ResourceMark 1.38 * in order to correctly free the result. 1.39 */ 1.40 - static char* generate_class_cast_message(const char* name, const char* klass); 1.41 + static char* generate_class_cast_message(const char* name, const char* klass, 1.42 + const char* gripe = " cannot be cast to "); 1.43 1.44 // Resolves a call site- may patch in the destination of the call into the 1.45 // compiled code.