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

Description of "override" in JLS 3 section 6.4.3 is misleading.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P5
    • Resolution: Fixed
    • Affects Version/s: 6
    • Fix Version/s: 7
    • Component/s: specification
    • Labels:
      None
    • Subcomponent:
    • Resolved In Build:
      rc
    • CPU:
      generic
    • OS:
      generic
    • Verification:
      Verified

      Description

      The formal definition of "overrides" in 8.4.8 does not
      depend on the "abstract" modifier. Abstract comes into play only in that:

        Moreover, if m1 is not abstract, then m1 is said to *implement* any and
        all declarations of abstract methods that it overrides.

      However, there's a less formal description of "overrides" in 6.4.3
      that says:

        If the method not inherited is abstract, then the new declaration is
        said to *implement* it; if the method not inherited is not abstract,
        then the new declaration is said to *override* it.

      The submitter of 6409362 took the latter section at
      face value and incorrectly concluded that "implements" and "overrides"
      are mutually exclusive.
      While discussing this with Peter we noted that:

      Section 8.4.8.1 describes overriding when one class extends another
      class, and section 9.4.1 describes overriding when one interface
      extends another interface. We could not find a similarly-rigorous
      description covering the case of a class implementing an interface:

      interface I { void m(); }
      class C implements I { public void m() {}; }

      The first paragraph of 8.4.8 does, however, seem to imply that 8.4.8.1
      should be applicable, and that since I.m is not inherited by C
      (it's not, right?), it must be due to I.m being overridden by C.m.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              abuckley Alex Buckley
              Reporter:
              sseligmasunw Scott Seligman (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: