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

no compile-time error for throw clauses conflict

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      1.2alpha2
    • CPU:
      x86, sparc
    • OS:
      solaris_2.5, windows_nt
    • Verification:
      Verified

      Description



      Name: apC46001 Date: 12/18/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:
         ...
        Moreover, a compile-time error occurs if the inherited method that is not abstract
        has a throws clause that conflicts with that of any other of the inherited methods.
         ...
      "

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

      > javac -d . clss17601.java
      > java clss17601

      --------------------------clss17601.java------------------------------
      package javasoft.sqe.tests.lang.clss176.clss17601;


      import java.io.PrintStream;

      class Ex1 extends Exception {}
      class Ex2 extends Exception {}
      interface clss17601_a {
      int m1();
      }
      class clss17601_b {
      public int m1() throws Ex1 {
      throw (new Ex1());
      }
      }
      class clss17601_c extends clss17601_b implements clss17601_a {
      int m2() throws Ex2 {
      throw (new Ex2());
      }
      }

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


      ======================================================================

        Attachments

          Issue Links

            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: