A simple fix in core reflection to check if the number of actual and formal parameters differ before invoking the method or the constructor regardless of whether it's a specialized case or not.
------------- Commit messages: - 8300924: Method::invoke throws wrong exception type when passing wrong number of arguments to method with 4 or more parameters Changes: https://git.openjdk.org/jdk/pull/12170/files Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=12170&range=00 Issue: https://bugs.openjdk.org/browse/JDK-8300924 Stats: 85 lines in 3 files changed: 67 ins; 10 del; 8 mod Patch: https://git.openjdk.org/jdk/pull/12170.diff Fetch: git fetch https://git.openjdk.org/jdk pull/12170/head:pull/12170 PR: https://git.openjdk.org/jdk/pull/12170