xref: /aosp_15_r20/dalvik/dx/tests/090-dex-unify-arrays/Blort.java (revision 055d459012065f78d96b68be8421640240ddf631)
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     /*
20*055d4590SKeyi Gui      * Note: The use of the casts after the "?" in the following are
21*055d4590SKeyi Gui      * to avoid a bug in some (source code level) compilers.
22*055d4590SKeyi Gui      */
23*055d4590SKeyi Gui 
test1(boolean b)24*055d4590SKeyi Gui     static public Object test1(boolean b) {
25*055d4590SKeyi Gui         return (b ? new String[1] : new Integer[1])[0];
26*055d4590SKeyi Gui     }
27*055d4590SKeyi Gui 
test2(boolean b)28*055d4590SKeyi Gui     static public int test2(boolean b) {
29*055d4590SKeyi Gui         Object o = b ? (Object) new int[1] : new float[1];
30*055d4590SKeyi Gui         return o.hashCode();
31*055d4590SKeyi Gui     }
32*055d4590SKeyi Gui 
test3(boolean b)33*055d4590SKeyi Gui     static public int test3(boolean b) {
34*055d4590SKeyi Gui         Object o = b ? (Object) new char[1] : new double[1];
35*055d4590SKeyi Gui         return o.hashCode();
36*055d4590SKeyi Gui     }
37*055d4590SKeyi Gui 
test4(boolean b)38*055d4590SKeyi Gui     static public int test4(boolean b) {
39*055d4590SKeyi Gui         Object o = b ? (Object) new long[1] : new boolean[1];
40*055d4590SKeyi Gui         return o.hashCode();
41*055d4590SKeyi Gui     }
42*055d4590SKeyi Gui 
test5(boolean b)43*055d4590SKeyi Gui     static public int test5(boolean b) {
44*055d4590SKeyi Gui         Object o = b ? (Object) new short[1] : new Object[1];
45*055d4590SKeyi Gui         return o.hashCode();
46*055d4590SKeyi Gui     }
47*055d4590SKeyi Gui 
test6(boolean b)48*055d4590SKeyi Gui     static public int test6(boolean b) {
49*055d4590SKeyi Gui         Object o = b ? (Object) new byte[1] : new boolean[1];
50*055d4590SKeyi Gui         return o.hashCode();
51*055d4590SKeyi Gui     }
52*055d4590SKeyi Gui 
test7(boolean b)53*055d4590SKeyi Gui     static public Object test7(boolean b) {
54*055d4590SKeyi Gui         return (b ? new String[1] : new int[1][])[0];
55*055d4590SKeyi Gui     }
56*055d4590SKeyi Gui 
test8(boolean b)57*055d4590SKeyi Gui     static public Object[] test8(boolean b) {
58*055d4590SKeyi Gui         return (b ? new String[1][] : new int[1][][])[0];
59*055d4590SKeyi Gui     }
60*055d4590SKeyi Gui }
61