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

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

XMLWordPrintable

    • mantis
    • generic
    • solaris_8

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

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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: