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

assertion flag attached to wrong class

    XMLWordPrintable

Details

    • beta2
    • generic
    • solaris_7
    • Verified

    Description

      The assert enabled/disabled flag is attached to the wrong class.
      Te be semantically correct, it needs to be attached to the
      innermost class enclosing the assertion. It is currently attached
      to the outermost enclosing class.

      /*
       * @test %W% %E%
       * @bug 4478095
       * @summary assertion flag attached to wrong class
       * @author gafter
       *
       * @compile -source 1.4 Attach.java
       * @run main
       */

      class Attach {
          public static void main(String[] args) {
              Attach.class.getClassLoader().
                  setClassAssertionStatus("Attach", false);
              new V();
              throw new Error("failed 4478095");
          }
          static class U {
              static { V.f(); };
          }
          static class V extends U {
              static void f() {
                  try {
                      assert false;
                  } catch (AssertionError e) {
                      System.exit(0);
                  }
              }
          }
      }

      Attachments

        Activity

          People

            gafter Neal Gafter
            gafter Neal Gafter
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: