1 /* 2 * Copyright (C) 2010 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 /** 19 * The class has a method with too many levels of nested "synchronized" 20 * blocks. The verifier will reject it. 21 * 22 * (It would be perfectly okay if the verifier *didn't* reject this. 23 * The goal here is just to exercise the failure path. It also serves 24 * as a check to see if the monitor checks are enabled.) 25 */ 26 public class TooDeep { 27 excessiveNesting()28 public static void excessiveNesting() { 29 synchronized (TooDeep.class) { // 1 30 synchronized (TooDeep.class) { // 2 31 synchronized (TooDeep.class) { // 3 32 synchronized (TooDeep.class) { // 4 33 synchronized (TooDeep.class) { // 5 34 synchronized (TooDeep.class) { // 6 35 synchronized (TooDeep.class) { // 7 36 synchronized (TooDeep.class) { // 8 37 synchronized (TooDeep.class) { // 9 38 synchronized (TooDeep.class) { // 10 39 synchronized (TooDeep.class) { // 11 40 synchronized (TooDeep.class) { // 12 41 synchronized (TooDeep.class) { // 13 42 synchronized (TooDeep.class) { // 14 43 synchronized (TooDeep.class) { // 15 44 synchronized (TooDeep.class) { // 16 45 synchronized (TooDeep.class) { // 17 46 synchronized (TooDeep.class) { // 18 47 synchronized (TooDeep.class) { // 19 48 synchronized (TooDeep.class) { // 20 49 synchronized (TooDeep.class) { // 21 50 synchronized (TooDeep.class) { // 22 51 synchronized (TooDeep.class) { // 23 52 synchronized (TooDeep.class) { // 24 53 synchronized (TooDeep.class) { // 25 54 synchronized (TooDeep.class) { // 26 55 synchronized (TooDeep.class) { // 27 56 synchronized (TooDeep.class) { // 28 57 synchronized (TooDeep.class) { // 29 58 synchronized (TooDeep.class) { // 30 59 synchronized (TooDeep.class) { // 31 60 synchronized (TooDeep.class) { // 32 61 synchronized (TooDeep.class) { // 33 62 }}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}} 63 } 64 } 65