1*055d4590SKeyi Gui /* 2*055d4590SKeyi Gui * Copyright (C) 2007 The Android Open Source Project 3*055d4590SKeyi Gui * 4*055d4590SKeyi Gui * Licensed under the Apache License, Version 2.0 (the "License"); 5*055d4590SKeyi Gui * you may not use this file except in compliance with the License. 6*055d4590SKeyi Gui * You may obtain a copy of the License at 7*055d4590SKeyi Gui * 8*055d4590SKeyi Gui * http://www.apache.org/licenses/LICENSE-2.0 9*055d4590SKeyi Gui * 10*055d4590SKeyi Gui * Unless required by applicable law or agreed to in writing, software 11*055d4590SKeyi Gui * distributed under the License is distributed on an "AS IS" BASIS, 12*055d4590SKeyi Gui * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13*055d4590SKeyi Gui * See the License for the specific language governing permissions and 14*055d4590SKeyi Gui * limitations under the License. 15*055d4590SKeyi Gui */ 16*055d4590SKeyi Gui 17*055d4590SKeyi Gui public class Blort 18*055d4590SKeyi Gui { 19*055d4590SKeyi Gui // Empty switch statement. (Note: This is the same as a default-only 20*055d4590SKeyi Gui // switch statement, since under the covers every switch statement 21*055d4590SKeyi Gui // has a default of some sort.) test1(int x)22*055d4590SKeyi Gui public int test1(int x) { 23*055d4590SKeyi Gui switch (x) { 24*055d4590SKeyi Gui // This space intentionally left blank. 25*055d4590SKeyi Gui } 26*055d4590SKeyi Gui 27*055d4590SKeyi Gui return 0; 28*055d4590SKeyi Gui } 29*055d4590SKeyi Gui 30*055d4590SKeyi Gui // Single element. test2(int x)31*055d4590SKeyi Gui public int test2(int x) { 32*055d4590SKeyi Gui switch (x) { 33*055d4590SKeyi Gui case 0: return 0; 34*055d4590SKeyi Gui } 35*055d4590SKeyi Gui 36*055d4590SKeyi Gui return 1; 37*055d4590SKeyi Gui } 38*055d4590SKeyi Gui 39*055d4590SKeyi Gui // Single element: Integer.MIN_VALUE. test3(int x)40*055d4590SKeyi Gui public int test3(int x) { 41*055d4590SKeyi Gui switch (x) { 42*055d4590SKeyi Gui case Integer.MIN_VALUE: return 0; 43*055d4590SKeyi Gui } 44*055d4590SKeyi Gui 45*055d4590SKeyi Gui return 1; 46*055d4590SKeyi Gui } 47*055d4590SKeyi Gui 48*055d4590SKeyi Gui // Single element: Integer.MAX_VALUE. test4(int x)49*055d4590SKeyi Gui public int test4(int x) { 50*055d4590SKeyi Gui switch (x) { 51*055d4590SKeyi Gui case Integer.MAX_VALUE: return 0; 52*055d4590SKeyi Gui } 53*055d4590SKeyi Gui 54*055d4590SKeyi Gui return 1; 55*055d4590SKeyi Gui } 56*055d4590SKeyi Gui 57*055d4590SKeyi Gui // Two elements: 0 and Integer.MIN_VALUE. test5(int x)58*055d4590SKeyi Gui public int test5(int x) { 59*055d4590SKeyi Gui switch (x) { 60*055d4590SKeyi Gui case 0: return 0; 61*055d4590SKeyi Gui case Integer.MIN_VALUE: return 1; 62*055d4590SKeyi Gui } 63*055d4590SKeyi Gui 64*055d4590SKeyi Gui return 2; 65*055d4590SKeyi Gui } 66*055d4590SKeyi Gui 67*055d4590SKeyi Gui // Two elements: 0 and Integer.MAX_VALUE. test6(int x)68*055d4590SKeyi Gui public int test6(int x) { 69*055d4590SKeyi Gui switch (x) { 70*055d4590SKeyi Gui case 0: return 0; 71*055d4590SKeyi Gui case Integer.MAX_VALUE: return 1; 72*055d4590SKeyi Gui } 73*055d4590SKeyi Gui 74*055d4590SKeyi Gui return 2; 75*055d4590SKeyi Gui } 76*055d4590SKeyi Gui 77*055d4590SKeyi Gui // Two elements: Integer.MIN_VALUE and Integer.MAX_VALUE. test7(int x)78*055d4590SKeyi Gui public int test7(int x) { 79*055d4590SKeyi Gui switch (x) { 80*055d4590SKeyi Gui case Integer.MIN_VALUE: return 0; 81*055d4590SKeyi Gui case Integer.MAX_VALUE: return 1; 82*055d4590SKeyi Gui } 83*055d4590SKeyi Gui 84*055d4590SKeyi Gui return 2; 85*055d4590SKeyi Gui } 86*055d4590SKeyi Gui 87*055d4590SKeyi Gui // Two elements: Large enough to be packed but such that 32 bit 88*055d4590SKeyi Gui // threshold calculations could overflow. test8(int x)89*055d4590SKeyi Gui public int test8(int x) { 90*055d4590SKeyi Gui switch (x) { 91*055d4590SKeyi Gui case 0: return 0; 92*055d4590SKeyi Gui case 0x4cccccc8: return 1; 93*055d4590SKeyi Gui } 94*055d4590SKeyi Gui 95*055d4590SKeyi Gui return 2; 96*055d4590SKeyi Gui } 97*055d4590SKeyi Gui } 98