Review request for 8058313: Mismatch of method descriptor and MethodParameters.parameters_count should cause MalformedParameterException

Eric McCorkle eric.mccorkle at oracle.com
Wed Oct 29 22:39:22 UTC 2014


Hello,

Please review this fix for parameter reflection which addresses hotspot
falsely ignoring zero-length MethodParameter attributes.  The JVMS
allows a MethodParameters attribute with parameter_count = 0, and the
parameter reflection spec states that a MalformedParametersException
should be thrown if parameter_count does not match the number of real
parameters to a method.  Hotspot currently ignores MethodParameters
attributes with parameter_count = 0; however, in a case where a (bad)
MethodParameters attribute has parameter_count = 0, but the method has a
nonzero number of real parameters, hotspot will return null from
JVM_GetMethodParameters, the result being that a
MalformedParametersException is not thrown (rather, the reflection API
acts like there is no MethodParameters attribute).

This patch causes hotspot to record the fact that a zero-length
MethodParameters attribute does exist, causing the exception to be
thrown when it should be.

The bug is here:
https://bugs.openjdk.java.net/browse/JDK-8058313

The webrev is here:
http://cr.openjdk.java.net/~emc/8058313/


More information about the hotspot-dev mailing list