On Wed, 13 Sep 2023 05:08:58 GMT, Chen Liang <li...@openjdk.org> wrote:
>> Mandy Chung has updated the pull request incrementally with one additional >> commit since the last revision: >> >> use member (not method handle) > > src/java.base/share/classes/java/lang/invoke/MethodHandle.java line 1722: > >> 1720: return this.withVarargs(true); >> 1721: } catch (IllegalArgumentException ex) { >> 1722: throw new IllegalAccessException("cannot make variable >> arity: " + this + " because " + ex.getMessage()); > > This now drops the member information (owner and name) from the message. Is > that intended? > > In addition, the original message appears to include the method type, which > can be used to diagnose why varargs is not possible (not an array for > trailing parameter). I fail to see what extra information this patch offers > that actually makes debugging easier as claimed in the JBS issue. Good catch. It's not intended. Fixed. I think in general it would be useful to make it clear in the exception message of the reason especially for those who are new in using method handles. Looking it again, it can simply hardcode the message (more friendly than IAE exception message): java.lang.IllegalAccessException: cannot make variable arity: MyClass.m(Object[],int)void/invokeStatic because not an array type: int vs java.lang.IllegalAccessException: cannot make variable arity: trailing parameter type is not an array type: MyClass.m(Object[],int)void/invokeStatic ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/15698#discussion_r1324780782