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 { caught()19*055d4590SKeyi Gui public static void caught() { 20*055d4590SKeyi Gui // This space intentionally left blank. 21*055d4590SKeyi Gui } 22*055d4590SKeyi Gui zorch(int x)23*055d4590SKeyi Gui public static void zorch(int x) { 24*055d4590SKeyi Gui // This space intentionally left blank. 25*055d4590SKeyi Gui } 26*055d4590SKeyi Gui test1(int x)27*055d4590SKeyi Gui public static void test1(int x) { 28*055d4590SKeyi Gui // In this test, the code being try-caught can't possibly throw. 29*055d4590SKeyi Gui try { 30*055d4590SKeyi Gui x = 0; 31*055d4590SKeyi Gui } catch (RuntimeException ex) { 32*055d4590SKeyi Gui caught(); 33*055d4590SKeyi Gui } 34*055d4590SKeyi Gui } 35*055d4590SKeyi Gui test2(String[] sa)36*055d4590SKeyi Gui public static void test2(String[] sa) { 37*055d4590SKeyi Gui // In this test, the code being try-caught doesn't contain any 38*055d4590SKeyi Gui // constant pool references. 39*055d4590SKeyi Gui try { 40*055d4590SKeyi Gui int x = sa.length; 41*055d4590SKeyi Gui } catch (RuntimeException ex) { 42*055d4590SKeyi Gui caught(); 43*055d4590SKeyi Gui } 44*055d4590SKeyi Gui } 45*055d4590SKeyi Gui test3()46*055d4590SKeyi Gui public static void test3() { 47*055d4590SKeyi Gui // In this test, the code being try-caught contains a constant 48*055d4590SKeyi Gui // pool reference. 49*055d4590SKeyi Gui try { 50*055d4590SKeyi Gui zorch(1); 51*055d4590SKeyi Gui } catch (RuntimeException ex) { 52*055d4590SKeyi Gui caught(); 53*055d4590SKeyi Gui } 54*055d4590SKeyi Gui } 55*055d4590SKeyi Gui test4(String[] sa)56*055d4590SKeyi Gui public static void test4(String[] sa) { 57*055d4590SKeyi Gui // In this test, the code being try-caught contains one 58*055d4590SKeyi Gui // throwing instruction that has a constant pool reference and 59*055d4590SKeyi Gui // one that doesn't. 60*055d4590SKeyi Gui try { 61*055d4590SKeyi Gui zorch(sa.length); 62*055d4590SKeyi Gui } catch (RuntimeException ex) { 63*055d4590SKeyi Gui caught(); 64*055d4590SKeyi Gui } 65*055d4590SKeyi Gui } 66*055d4590SKeyi Gui } 67