-
Bug
-
Resolution: Fixed
-
P3
-
8
-
b115
-
generic
-
generic
-
Verified
The javadoc for 'Class.getMethods' references the JLS concept of membership, so inheritance should be consistent with JLS. In the language model, static methods are inherited from a superclass, but not from superinterfaces.
public class InheritStatic {
static class A {
public void m() {}
public static void n() {}
}
interface I {
public void o();
public static void p() {} // comment out to test with JDK 7
}
static abstract class B extends A implements I {}
public static void main(String... args) {
Object[] ms = B.class.getMethods();
for (Object m : ms) System.out.println(m);
}
}
Expected: A.n is printed, I.p is not.
Actual: Both A.n and Ip. are printed.
public class InheritStatic {
static class A {
public void m() {}
public static void n() {}
}
interface I {
public void o();
public static void p() {} // comment out to test with JDK 7
}
static abstract class B extends A implements I {}
public static void main(String... args) {
Object[] ms = B.class.getMethods();
for (Object m : ms) System.out.println(m);
}
}
Expected: A.n is printed, I.p is not.
Actual: Both A.n and Ip. are printed.
- relates to
-
JDK-8074103 Class.getMethod[s] for static methods of interface
-
- Closed
-