KT-4825 Implement "synchronized" properly via monitorenter/monitorexit

#KT-4825 Fixed
This commit is contained in:
Andrey Breslav
2014-07-02 21:25:32 +04:00
parent c0fc5cfb53
commit 90690e0711
11 changed files with 170 additions and 16 deletions
@@ -20,6 +20,7 @@ import kotlin.Function0;
import kotlin.IntRange;
import kotlin.KotlinNullPointerException;
import java.lang.Deprecated;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
@@ -87,6 +88,8 @@ public class Intrinsics {
return new IntRange(0, length - 1);
}
// TODO: remove this function when ABI version is advanced
@Deprecated // A better implementation of synchronized is used now
public static <R> R stupidSync(Object lock, Function0<R> block) {
synchronized (lock) {
return block.invoke();