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

javac treats Object as a direct supertype of all interfaces

    XMLWordPrintable

Details

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

    Description



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

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: