-
Bug
-
Resolution: Duplicate
-
P3
-
None
-
1.2.0
-
None
-
sparc
-
solaris_2.6
using getMethods() on interfaces allows you to see the static initializer for the interface if it has one. here's a test case.
import java.lang.reflect.*;
interface i {
// cause the interface to have a static initializer
Object o = new Object();
}
public class r {
public static void main(String[] args) throws Exception {
Method[] methods = Class.forName("i").getMethods();
for (int i = 0; i < methods.length; i++) {
if (methods[i].getName().equals("<clinit>"))
throw new InternalError("shouldn't see clinit");
}
}
}
import java.lang.reflect.*;
interface i {
// cause the interface to have a static initializer
Object o = new Object();
}
public class r {
public static void main(String[] args) throws Exception {
Method[] methods = Class.forName("i").getMethods();
for (int i = 0; i < methods.length; i++) {
if (methods[i].getName().equals("<clinit>"))
throw new InternalError("shouldn't see clinit");
}
}
}
- duplicates
-
JDK-4187388 Class.getMethods() returns non-public <clinit> method of interface
- Resolved