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

Linux: "new" throws InstantiationException instead of InstantiationError

XMLWordPrintable

    • x86
    • linux



      Name: kaC94536 Date: 05/05/2000



      java version "1.3.0beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0beta-b03)
      Java HotSpot(TM) Client VM (build 1.3.0beta-b01, mixed mode)

      The VM specification reads:
      ...
      new
      Operation
      ...
      Otherwise, if the symbolic reference to the class, array, or interface
      type resolves to an interface or is an abstract class, "new" throws an
      InstantiationError.
      ...

      The following test shows that instruction "new" being invoked for an interface
      throws InstantiationException instead of InstantiationError.

      ------------------ test.java (should be compiled first) ---------------

      class test {
        public static void main(String a[]) {
          new i();
        }
      }

      class i {}

      ------------------- i.java (should be compiled second) -----------------

      interface i {}

      -------------------------- output --------------------------------------

      Exception in thread "main" java.lang.InstantiationException: i
      at test.main(test.java:3)

      ------------------------------------------------------------------------

      The following JCK test fails due to this bug:
      vm/classfmt/ins/instr_020/instr_02001m1/instr_02001m1.html

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

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

            Unassigned Unassigned
            kanisimosunw Konstantin Anisimov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: