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

Jiangli Zhou jiangli.zhou at oracle.com
Thu Oct 30 00:36:48 UTC 2014


Hi Eric,

I wonder if we could specialize this particular case and avoid changing 
the parsing code.  How about setting the _has_method_parameters flag in 
the ConstMethod when encounter such MethodParameter, and changing 
JVM_GetMethodParameters() to return non-NULL value for such case when 
_has_method_parameters is true but method_parameters_length is 0. Would 
that work?

Thanks,
Jiangli

On 10/29/2014 03:39 PM, Eric McCorkle wrote:
> 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