RFR: 5047859 : (reflect) Class.getField can't find String[].length
Mandy Chung
mandy.chung at oracle.com
Mon Aug 26 17:26:35 UTC 2013
Joel,
The spec of the getFields and getDeclaredFields() methods both states this:
This method returns an array of length 0 if the class
or interface declares no fields, or if this|Class| object
represents a primitive type, an array class, or void.
The spec of the getDeclaredField() method has this sentence:
Note that this method will not reflect the {@code length}
field of an array class.
Your change is okay and it would be good to keep the getField(s)
and getDeclaredField(s) methods be consistent and states its
return value "if this|Class| object represents a primitive type,
an array class, or void"
Mandy
On 8/26/2013 5:39 AM, Joel Borggren-Franck wrote:
> Hi,
>
> Please review doc fix and test for http://bugs.sun.com/view_bug.do?bug_id=5047859
>
> http://cr.openjdk.java.net/~jfranck/5047859/webrev.00/
>
> This is a spec change to update the spec to match the long-standing implementation.
>
> There is also a clarification of getFields() javadoc without changing the
> spec.
>
> cheers
> /Joel
More information about the core-libs-dev
mailing list