The specification for ReferenceType.allMethods() states:
Returns a list containing each Method declared in this type, and its superclasses, implemented interfaces, and/or superinterfaces. All declared and inherited methods are included, regardless of whether they are hidden or overridden.
---
The first sentence covers all methods, but the second then seems to constrain things to only "declared and inherited methods". This interpretation is consistent with:
visibleMethods() : Returns a list containing each Method declared or inherited by this type. Methods from superclasses or superinterfaces that have been hidden or overridden are not included.
The difference between allMethods and visibleMethods should only be the set of "hidden or overridden" methods.
Private methods and static interface methods are not inherited and so should not be returned by allMethods() (and certainly not visibleMethods()). Yet they are.
Returns a list containing each Method declared in this type, and its superclasses, implemented interfaces, and/or superinterfaces. All declared and inherited methods are included, regardless of whether they are hidden or overridden.
---
The first sentence covers all methods, but the second then seems to constrain things to only "declared and inherited methods". This interpretation is consistent with:
visibleMethods() : Returns a list containing each Method declared or inherited by this type. Methods from superclasses or superinterfaces that have been hidden or overridden are not included.
The difference between allMethods and visibleMethods should only be the set of "hidden or overridden" methods.
Private methods and static interface methods are not inherited and so should not be returned by allMethods() (and certainly not visibleMethods()). Yet they are.
- relates to
-
JDK-8166453 [TEST] Issues with test jdk/test/com/sun/jdi/InterfaceMethodsTest.java
- Open