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

SQE lib PIT build 1.5.0-auto-tiger-322c: java.util.EnumSet range() not ok as pe

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2 P2
    • 5.0
    • 5.0
    • core-libs
    • b32
    • x86
    • windows_2000
    • Verified

      Tiger PIT build (build 1.5.0-auto-tiger-322c) os: win2000
      -----------------------------------------------------------------
      java.util.EnumSet
           EnumSet<E> range(E from, E to)

      not working ok.
      when the EnumTest65.class is used.
      The newSet.size() returns 0
         but the expected size is 1
       and because of this the
      complementOfNewSet.size()= 65 is returned.

      When the EnumTest class size is below 64 it is ok.

      The java version used, output and test program is give below:
      ------------------------------------------------------------
      D:\testing\util\EnumSet\EnumSetTest04>java -version
                     
      java version "1.5.0-auto-tiger"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-auto-tiger-322c)
      Java HotSpot(TM) Client VM (build 1.5.0-beta-b28, mixed mode)

      output:
      -------
      D:\testing\util\EnumSet\EnumSetTest04>java EnumSetTest04
      newSet.size()= 1 expectedSize = 1
      complementOfNewSet.size()= 4

      newSet.size()= 0 expectedSize = 1
      complementOfNewSet.size()= 65

      Test program:
      -------------
      import java.util.*;

      public class EnumSetTest04 {
          public static void main(String[] args) throws Exception {
                  EnumSetTestTest01(EnumTest5.class);
                  EnumSetTestTest01(EnumTest65 .class);
         }

         public static <T extends Enum<T>> void EnumSetTestTest01(Class<T> enumClass) {
              try {
                   EnumSet<T> oldSet = EnumSet.allOf(enumClass);
                   Enum [] enumArray = enumClass.getEnumConstants();
                   EnumSet<T> newSet = EnumSet.range(enumArray[0],enumArray[0]);
                   EnumSet<T> complementOfNewSet = EnumSet.complementOf(newSet);
                   System.out.println("newSet.size()= " + newSet.size() + " expectedSize = 1");
                   System.out.println("complementOfNewSet.size()= " + complementOfNewSet.size());
              } catch(Exception e) {
                   System.out.println(" exception thrown in EnumSetTest04.java "+ e);
                   e.printStackTrace();
              }
          }
        public enum EnumTest5 {
      S0, S1, S2, S3, S4
        }
        public enum EnumTest65 {
      S0, S1, S2, S3, S4, S5, S6, S7, S8, S9, S10, S11, S12, S13, S14, S15, S16,
      S17, S18, S19, S20, S21, S22, S23, S24, S25, S26, S27, S28, S29, S30, S31,
      S32, S33, S34, S35, S36, S37, S38, S39, S40, S41, S42, S43, S44, S45, S46,
      S47, S48, S49,S50, S51, S52, S53, S54, S55, S56, S57, S58, S59, S60, S61,
      S62, S63,S64
        }

      }//main class


      ###@###.### 2003-11-21

            jjb Josh Bloch
            spandeorcl Shantaram Pande (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: