enum switch on null fails to throw NullPointerException

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P3
    • 5.0
    • Affects Version/s: 5.0
    • Component/s: tools
    • b46
    • generic
    • solaris_8

      This test case fails under the current implementation of enums:

      enum EnumSw {
          foo, bar, baz;

          public static void main(String[] args) {
              EnumSw e = null;
              try {
                  switch (e) {
                  default: break;
                  }
                  throw new Error("failed to throw NullPointerException");
              } catch (NullPointerException ex) {
                  System.out.println("passed");
              }
          }
      }

            Assignee:
            Neal Gafter (Inactive)
            Reporter:
            Neal Gafter (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: