diff --git a/src/java.base/share/classes/java/lang/invoke/MethodHandleProxies.java b/src/java.base/share/classes/java/lang/invoke/MethodHandleProxies.java --- a/src/java.base/share/classes/java/lang/invoke/MethodHandleProxies.java +++ b/src/java.base/share/classes/java/lang/invoke/MethodHandleProxies.java @@ -281,13 +281,13 @@ switch (m.getName()) { case "toString": return (m.getReturnType() == String.class - && m.getParameterTypes().length == 0); + && m.getParameterCount() == 0); case "hashCode": return (m.getReturnType() == int.class - && m.getParameterTypes().length == 0); + && m.getParameterCount() == 0); case "equals": return (m.getReturnType() == boolean.class - && m.getParameterTypes().length == 1 + && m.getParameterCount() == 1 && m.getParameterTypes()[0] == Object.class); } return false; diff --git a/src/java.base/share/classes/java/lang/reflect/Executable.java b/src/java.base/share/classes/java/lang/reflect/Executable.java --- a/src/java.base/share/classes/java/lang/reflect/Executable.java +++ b/src/java.base/share/classes/java/lang/reflect/Executable.java @@ -378,7 +378,7 @@ private void verifyParameters(final Parameter[] parameters) { final int mask = Modifier.FINAL | Modifier.SYNTHETIC | Modifier.MANDATED; - if (getParameterTypes().length != parameters.length) + if (getParameterCount() != parameters.length) throw new MalformedParametersException("Wrong number of parameters in MethodParameters attribute"); for (Parameter parameter : parameters) { diff --git a/src/java.base/share/classes/java/util/concurrent/ForkJoinTask.java b/src/java.base/share/classes/java/util/concurrent/ForkJoinTask.java --- a/src/java.base/share/classes/java/util/concurrent/ForkJoinTask.java +++ b/src/java.base/share/classes/java/util/concurrent/ForkJoinTask.java @@ -593,10 +593,10 @@ Constructor noArgCtor = null; // public ctors only for (Constructor c : ex.getClass().getConstructors()) { - Class[] ps = c.getParameterTypes(); - if (ps.length == 0) + int parameterCount = c.getParameterCount(); + if (parameterCount == 0) noArgCtor = c; - else if (ps.length == 1 && ps[0] == Throwable.class) + else if (parameterCount == 1 && c.getParameterTypes()[0] == Throwable.class) return (Throwable)c.newInstance(ex); } if (noArgCtor != null) { diff --git a/src/java.base/share/classes/sun/reflect/annotation/AnnotationType.java b/src/java.base/share/classes/sun/reflect/annotation/AnnotationType.java --- a/src/java.base/share/classes/sun/reflect/annotation/AnnotationType.java +++ b/src/java.base/share/classes/sun/reflect/annotation/AnnotationType.java @@ -121,7 +121,7 @@ if (Modifier.isPublic(method.getModifiers()) && Modifier.isAbstract(method.getModifiers()) && !method.isSynthetic()) { - if (method.getParameterTypes().length != 0) { + if (method.getParameterCount() != 0) { throw new IllegalArgumentException(method + " has params"); } String name = method.getName();