Home | History | Annotate | Download | only in 073-dex-null-array-refs
      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     public static Object test1() {
     20         return ((Object[]) null)[0];
     21     }
     22 
     23     public static void test2() {
     24         ((Object[]) null)[0] = null;
     25     }
     26 
     27     public static int test3() {
     28         return ((Object[]) null).length;
     29     }
     30 
     31     public static Object test4() {
     32         Object[] arr = null;
     33         return arr[0];
     34     }
     35 
     36     public static void test5() {
     37         Object[] arr = null;
     38         arr[0] = null;
     39     }
     40 
     41     public static int test6() {
     42         Object[] arr = null;
     43         return arr.length;
     44     }
     45 
     46     public static Object test7(Object[] arr) {
     47         if (check()) {
     48             arr = null;
     49         }
     50 
     51         return arr[0];
     52     }
     53 
     54     public static void test8(Object[] arr) {
     55         if (check()) {
     56             arr = null;
     57         }
     58 
     59         arr[0] = null;
     60     }
     61 
     62     public static int test9(Object[] arr) {
     63         if (check()) {
     64             arr = null;
     65         }
     66 
     67         return arr.length;
     68     }
     69 
     70     public static boolean check() {
     71         return true;
     72     }
     73 }
     74