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

javac treats Object as a direct supertype of all interfaces

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P5 P5
    • None
    • 1.1
    • tools
    • None
    • x86
    • windows_95



      Name: mc57594 Date: 05/21/97


      Object is not a direct supertype of an interface. In other
      words, if an interface type is searched for a declaration during lookup,
      lookup does not proceed thence into Object; similarly, an interface that
      happens to declare an abstract method with the same signature as a
      method in Object is NOT overriding the method in Object!

      However javac treats all interfaces as though they were implicitly
      directly extending/implementing Object:

      interface J {
          void notify (); // error - overrides final method
          void finalize () throws J; // error - wider 'throws' list
          J clone (); // error - different return type
      }

      This interface is well-formed, but javac rejects it.

      Similarly, the following code is illegal; however javac accepts it:

      interface J {
      }

      class Test {
          void f (J j) {
              j.toString(); // OK - toString is a member of J
          }
      }
      ======================================================================

            gafter Neal Gafter (Inactive)
            mchamnessunw Mark Chamness (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: