Replaced sure() invocations with '!!' operator in diagnostic tests.
This commit is contained in:
@@ -3,7 +3,7 @@ package kt1189
|
|||||||
import java.util.concurrent.locks.ReentrantReadWriteLock
|
import java.util.concurrent.locks.ReentrantReadWriteLock
|
||||||
|
|
||||||
inline fun <T> ReentrantReadWriteLock.write(action: ()->T) : T {
|
inline fun <T> ReentrantReadWriteLock.write(action: ()->T) : T {
|
||||||
val rl = readLock().sure()
|
val rl = readLock()!!
|
||||||
var readCount = 0
|
var readCount = 0
|
||||||
val writeCount = getWriteHoldCount()
|
val writeCount = getWriteHoldCount()
|
||||||
if(writeCount == 0) {
|
if(writeCount == 0) {
|
||||||
@@ -13,7 +13,7 @@ inline fun <T> ReentrantReadWriteLock.write(action: ()->T) : T {
|
|||||||
rl.unlock()
|
rl.unlock()
|
||||||
}
|
}
|
||||||
|
|
||||||
val wl = writeLock().sure()
|
val wl = writeLock()!!
|
||||||
wl.lock()
|
wl.lock()
|
||||||
try {
|
try {
|
||||||
return action()
|
return action()
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ fun <T : Any> T?.iterator() = object {
|
|||||||
fun next() : T {
|
fun next() : T {
|
||||||
if (hasNext) {
|
if (hasNext) {
|
||||||
hasNext = false
|
hasNext = false
|
||||||
return this@iterator.sure()
|
return this@iterator!!
|
||||||
}
|
}
|
||||||
throw java.util.NoSuchElementException()
|
throw java.util.NoSuchElementException()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ fun getJavaClass<T>() : java.lang.Class<T> { <!NO_RETURN_IN_FUNCTION_WITH_BLOCK_
|
|||||||
public class Throwables() {
|
public class Throwables() {
|
||||||
class object {
|
class object {
|
||||||
public fun propagateIfInstanceOf<X : Throwable?>(throwable : Throwable?, declaredType : Class<X?>?) : Unit {
|
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)!!
|
throw declaredType?.cast(throwable)!!
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,5 +27,5 @@ fun test(a : List<Int>, m : Map<String, Int>) {
|
|||||||
)
|
)
|
||||||
HashMap<Int, Int>().get(0)
|
HashMap<Int, Int>().get(0)
|
||||||
if (m.get("") != null)
|
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() {
|
public class Throwables() {
|
||||||
class object {
|
class object {
|
||||||
public fun propagateIfInstanceOf<X : Throwable?>(throwable : Throwable?, declaredType : Class<X?>?) {
|
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?) {
|
public fun propagateIfPossible(throwable : Throwable?) {
|
||||||
|
|||||||
Reference in New Issue
Block a user