Replaced sure() invocations with '!!' operator in diagnostic tests.

This commit is contained in:
Evgeny Gerashchenko
2012-09-14 17:22:34 +04:00
parent 6e62212727
commit 5de734c9f3
5 changed files with 7 additions and 7 deletions
@@ -3,7 +3,7 @@ package kt1189
import java.util.concurrent.locks.ReentrantReadWriteLock
inline fun <T> ReentrantReadWriteLock.write(action: ()->T) : T {
val rl = readLock().sure()
val rl = readLock()!!
var readCount = 0
val writeCount = getWriteHoldCount()
if(writeCount == 0) {
@@ -13,7 +13,7 @@ inline fun <T> ReentrantReadWriteLock.write(action: ()->T) : T {
rl.unlock()
}
val wl = writeLock().sure()
val wl = writeLock()!!
wl.lock()
try {
return action()
@@ -14,7 +14,7 @@ fun <T : Any> T?.iterator() = object {
fun next() : T {
if (hasNext) {
hasNext = false
return this@iterator.sure()
return this@iterator!!
}
throw java.util.NoSuchElementException()
}
@@ -7,7 +7,7 @@ fun getJavaClass<T>() : java.lang.Class<T> { <!NO_RETURN_IN_FUNCTION_WITH_BLOCK_
public class Throwables() {
class object {
public fun propagateIfInstanceOf<X : Throwable?>(throwable : Throwable?, declaredType : Class<X?>?) : Unit {
if (((throwable != null) && declaredType?.isInstance(throwable).sure()))
if (((throwable != null) && declaredType?.isInstance(throwable)!!))
{
throw declaredType?.cast(throwable)!!
}
@@ -27,5 +27,5 @@ fun test(a : List<Int>, m : Map<String, Int>) {
)
HashMap<Int, Int>().get(0)
if (m.get("") != null)
System.out.println(m.get("").sure().plus(1))
System.out.println(m.get("")!!.plus(1))
}
@@ -4,9 +4,9 @@ fun getJavaClass<T>() : java.lang.Class<T> { return "" <!CAST_NEVER_SUCCEEDS!>as
public class Throwables() {
class object {
public fun propagateIfInstanceOf<X : Throwable?>(throwable : Throwable?, declaredType : Class<X?>?) {
if (((throwable != null) && declaredType?.isInstance(throwable).sure()))
if (((throwable != null) && declaredType?.isInstance(throwable)!!))
{
throw declaredType?.cast(throwable).sure()
throw declaredType?.cast(throwable)!!
}
}
public fun propagateIfPossible(throwable : Throwable?) {