-
Bug
-
Resolution: Fixed
-
P2
-
1.4.0
-
beta
-
sparc
-
solaris_7
-
Verified
Name: inR10064 Date: 03/12/2001
java.lang.Class.getMethods() returns not all inherited methods of interface.
The sample program ( see source below ) shows that for interface
org.w3c.dom.CDATASection the method returns only method splitText(int)
defined in direct superinterface org.w3c.dom.Text .
But the org.w3c.dom.Text inherits a lot of methods defined in superinterfaces.
This wrong behaviour is detected for all merlin builds starting from
jdk 1.4.0beta-build51.
The bug seems do not affect reflection of classes, interfaces only.
--------------------------------------=== log on jdk 1.4.0beta-b54
___ java testReflect.Methods org.w3c.dom.Text org.w3c.dom.CDATASection
##### interface org.w3c.dom.Text
impl: interface org.w3c.dom.CharacterData
method: public abstract org.w3c.dom.Text org.w3c.dom.Text.splitText(int) throws org.w3c.dom.DOMException
method: public abstract int org.w3c.dom.CharacterData.getLength()
method: public abstract java.lang.String org.w3c.dom.CharacterData.getData() throws org.w3c.dom.DOMException
method: public abstract void org.w3c.dom.CharacterData.setData(java.lang.String) throws org.w3c.dom.DOMException
method: public abstract java.lang.String org.w3c.dom.CharacterData.substringData(int,int) throws org.w3c.dom.DOMException
method: public abstract void org.w3c.dom.CharacterData.appendData(java.lang.String) throws org.w3c.dom.DOMException
method: public abstract void org.w3c.dom.CharacterData.insertData(int,java.lang.String) throws org.w3c.dom.DOMException
method: public abstract void org.w3c.dom.CharacterData.deleteData(int,int) throws org.w3c.dom.DOMException
method: public abstract void org.w3c.dom.CharacterData.replaceData(int,int,java.lang.String) throws org.w3c.dom.DOMException
##### interface org.w3c.dom.CDATASection
impl: interface org.w3c.dom.Text
method: public abstract org.w3c.dom.Text org.w3c.dom.Text.splitText(int) throws org.w3c.dom.DOMException
___ javap org.w3c.dom.Text
Compiled from Text.java
public interface org.w3c.dom.Text extends org.w3c.dom.CharacterData
/* ACC_SUPER bit NOT set */
{
public abstract org.w3c.dom.Text splitText(int) throws org.w3c.dom.DOMException;
}
___ javap org.w3c.dom.CDATASection
Compiled from CDATASection.java
public interface org.w3c.dom.CDATASection extends org.w3c.dom.Text
/* ACC_SUPER bit NOT set */
{
}
--------------------------------------=== Methods.java
package testReflect;
import java.lang.reflect.Method;
public class Methods {
static void out (String s) {
System.out.println(s);
}
public static void main (String[] args) {
try {
for (int i=0; i<args.length; i++) {
Class c = Class.forName(args[i]);
out("##### "+ c);
Class supr = c.getSuperclass();
if ( supr != null)
out(" super: "+ supr);
Class[] intfs = c.getInterfaces();
for (int j = 0; j < intfs.length; j++)
out(" impl: "+ intfs[j]);
Method[] mm = c.getMethods();
for (int j=0; j<mm.length; j++)
out(" method: "+ mm[j]);
}
} catch (Exception e) {
out("Exception "+ e);
}
}
}
--------------------------------------===
======================================================================
- relates to
-
JDK-4424303 jdk1.4.0beta-b54 Class.newInstance() incorrectly throws IllegalAccessException
- Closed
-
JDK-4493281 performance regression in Class.getMethod
- Closed