RFR: 8267509: Improve IllegalAccessException message to include the cause of the exception
Chen Liang
liach at openjdk.org
Wed Sep 13 05:11:37 UTC 2023
On Wed, 13 Sep 2023 01:12:52 GMT, Mandy Chung <mchung at openjdk.org> wrote:
> This PR improves IllegalAccessException message thrown by `Lookup::findXXX` APIs if the method's variable arity modifier bit is set and `asVarargsCollector` fails. It will increase the exception message thrown by asVarargsCollector`.
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.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/15698#discussion_r1323975225
More information about the core-libs-dev
mailing list