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

EnumSet.noneOf throws unexpected AssertionError

XMLWordPrintable



      Name: skR10005 Date: 11/26/2003


      The following new api tests fail on JDK1.5.0-b29:
      api/java_util/EnumSet/index.html#of5[of5001]
      api/java_util/EnumSet/index.html#of5[of5002]

      If enum declaration is not public then EnumSet.noneOf method throws
      AssertionError.

      The following simple test can be used to reproduce the failure:
      ===============================test.java=======================
      import java.util.EnumSet;

      public class test {
          public static void main(String[] argv) {
              EnumSet.noneOf(simpleEnum.class);
          }
      }

      enum simpleEnum { ANY }
      ===============================================================
      $ javac -d . -source 1.5 test.java
      $ java -version
      java version "1.5.0-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta-b29)
      Java HotSpot(TM) Server VM (build 1.5.0-beta-b29, mixed mode)
      $ java -cp . test
      Exception in thread "main" java.lang.AssertionError: VALUES field isn't public
              at java.util.EnumSet.noneOf(EnumSet.java:97)
              at test.main(test.java:5)
      $

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

            jjb Josh Bloch
            serjsunw Serj Serj (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: