1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
public class SynchronizedInAnonymousClass { Object annonymous = new Object() { class Inner { @java.lang.SuppressWarnings("all") private final java.lang.Object $lock = new java.lang.Object[0]; public void foo() { synchronized (this.$lock) { String foo = "bar"; } } } }; }