remove some unnecessary !! from stdlib
This commit is contained in:
@@ -100,6 +100,9 @@
|
|||||||
<item name='java.util.concurrent.ExecutorService java.util.concurrent.Future<T> submit(java.util.concurrent.Callable<T>) 0'>
|
<item name='java.util.concurrent.ExecutorService java.util.concurrent.Future<T> submit(java.util.concurrent.Callable<T>) 0'>
|
||||||
<annotation name='org.jetbrains.annotations.NotNull'/>
|
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||||
</item>
|
</item>
|
||||||
|
<item name='java.util.concurrent.ExecutorService java.util.concurrent.Future<T> submit(java.util.concurrent.Callable<T>)'>
|
||||||
|
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||||
|
</item>
|
||||||
<item name='java.util.concurrent.ExecutorService java.util.concurrent.Future<T> submit(java.lang.Runnable, T) 0'>
|
<item name='java.util.concurrent.ExecutorService java.util.concurrent.Future<T> submit(java.lang.Runnable, T) 0'>
|
||||||
<annotation name='org.jetbrains.annotations.NotNull'/>
|
<annotation name='org.jetbrains.annotations.NotNull'/>
|
||||||
</item>
|
</item>
|
||||||
|
|||||||
@@ -6,10 +6,10 @@ import java.util.concurrent.Future
|
|||||||
import java.util.concurrent.Callable
|
import java.util.concurrent.Callable
|
||||||
|
|
||||||
inline val currentThread : Thread
|
inline val currentThread : Thread
|
||||||
get() = Thread.currentThread()!!
|
get() = Thread.currentThread()
|
||||||
|
|
||||||
inline var Thread.name : String
|
inline var Thread.name : String
|
||||||
get() = getName()!!
|
get() = getName()
|
||||||
set(name: String) { setName(name) }
|
set(name: String) { setName(name) }
|
||||||
|
|
||||||
inline var Thread.daemon : Boolean
|
inline var Thread.daemon : Boolean
|
||||||
@@ -66,7 +66,7 @@ public inline fun Executor.invoke(action: ()->Unit) {
|
|||||||
*/
|
*/
|
||||||
public inline fun <T>ExecutorService.submit(action: ()->T):Future<T> {
|
public inline fun <T>ExecutorService.submit(action: ()->T):Future<T> {
|
||||||
val c:Callable<T> = callable(action)
|
val c:Callable<T> = callable(action)
|
||||||
return submit(c)!!;
|
return submit(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ public inline fun <T> T?.makeString(separator: String = ", ", prefix: String = "
|
|||||||
buffer.append(this)
|
buffer.append(this)
|
||||||
}
|
}
|
||||||
buffer.append(postfix)
|
buffer.append(postfix)
|
||||||
return buffer.toString()!!
|
return buffer.toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ class CompositeIterator<T>(vararg iterators: Iterator<T>): AbstractIterator<T>()
|
|||||||
val iter = currentIter
|
val iter = currentIter
|
||||||
if (iter != null) {
|
if (iter != null) {
|
||||||
if (iter.hasNext()) {
|
if (iter.hasNext()) {
|
||||||
setNext(iter.next()!!)
|
setNext(iter.next())
|
||||||
return
|
return
|
||||||
} else {
|
} else {
|
||||||
currentIter = null
|
currentIter = null
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ public open class ToStringFormatter : Formatter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public val defaultLocale : Locale = Locale.getDefault()!!
|
public val defaultLocale : Locale = Locale.getDefault()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Formats values using a given [[Locale]] for internationalisation
|
* Formats values using a given [[Locale]] for internationalisation
|
||||||
|
|||||||
@@ -409,7 +409,7 @@ class CollectionTest {
|
|||||||
private val collection = collection
|
private val collection = collection
|
||||||
|
|
||||||
override fun iterator(): Iterator<T> {
|
override fun iterator(): Iterator<T> {
|
||||||
return collection.iterator()!!
|
return collection.iterator()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ class IoTest() : TestCase() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun testListFiles() {
|
fun testListFiles() {
|
||||||
val dir = File.createTempFile("temp", System.nanoTime().toString())!!
|
val dir = File.createTempFile("temp", System.nanoTime().toString())
|
||||||
dir.delete()
|
dir.delete()
|
||||||
dir.mkdir()
|
dir.mkdir()
|
||||||
|
|
||||||
@@ -81,7 +81,7 @@ class IoTest() : TestCase() {
|
|||||||
File.createTempFile("temp", "2.java", dir)
|
File.createTempFile("temp", "2.java", dir)
|
||||||
File.createTempFile("temp", "3.kt", dir)
|
File.createTempFile("temp", "3.kt", dir)
|
||||||
|
|
||||||
val result = dir.listFiles { it.getName()!!.endsWith(".kt") }
|
val result = dir.listFiles { it.getName().endsWith(".kt") }
|
||||||
|
|
||||||
assertNotNull(result)
|
assertNotNull(result)
|
||||||
assertEquals(result!!.size, 2)
|
assertEquals(result!!.size, 2)
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import java.util.concurrent.TimeUnit.*
|
|||||||
class ThreadTest {
|
class ThreadTest {
|
||||||
test fun scheduledTask() {
|
test fun scheduledTask() {
|
||||||
|
|
||||||
val pool = Executors.newFixedThreadPool(1)!!
|
val pool = Executors.newFixedThreadPool(1)
|
||||||
val countDown = CountDownLatch(1)
|
val countDown = CountDownLatch(1)
|
||||||
pool {
|
pool {
|
||||||
countDown.countDown()
|
countDown.countDown()
|
||||||
@@ -21,7 +21,7 @@ class ThreadTest {
|
|||||||
|
|
||||||
test fun callableInvoke() {
|
test fun callableInvoke() {
|
||||||
|
|
||||||
val pool = Executors.newFixedThreadPool(1)!!
|
val pool = Executors.newFixedThreadPool(1)
|
||||||
val future = pool<String> {
|
val future = pool<String> {
|
||||||
"Hello"
|
"Hello"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ fun f(xs: Iterator<Int>): Int {
|
|||||||
class Kt2495Test {
|
class Kt2495Test {
|
||||||
test fun duplicateIteratorsBug() {
|
test fun duplicateIteratorsBug() {
|
||||||
val list = arrayList(1, 2, 3)
|
val list = arrayList(1, 2, 3)
|
||||||
val result = f(list.iterator()!!)
|
val result = f(list.iterator())
|
||||||
assertEquals(6, result)
|
assertEquals(6, result)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -99,7 +99,7 @@ fun parseAtomic(tokens : Deque<Token>) : ParseResult<Expression> {
|
|||||||
else
|
else
|
||||||
Failure("Expecting ')'")
|
Failure("Expecting ')'")
|
||||||
}
|
}
|
||||||
is Number -> Success(Num(Integer.parseInt((token as Token).text)!!))
|
is Number -> Success(Num(Integer.parseInt((token as Token).text)))
|
||||||
else -> Failure("Unexpected EOF")
|
else -> Failure("Unexpected EOF")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,11 +13,11 @@ class LocaleTemplateTest : TestCase() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun testFrance() : Unit {
|
fun testFrance() : Unit {
|
||||||
format(LocaleFormatter(Locale.FRANCE!!))
|
format(LocaleFormatter(Locale.FRANCE))
|
||||||
}
|
}
|
||||||
|
|
||||||
fun testGermany() : Unit {
|
fun testGermany() : Unit {
|
||||||
format(LocaleFormatter(Locale.GERMANY!!))
|
format(LocaleFormatter(Locale.GERMANY))
|
||||||
}
|
}
|
||||||
|
|
||||||
fun format(formatter: LocaleFormatter): Unit {
|
fun format(formatter: LocaleFormatter): Unit {
|
||||||
|
|||||||
Reference in New Issue
Block a user