RFR: 8009411 : getMethods should not inherit static methods from interfaces
Joel Borggren-Franck
joel.franck at oracle.com
Wed Sep 11 09:25:38 UTC 2013
On 2013-09-09, Remi Forax wrote:
> On 09/09/2013 07:27 PM, Joel Borggrén-Franck wrote:
> >On 9 sep 2013, at 19:00, Joel Borggrén-Franck <joel.franck at oracle.com> wrote:
> >
> >>The issue is that since we added static methods to interfaces those have erroneously been reflected in getMethods of implementing classes. This fix filters out static interface methods from superinterfaces when adding methods. I have also added a note to the javadoc for both getMembers and getDeclaredMembers pointing this out (though it is implied from JLS).
> >Correcting myself, I added a note to getMethods() and getMethod(String name …)
> >
> >getDeclaredMethod{s} shouldn't need a note.
> >
> >cheers
> >/Joel
>
> also Joel you can use for-each and avoid to load ma[i] twice
> (even if the JIT will certainly avoid the double load in this
> specific case).
>
> void addAllNonStatic(Method[] methodArray) {
> for (Method method:methodArray) {
> if (!Modifier.isStatic(method.getModifiers())) {
> add(method);
> }
> }
> }
>
I should use foreach if possible in any case, looks much cleaner.
cheres
/Joel
More information about the core-libs-dev
mailing list