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

no compile-time error when inheriting abstract and static methods with the same

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      1.2beta
    • CPU:
      sparc
    • OS:
      solaris_2.5
    • Verification:
      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:
          If the method that is not abstract is static, a compile-time error occurs.
         ...
      "


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

      > javac -d . clss17301.java
      > java clss17301
      java.lang.UnknownError: javasoft/sqe/tests/lang/clss173/clss17301/clss17301_c
      at java.lang.Thread.setPriority(Thread.java)
      at javasoft.sqe.tests.lang.clss173.clss17301.clss17301.main(clss17301.java:25)


      --------------------------clss17301.java------------------------------
      package javasoft.sqe.tests.lang.clss173.clss17301;


      import java.io.PrintStream;

      interface clss17301_a {
      int m1();
      }
      class clss17301_b {
      static public int m1() {
      return 666;
      }
      }
      class clss17301_c extends clss17301_b implements clss17301_a {
      int m2() {
      return m1();
      }
      }

      public class clss17301 {
        public static void main(String argv[])
        {
           System.exit(run(argv, System.out) + 95/*STATUS_TEMP*/);
        }
        public static int run(String argv[],PrintStream out) {
      clss17301_c x = new clss17301_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: