8267509: Improve IllegalAccessException message to include the cause of the exception

Backport-of: 36314a90c1
This commit is contained in:
Aleksey Shipilev
2023-11-01 13:36:57 +00:00
committed by Vitaly Provodin
parent 382c027f3b
commit 40dd000216

View File

@@ -1719,7 +1719,8 @@ assertEquals("[three, thee, tee]", asListFix.invoke((Object)argv).toString());
try {
return this.withVarargs(true);
} catch (IllegalArgumentException ex) {
throw member.makeAccessException("cannot make variable arity", null);
throw new IllegalAccessException("cannot make variable arity: " + member +
" does not have a trailing array parameter");
}
}