Home | History | Annotate | Download | only in targets
      1 /*******************************************************************************
      2  * Copyright (c) 2009, 2015 Mountainminds GmbH & Co. KG and Contributors
      3  * All rights reserved. This program and the accompanying materials
      4  * are made available under the terms of the Eclipse Public License v1.0
      5  * which accompanies this distribution, and is available at
      6  * http://www.eclipse.org/legal/epl-v10.html
      7  *
      8  * Contributors:
      9  *    Marc R. Hoffmann - initial API and implementation
     10  *
     11  *******************************************************************************/
     12 package org.jacoco.core.test.validation.targets;
     13 
     14 import static org.jacoco.core.test.validation.targets.Stubs.nop;
     15 
     16 /**
     17  * This target uses synchronized blocks which compile to try/catch statements.
     18  */
     19 public class Target12 implements Runnable {
     20 
     21 	public void run() {
     22 		simple();
     23 		nested();
     24 	}
     25 
     26 	void simple() {
     27 		synchronized (this) {
     28 			nop();
     29 		}
     30 	}
     31 
     32 	void nested() {
     33 		Object lock1 = new Object();
     34 		synchronized (lock1) {
     35 			nop();
     36 			Object lock2 = new Object();
     37 			synchronized (lock2) {
     38 				nop();
     39 			}
     40 			nop();
     41 		}
     42 
     43 	}
     44 
     45 	public static void main(String[] args) {
     46 		new Target12().run();
     47 	}
     48 
     49 }
     50