Monitorenter02.java revision 12651:6ef01bd40ce2
1191762Simp/* 2191762Simp * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. 3191762Simp * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4191762Simp * 5191762Simp * This code is free software; you can redistribute it and/or modify it 6191762Simp * under the terms of the GNU General Public License version 2 only, as 7191762Simp * published by the Free Software Foundation. 8191762Simp * 9191762Simp * This code is distributed in the hope that it will be useful, but WITHOUT 10191762Simp * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11191762Simp * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12191762Simp * version 2 for more details (a copy is included in the LICENSE file that 13191762Simp * accompanied this code). 14191762Simp * 15191762Simp * You should have received a copy of the GNU General Public License version 16191762Simp * 2 along with this work; if not, write to the Free Software Foundation, 17191762Simp * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18191762Simp * 19191762Simp * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20191762Simp * or visit www.oracle.com if you need additional information or have any 21191762Simp * questions. 22191762Simp */ 23191762Simp/* 24191762Simp */ 25191762Simppackage org.graalvm.compiler.jtt.threads; 26191762Simp 27191762Simpimport org.junit.Test; 28191762Simp 29191762Simpimport org.graalvm.compiler.jtt.JTTTest; 30191762Simp 31191762Simppublic final class Monitorenter02 extends JTTTest { 32191762Simp 33191762Simp static final Object object = new Object(); 34191762Simp 35191762Simp public static boolean test() { 36191762Simp // test nested locking. 37191762Simp synchronized (object) { 38191762Simp return test2(); 39191762Simp } 40191762Simp } 41191762Simp 42235338Sadrian private static boolean test2() { 43191762Simp synchronized (object) { 44191762Simp return true; 45191762Simp } 46191762Simp } 47191762Simp 48191762Simp @Test(timeout = 20000) 49191762Simp public void run0() throws Throwable { 50191762Simp runTest("test"); 51191762Simp } 52191762Simp 53191762Simp} 54191762Simp