RFR: 5047859 : (reflect) Class.getField can't find String[].length

David Holmes david.holmes at oracle.com
Tue Aug 27 03:21:43 UTC 2013

Hi Joel,

On 26/08/2013 10:39 PM, 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.

Have to wonder why reflection chose to ignore 'length' when the JLS is 
so clear that it is a field ??

Anyway ... I think the added wording to getField() is okay but:

1604      * follows.  Let C be the class or interface represented by 
this object:

I don't think it necessary, or desirable to replace 'class' with 'class 
or interface' here. If you do then you should do it everywhere - which 
would be bad. Plus does it really mean "class, or interface, or enum, or 
annotation" ? Sometimes "class" just means the thing a Class represents.

> There is also a clarification of getFields() javadoc without changing the
> spec.

I don't think this change make sense given it already says it returns a 
zero-length array for array classes - as Mandy pointed out. I don't 
think this "clarification" is needed.


> cheers
> /Joel

More information about the core-libs-dev mailing list