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

initialization of an interface requares initialization of its superinterface

    XMLWordPrintable

Details

    • 1.2alpha2
    • sparc
    • solaris_2.5
    • Verified

    Description



      Name: vgC55224 Date: 11/26/96


      The section "12.4.1 When Initialization Occurs" of The Java Language
      Specification contains the following:

      "Initialization of an interface does not, of itself, require initialization of any of its superinterfaces. "


      While interface is initialized, at first its superinterface is initialized.

      > jac11 -d . exec00901.java
      > ja11 -verify javasoft.sqe.tests.lang.exec009.exec00901.exec00901
      <ri = 0ric = 6
      >ri = 6
      <ri = 6ric = 8
      >ri = 6
      begin
      6
      failed 2


      --------------------------exec00901.java------------------------------
      package javasoft.sqe.tests.lang.exec009.exec00901;

      import java.io.PrintStream;

      public class exec00901 {
        static int ri = 0;
        public static void main(String argv[])
        {
           System.exit(run(argv, System.out) + 95/*STATUS_TEMP*/);
        }
        public static int run(String argv[],PrintStream out) {
          int k = exec00901b.b4;
            out.println ("begin");
          if (k != 4)
          {
            out.println (ri);
            out.println ("failed 1");
            return 2;
          }
          if (ri != 8)
          {
            out.println (ri);
            out.println ("failed 2");
            return 2;
          }
            out.println (ri);
            out.println ("end");
          return 0;
        }
        static int init (int i, int ric) {
            System.out.println ("<ri = " + ri + "ric = " + ric);
          if (ri == 0)
            ri = ric;
            System.out.println (">ri = " + ri);
          return i;
        }
      }

      class exec00901a {
        static int b1 = 0;
        static { if (exec00901.ri == 0) exec00901.ri = 2; else exec00901.ri = 1; };
      }

      class exec00901b extends exec00901a implements exec00901d {
        static int b2;
        static { int b2 = 8;
                 if (exec00901.ri == 2) exec00901.ri = 4;};
      }

      interface exec00901c {
        int b3 = exec00901.init (3, 6);
      }
          
      interface exec00901d extends exec00901c {
        int b4 = exec00901.init (4, 8);
      }
      -----------------------------------------------------------------

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

      Attachments

        Activity

          People

            sliangsunw Sheng Liang (Inactive)
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: