1b7baf5c58d0e864f8c3f889357c51288aed42e61Nicolas Geoffray/*
2b7baf5c58d0e864f8c3f889357c51288aed42e61Nicolas Geoffray * Copyright (C) 2014 The Android Open Source Project
3b7baf5c58d0e864f8c3f889357c51288aed42e61Nicolas Geoffray *
4b7baf5c58d0e864f8c3f889357c51288aed42e61Nicolas Geoffray * Licensed under the Apache License, Version 2.0 (the "License");
5b7baf5c58d0e864f8c3f889357c51288aed42e61Nicolas Geoffray * you may not use this file except in compliance with the License.
6b7baf5c58d0e864f8c3f889357c51288aed42e61Nicolas Geoffray * You may obtain a copy of the License at
7b7baf5c58d0e864f8c3f889357c51288aed42e61Nicolas Geoffray *
8b7baf5c58d0e864f8c3f889357c51288aed42e61Nicolas Geoffray *      http://www.apache.org/licenses/LICENSE-2.0
9b7baf5c58d0e864f8c3f889357c51288aed42e61Nicolas Geoffray *
10b7baf5c58d0e864f8c3f889357c51288aed42e61Nicolas Geoffray * Unless required by applicable law or agreed to in writing, software
11b7baf5c58d0e864f8c3f889357c51288aed42e61Nicolas Geoffray * distributed under the License is distributed on an "AS IS" BASIS,
12b7baf5c58d0e864f8c3f889357c51288aed42e61Nicolas Geoffray * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13b7baf5c58d0e864f8c3f889357c51288aed42e61Nicolas Geoffray * See the License for the specific language governing permissions and
14b7baf5c58d0e864f8c3f889357c51288aed42e61Nicolas Geoffray * limitations under the License.
15b7baf5c58d0e864f8c3f889357c51288aed42e61Nicolas Geoffray */
16b7baf5c58d0e864f8c3f889357c51288aed42e61Nicolas Geoffray
17b7baf5c58d0e864f8c3f889357c51288aed42e61Nicolas Geoffraypublic class Main {
18b7baf5c58d0e864f8c3f889357c51288aed42e61Nicolas Geoffray  public static void main(String[] args) {
19b7baf5c58d0e864f8c3f889357c51288aed42e61Nicolas Geoffray    $opt$StaticSynchronizedMethod();
20b7baf5c58d0e864f8c3f889357c51288aed42e61Nicolas Geoffray    new Main().$opt$InstanceSynchronizedMethod();
21b7baf5c58d0e864f8c3f889357c51288aed42e61Nicolas Geoffray    $opt$SynchronizedBlock();
22b7baf5c58d0e864f8c3f889357c51288aed42e61Nicolas Geoffray    new Main().$opt$DoubleInstanceSynchronized();
23b7baf5c58d0e864f8c3f889357c51288aed42e61Nicolas Geoffray    $opt$DoubleStaticSynchronized();
24b7baf5c58d0e864f8c3f889357c51288aed42e61Nicolas Geoffray  }
25b7baf5c58d0e864f8c3f889357c51288aed42e61Nicolas Geoffray
26b7baf5c58d0e864f8c3f889357c51288aed42e61Nicolas Geoffray  public static synchronized void $opt$StaticSynchronizedMethod() {
27b7baf5c58d0e864f8c3f889357c51288aed42e61Nicolas Geoffray    System.out.println("In static method");
28b7baf5c58d0e864f8c3f889357c51288aed42e61Nicolas Geoffray  }
29b7baf5c58d0e864f8c3f889357c51288aed42e61Nicolas Geoffray
30b7baf5c58d0e864f8c3f889357c51288aed42e61Nicolas Geoffray  public synchronized void $opt$InstanceSynchronizedMethod() {
31b7baf5c58d0e864f8c3f889357c51288aed42e61Nicolas Geoffray    System.out.println("In instance method");
32b7baf5c58d0e864f8c3f889357c51288aed42e61Nicolas Geoffray  }
33b7baf5c58d0e864f8c3f889357c51288aed42e61Nicolas Geoffray
34b7baf5c58d0e864f8c3f889357c51288aed42e61Nicolas Geoffray  public static void $opt$SynchronizedBlock() {
35b7baf5c58d0e864f8c3f889357c51288aed42e61Nicolas Geoffray    Object o = new Object();
36b7baf5c58d0e864f8c3f889357c51288aed42e61Nicolas Geoffray    synchronized(o) {
37b7baf5c58d0e864f8c3f889357c51288aed42e61Nicolas Geoffray      System.out.println("In synchronized block");
38b7baf5c58d0e864f8c3f889357c51288aed42e61Nicolas Geoffray    }
39b7baf5c58d0e864f8c3f889357c51288aed42e61Nicolas Geoffray  }
40b7baf5c58d0e864f8c3f889357c51288aed42e61Nicolas Geoffray
41b7baf5c58d0e864f8c3f889357c51288aed42e61Nicolas Geoffray  public synchronized void $opt$DoubleInstanceSynchronized() {
42b7baf5c58d0e864f8c3f889357c51288aed42e61Nicolas Geoffray    synchronized (this) {
43b7baf5c58d0e864f8c3f889357c51288aed42e61Nicolas Geoffray      System.out.println("In second instance method");
44b7baf5c58d0e864f8c3f889357c51288aed42e61Nicolas Geoffray    }
45b7baf5c58d0e864f8c3f889357c51288aed42e61Nicolas Geoffray  }
46b7baf5c58d0e864f8c3f889357c51288aed42e61Nicolas Geoffray
47b7baf5c58d0e864f8c3f889357c51288aed42e61Nicolas Geoffray  public synchronized static void $opt$DoubleStaticSynchronized() {
48b7baf5c58d0e864f8c3f889357c51288aed42e61Nicolas Geoffray    synchronized (Main.class) {
49b7baf5c58d0e864f8c3f889357c51288aed42e61Nicolas Geoffray      System.out.println("In second static method");
50b7baf5c58d0e864f8c3f889357c51288aed42e61Nicolas Geoffray    }
51b7baf5c58d0e864f8c3f889357c51288aed42e61Nicolas Geoffray  }
52b7baf5c58d0e864f8c3f889357c51288aed42e61Nicolas Geoffray}
53