Misleading error message when superclass constructor has throws clause

XMLWordPrintable

    • Type: Bug
    • Resolution: Duplicate
    • Priority: P5
    • None
    • Affects Version/s: 1.1.3
    • Component/s: tools
    • sparc
    • solaris_2.5.1



      Name: tb29552 Date: 08/12/97


      The following program

      > package bug;
      >
      > class SuperClass
      > {
      > SuperClass() throws Exception { throw new Exception(); }
      > }
      >
      > public class Bug extends SuperClass
      > {
      > // Comment in the following line to make javac compile.
      > // Bug() throws Exception {}
      > }

      leads to the following error message:

      > bug/Bug.java:8: unreported exception: Exception; must be caught or
      declared to be thrown
      > public class Bug extends SuperClass
      > ^
      > 1 error

      Ok, class Bug must define a constructor that
      throws the same exception as the superclass
      constructor does; then the program compiles.
      But the error message is quite misleading, if you
      do not recognize the problem.

      company - University of Karlsruhe, Germany , email - ###@###.###
      ======================================================================

            Assignee:
            Neal Gafter (Inactive)
            Reporter:
            Tim Bell
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: