9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 20 * CA 95054 USA or visit www.sun.com if you need additional information or 21 * have any questions. 22 */ 23 24 /* 25 * @test 26 * @bug 4958003 27 * @summary Range static factory fails to compute size in Jumbo enum set 28 * @author Josh Bloch 29 * 30 * @compile -source 1.5 JumboRange.java 31 * @run main JumboRange 32 */ 33 34 import java.util.*; 35 36 public class JumboRange { 37 public static void main(String[] args) { 38 test(Test127.class, Test127.T2, Test127.T6); 39 test(Test127.class, Test127.T126, Test127.T126); 40 test(Test127.class, Test127.T0, Test127.T126); 41 } 42 43 static <T extends Enum<T>> void test(Class<T> enumClass, T e0,T e1) { 44 EnumSet<T> range = EnumSet.range(e0, e1); 45 if (range.size() != e1.ordinal() - e0.ordinal() + 1) 46 throw new RuntimeException(range.size() + " != " + 47 (e1.ordinal() - e0.ordinal() + 1)); 48 } 49 50 public enum Test127 { 51 T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, | 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 20 * CA 95054 USA or visit www.sun.com if you need additional information or 21 * have any questions. 22 */ 23 24 /* 25 * @test 26 * @bug 4958003 27 * @summary Range static factory fails to compute size in Jumbo enum set 28 * @author Josh Bloch 29 */ 30 31 import java.util.*; 32 33 public class JumboRange { 34 public static void main(String[] args) { 35 test(Test127.class, Test127.T2, Test127.T6); 36 test(Test127.class, Test127.T126, Test127.T126); 37 test(Test127.class, Test127.T0, Test127.T126); 38 } 39 40 static <T extends Enum<T>> void test(Class<T> enumClass, T e0,T e1) { 41 EnumSet<T> range = EnumSet.range(e0, e1); 42 if (range.size() != e1.ordinal() - e0.ordinal() + 1) 43 throw new RuntimeException(range.size() + " != " + 44 (e1.ordinal() - e0.ordinal() + 1)); 45 } 46 47 public enum Test127 { 48 T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, |