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

javac allows an interface to override a final method in Object (revert 4668238)

    Details

    • Subcomponent:
    • Resolved In Build:
      mantis
    • CPU:
      generic
    • OS:
      solaris_8

      Description

      from jacks test 9.2-implicit-4

      With 4668238 fixed, the following is accepted by the compiler. But
      it will not verify. JLS 9.2 need to add an additional restriction
      on what methods from Object are inherited, something like

      "... unless m is not final and ..."

      I have twisted Gilad's arm into penciling that into his draft of JLS3.

      interface I {
          Class getClass();
          static class T {
              static void f(I i) {
                  if (i == null) {
                      Integer x = new Integer(2);
                  } else {
                      I x = i;
                      x.getClass();
                  }
              }
              public static void main(String[] args) {
                  f(null);
              }
          }
      }

        Attachments

          Activity

            People

            • Assignee:
              gafter Neal Gafter
              Reporter:
              gafter Neal Gafter
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: