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

throws clauses not checked for incompatible changes

    • sparc
    • solaris_2.4

      The following code works fine. Change t.foo() so it throws an x instead of a t
      exception, and then recompile *only* t.java. Behold -- k.main() will get an
      unexpected exception. It should get an IcompatibleClassChangeError.

      #! /bin/sh
      # This is a shell archive, meaning:
      # 1. Remove everything above the #! /bin/sh line.
      # 2. Save the resulting text in a file.
      # 3. Execute the file with /bin/sh (not csh) to create:
      # k.java
      # t.java
      # This archive created: Thu Jan 4 14:16:33 1996
      export PATH; PATH=/bin:/usr/bin:$PATH
      if test -f 'k.java'
      then
      echo shar: "will not over-write existing file 'k.java'"
      else
      cat << \\SHAR_EOF > 'k.java'
      class k {
          static public void main(String[] args) throws Throwable {
      try {
      t.foo();
      } catch (t e) {
      System.out.println("got a t");
      }
          }
      }
      SHAR_EOF
      fi
      if test -f 't.java'
      then
      echo shar: "will not over-write existing file 't.java'"
      else
      cat << \\SHAR_EOF > 't.java'
      class x extends Throwable { }

      class t extends Throwable {
          static void foo() throws t { throw new t(); }
      }
      SHAR_EOF
      fi
      exit 0
      # End of shell archive

            fyellinsunw Frank Yellin (Inactive)
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: