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

no error if superclass is an interface.

XMLWordPrintable

    • 1.2fcs
    • sparc
    • solaris_2.4
    • Verified



      Name: akC45999 Date: 05/21/98



      The Java Virtual Machine Specification, 5.3.1 Loading Using the Default Class Loader
      reads:

      8.This phase of loading must also detect the following errors:
             If the class or interface named as the direct superclass of C is in fact an
             interface, loading throws an Incompatible-Class-Change-Error

      But the following test shows that this check is not done at this
      phase of loading.

      ----------------- file defaultLoader00601.java
      import java.io.PrintStream;

      public class defaultLoader00601 {
        public static int run(String argv[], PrintStream out) {
      try {
      Class cl= Class.forName("defaultLoader00601a");
        out.println("No exception");
           return 2;
        } catch (IncompatibleClassChangeError e) {
        } catch (Throwable e) {
        out.println("Wrong exception:"+e);
           return 2;
      }
          return 0;
        }

        public static void main(String args[]) {
      System.exit(run(args, System.out) + 95/*STATUS_TEMP*/);
        }

      }

      ----------------- file defaultLoader00601a.jasm

      interface defaultLoader00601i {
      }

      class defaultLoader00601a extends defaultLoader00601i {
      }


      -------------------------
      Test execution:

      novo64% java -version
      java version "1.2beta4"
      Classic VM (build JDK-1.2beta4-F, green threads, sunwjit)
      novo64% javac *java
      novo64% jasm *jasm
      novo64% java defaultLoader00601
      No exception
      novo64%

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

            sliangsunw Sheng Liang (Inactive)
            rfqsunw Rfq Rfq (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: