Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4424393

Class.getMethods() returns not all inherited methods of interface

    XMLWordPrintable

Details

    • beta
    • sparc
    • solaris_7
    • Verified

    Description



      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);
            }
          }
      }
      --------------------------------------===

      ======================================================================

      Attachments

        Issue Links

          Activity

            People

              kbr Kenneth Russell (Inactive)
              inevsunw Inev Inev (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: