-
Bug
-
Resolution: Fixed
-
P3
-
5.0
-
b30
-
generic, x86
-
generic, windows_2000
-
Verified
Tiger build24 win2000 testing of java.util.EnumSet range(E from, E to) not working as per
spec.
In the EnumSetTest03.java test program while testing for :
range(E from, E to)
case of :
from > to tested
I am expecting the IllegalArgumentException tobe thrown.
But it is not doing so.
the actual output is:
D:\testing\util\EnumSet\EnumSetTest03>java EnumSetTest03
newSetE1ToE0.size() = 63
Test EnumSetTest03.java Fail
The java version used , test output and test program is given below:
------------------------------------------------------------------
D:\testing\util\EnumSet\EnumSetTest03>java -version
java version "1.5.0-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta-b24)
Java HotSpot(TM) Client VM (build 1.5.0-beta-b24, mixed mode)
D:\testing\util\EnumSet\EnumSetTest03>java EnumSetTest03
newSetE1ToE0.size() = 63
Test EnumSetTest03.java Fail
Test Program:
-------------
import java.util.*;
public class EnumSetTest03 {
public static void main(String[] args) throws Exception {
EnumSetTestTest01(EnumTest6.class);
}
public static <T extends Enum<T>> boolean EnumSetTestTest01(Class<T> enumClass) {
boolean bReturn = false;
try {
EnumSet<T> s6 = EnumSet.allOf(enumClass);
Enum [] enumArray = s6.toArray(new Enum[0]);
T e0 = (T) enumArray[0];
T e1 = (T) enumArray[1];
EnumSet<T> newSetE1ToE0 = EnumSet.range(e1,e0);
System.out.println("newSetE1ToE0.size() = " + newSetE1ToE0.size());
System.out.println("Test EnumSetTest03.java Fail");
bReturn = false;
} catch(IllegalArgumentException e) {
bReturn = true;
System.out.println(" expected IllegalArgumentException thrown in EnumSetTest03.java "+ e);
}
return bReturn;
}
public enum EnumTest6 {S00,S01,S02,S03,S04,S05}
}//main class
###@###.### 2003-11-12
spec.
In the EnumSetTest03.java test program while testing for :
range(E from, E to)
case of :
from > to tested
I am expecting the IllegalArgumentException tobe thrown.
But it is not doing so.
the actual output is:
D:\testing\util\EnumSet\EnumSetTest03>java EnumSetTest03
newSetE1ToE0.size() = 63
Test EnumSetTest03.java Fail
The java version used , test output and test program is given below:
------------------------------------------------------------------
D:\testing\util\EnumSet\EnumSetTest03>java -version
java version "1.5.0-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta-b24)
Java HotSpot(TM) Client VM (build 1.5.0-beta-b24, mixed mode)
D:\testing\util\EnumSet\EnumSetTest03>java EnumSetTest03
newSetE1ToE0.size() = 63
Test EnumSetTest03.java Fail
Test Program:
-------------
import java.util.*;
public class EnumSetTest03 {
public static void main(String[] args) throws Exception {
EnumSetTestTest01(EnumTest6.class);
}
public static <T extends Enum<T>> boolean EnumSetTestTest01(Class<T> enumClass) {
boolean bReturn = false;
try {
EnumSet<T> s6 = EnumSet.allOf(enumClass);
Enum [] enumArray = s6.toArray(new Enum[0]);
T e0 = (T) enumArray[0];
T e1 = (T) enumArray[1];
EnumSet<T> newSetE1ToE0 = EnumSet.range(e1,e0);
System.out.println("newSetE1ToE0.size() = " + newSetE1ToE0.size());
System.out.println("Test EnumSetTest03.java Fail");
bReturn = false;
} catch(IllegalArgumentException e) {
bReturn = true;
System.out.println(" expected IllegalArgumentException thrown in EnumSetTest03.java "+ e);
}
return bReturn;
}
public enum EnumTest6 {S00,S01,S02,S03,S04,S05}
}//main class
###@###.### 2003-11-12
- duplicates
-
JDK-4960139 EnumSet.range does not throw expected IllegalArgumentException
-
- Closed
-