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

no compile-time error when inheriting abstract and default access methods with t

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      1.1
    • CPU:
      sparc
    • OS:
      solaris_2.5
    • Verification:
      Not verified

      Description



      Name: apC46001 Date: 12/17/96


      JLS says [p. 167, 8.4.6.4 Inheriting Methods with the Same Signature]:

      "It is possible for a class to inherit more than one method with the same signature.
      Such a situation does not in itself cause a compile-time error.
      There are then two possible cases:
        If one of the inherited methods is not abstract, then there are two subcases:
         ...
           Otherwise, the method that is not abstract is considered to override, and therefore
           to implement, all the other methods on behalf of the class that inherits it.
         ...
      "

      JLS says [p. 166, 8.4.6.3 Requirements in Overriding and Hiding]:
      "...
      If the overridden or hidden method is public, then the overriding or
      hiding method must be public; otherwise, a compile-time error occurs.
      ..."

      JDK 1.1 compiler does not produce the needed error message for the test below.

      > javac -d . clss17401.java
      > java clss17401
      java.lang.UnknownError: javasoft/sqe/tests/lang/clss174/clss17401/clss17401_c
      at java.lang.Thread.setPriority(Thread.java)
      at javasoft.sqe.tests.lang.clss174.clss17401.clss17401.main(clss17401.java:25)

      --------------------------clss17401.java------------------------------
      package javasoft.sqe.tests.lang.clss174.clss17401;


      import java.io.PrintStream;

      interface clss17401_a {
      int m1();
      }
      class clss17401_b {
      int m1() {
      return 666;
      }
      }
      class clss17401_c extends clss17401_b implements clss17401_a {
      int m2() {
      return m1();
      }
      }

      public class clss17401 {
        public static void main(String argv[])
        {
           System.exit(run(argv, System.out) + 95/*STATUS_TEMP*/);
        }
        public static int run(String argv[],PrintStream out) {
      clss17401_c x = new clss17401_c();
      return 2;
        }
      }
      ======================================================================

        Attachments

          Activity

            People

            Assignee:
            tturnidgsunw Todd Turnidge (Inactive)
            Reporter:
            duke J. Duke (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: