RFR: 8009411 : getMethods should not inherit static methods from interfaces
Remi Forax
forax at univ-mlv.fr
Mon Sep 9 20:46:24 UTC 2013
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);
}
}
}
cheers,
Rémi
More information about the core-libs-dev
mailing list