jeffhao | 5d1ac92 | 2011-09-29 17:41:15 -0700 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (C) 2011 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 | /* |
| 18 | * Create two versions of loops where the unresolved field is on either the |
| 19 | * taken or the non-taken path to make sure that the loop detection code bails |
| 20 | * on unresolved fields. |
| 21 | */ |
| 22 | public class Main { |
| 23 | static int counter1; |
| 24 | static int counter2; |
| 25 | static int counter3; |
| 26 | static int counter4; |
| 27 | static int counter5; |
| 28 | |
| 29 | public static void main(String[] args) { |
| 30 | /* counter1 is not resolved */ |
| 31 | for (int i = 0; i < 32767; i++) { |
| 32 | if (i < 0) { |
| 33 | counter1++; |
| 34 | } else { |
| 35 | counter2++; |
| 36 | } |
| 37 | counter5++; |
| 38 | } |
| 39 | |
| 40 | /* counter4 is not resolved */ |
| 41 | for (int i = 0; i < 32767; i++) { |
| 42 | if (i >= 0) { |
| 43 | counter3++; |
| 44 | } else { |
| 45 | counter4++; |
| 46 | } |
| 47 | counter5++; |
| 48 | } |
| 49 | |
| 50 | System.out.println("counter1 is " + counter1); |
| 51 | System.out.println("counter2 is " + counter2); |
| 52 | System.out.println("counter3 is " + counter3); |
| 53 | System.out.println("counter4 is " + counter4); |
| 54 | System.out.println("counter5 is " + counter5); |
| 55 | } |
| 56 | } |