Re: [Sablevm-developer] Re: Reflection and interfaces
Brought to you by:
egagnon
From: David <db...@cs...> - 2004-05-21 21:02:54
|
On Fri, May 21, 2004 at 01:36:07PM -0400, Etienne Gagnon wrote: > I wonder... >=20 > David B=E9langer wrote: > >>- if (isPrimitive() || isArray() || isInterface()) > >>+ if (isPrimitive() || isArray()) > > > >This is the correct fix and will make it in SableVM/staging version. >=20 > Wouldn't the following be the correct fix? >=20 > - if (isPrimitive() || isArray() || isInterface()) > + if (isPrimitive()) >=20 > Arrays inherit from java.lang.Object, so they have methods, isn't it? >=20 Yes, but getDeclaredMethods returns only methods declared by the type, not all methods inherited. Arrays do not declare them and the spec says it should return an empty array of Methods if it is an array type. If getMethods() is called (for all methods), it should correctly figure out that the superclass of the array type is Object and collect them. David --- David B=E9langer Graduate Student School of Computer Science McGill University Office: MC226 Web page: http://www.cs.mcgill.ca/~dbelan2/ Public key: http://www.cs.mcgill.ca/~dbelan2/public_key.txt |