Home | History | Annotate | Download | only in 090-dex-unify-arrays
      1 /*
      2  * Copyright (C) 2007 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 public class Blort
     18 {
     19     /*
     20      * Note: The use of the casts after the "?" in the following are
     21      * to avoid a bug in some (source code level) compilers.
     22      */
     23 
     24     static public Object test1(boolean b) {
     25         return (b ? new String[1] : new Integer[1])[0];
     26     }
     27 
     28     static public int test2(boolean b) {
     29         Object o = b ? (Object) new int[1] : new float[1];
     30         return o.hashCode();
     31     }
     32 
     33     static public int test3(boolean b) {
     34         Object o = b ? (Object) new char[1] : new double[1];
     35         return o.hashCode();
     36     }
     37 
     38     static public int test4(boolean b) {
     39         Object o = b ? (Object) new long[1] : new boolean[1];
     40         return o.hashCode();
     41     }
     42 
     43     static public int test5(boolean b) {
     44         Object o = b ? (Object) new short[1] : new Object[1];
     45         return o.hashCode();
     46     }
     47 
     48     static public int test6(boolean b) {
     49         Object o = b ? (Object) new byte[1] : new boolean[1];
     50         return o.hashCode();
     51     }
     52 
     53     static public Object test7(boolean b) {
     54         return (b ? new String[1] : new int[1][])[0];
     55     }
     56 
     57     static public Object[] test8(boolean b) {
     58         return (b ? new String[1][] : new int[1][][])[0];
     59     }
     60 }
     61