diff --git a/libraries/stdlib/src/generated/ArraysFromIterables.kt b/libraries/stdlib/src/generated/ArraysFromIterables.kt index cc83bce78b8..7c715288ecd 100644 --- a/libraries/stdlib/src/generated/ArraysFromIterables.kt +++ b/libraries/stdlib/src/generated/ArraysFromIterables.kt @@ -132,9 +132,7 @@ public inline fun > Array?.filterNotNullTo(res public inline fun Array.flatMapTo(result: MutableCollection, transform: (T) -> Collection) : Collection { for (element in this) { val list = transform(element) - if (list != null) { - for (r in list) result.add(r) - } + for (r in list) result.add(r) } return result } @@ -172,7 +170,7 @@ public inline fun Array.foldRight(initial: R, operation: (T, R) -> R): * @includeFunctionBody ../../test/CollectionTest.kt reduce */ public inline fun Array.reduce(operation: (T, T) -> T): T { - val iterator = this.iterator()!! + val iterator = this.iterator() if (!iterator.hasNext()) { throw UnsupportedOperationException("Empty iterable can't be reduced") } @@ -226,7 +224,7 @@ public inline fun Array.groupByTo(result: MutableMap public inline fun Array.makeString(separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "..."): String { val buffer = StringBuilder() appendString(buffer, separator, prefix, postfix, limit, truncated) - return buffer.toString()!! + return buffer.toString() } /** Returns a list containing the everything but the first elements that satisfy the given *predicate* */ diff --git a/libraries/stdlib/src/generated/BooleanArraysFromIterables.kt b/libraries/stdlib/src/generated/BooleanArraysFromIterables.kt index 44926bd5e36..870f3c56398 100644 --- a/libraries/stdlib/src/generated/BooleanArraysFromIterables.kt +++ b/libraries/stdlib/src/generated/BooleanArraysFromIterables.kt @@ -132,9 +132,7 @@ public inline fun > BooleanArray?.filterNotNullTo( public inline fun BooleanArray.flatMapTo(result: MutableCollection, transform: (Boolean) -> Collection) : Collection { for (element in this) { val list = transform(element) - if (list != null) { - for (r in list) result.add(r) - } + for (r in list) result.add(r) } return result } @@ -172,7 +170,7 @@ public inline fun BooleanArray.foldRight(initial: R, operation: (Boolean, R) * @includeFunctionBody ../../test/CollectionTest.kt reduce */ public inline fun BooleanArray.reduce(operation: (Boolean, Boolean) -> Boolean): Boolean { - val iterator = this.iterator()!! + val iterator = this.iterator() if (!iterator.hasNext()) { throw UnsupportedOperationException("Empty iterable can't be reduced") } @@ -226,7 +224,7 @@ public inline fun BooleanArray.groupByTo(result: MutableMap> ByteArray?.filterNotNullTo(result public inline fun ByteArray.flatMapTo(result: MutableCollection, transform: (Byte) -> Collection) : Collection { for (element in this) { val list = transform(element) - if (list != null) { - for (r in list) result.add(r) - } + for (r in list) result.add(r) } return result } @@ -172,7 +170,7 @@ public inline fun ByteArray.foldRight(initial: R, operation: (Byte, R) -> R) * @includeFunctionBody ../../test/CollectionTest.kt reduce */ public inline fun ByteArray.reduce(operation: (Byte, Byte) -> Byte): Byte { - val iterator = this.iterator()!! + val iterator = this.iterator() if (!iterator.hasNext()) { throw UnsupportedOperationException("Empty iterable can't be reduced") } @@ -226,7 +224,7 @@ public inline fun ByteArray.groupByTo(result: MutableMap> CharArray?.filterNotNullTo(result public inline fun CharArray.flatMapTo(result: MutableCollection, transform: (Char) -> Collection) : Collection { for (element in this) { val list = transform(element) - if (list != null) { - for (r in list) result.add(r) - } + for (r in list) result.add(r) } return result } @@ -172,7 +170,7 @@ public inline fun CharArray.foldRight(initial: R, operation: (Char, R) -> R) * @includeFunctionBody ../../test/CollectionTest.kt reduce */ public inline fun CharArray.reduce(operation: (Char, Char) -> Char): Char { - val iterator = this.iterator()!! + val iterator = this.iterator() if (!iterator.hasNext()) { throw UnsupportedOperationException("Empty iterable can't be reduced") } @@ -226,7 +224,7 @@ public inline fun CharArray.groupByTo(result: MutableMap> DoubleArray?.filterNotNullTo(re public inline fun DoubleArray.flatMapTo(result: MutableCollection, transform: (Double) -> Collection) : Collection { for (element in this) { val list = transform(element) - if (list != null) { - for (r in list) result.add(r) - } + for (r in list) result.add(r) } return result } @@ -172,7 +170,7 @@ public inline fun DoubleArray.foldRight(initial: R, operation: (Double, R) - * @includeFunctionBody ../../test/CollectionTest.kt reduce */ public inline fun DoubleArray.reduce(operation: (Double, Double) -> Double): Double { - val iterator = this.iterator()!! + val iterator = this.iterator() if (!iterator.hasNext()) { throw UnsupportedOperationException("Empty iterable can't be reduced") } @@ -226,7 +224,7 @@ public inline fun DoubleArray.groupByTo(result: MutableMap> FloatArray?.filterNotNullTo(resu public inline fun FloatArray.flatMapTo(result: MutableCollection, transform: (Float) -> Collection) : Collection { for (element in this) { val list = transform(element) - if (list != null) { - for (r in list) result.add(r) - } + for (r in list) result.add(r) } return result } @@ -172,7 +170,7 @@ public inline fun FloatArray.foldRight(initial: R, operation: (Float, R) -> * @includeFunctionBody ../../test/CollectionTest.kt reduce */ public inline fun FloatArray.reduce(operation: (Float, Float) -> Float): Float { - val iterator = this.iterator()!! + val iterator = this.iterator() if (!iterator.hasNext()) { throw UnsupportedOperationException("Empty iterable can't be reduced") } @@ -226,7 +224,7 @@ public inline fun FloatArray.groupByTo(result: MutableMap> IntArray?.filterNotNullTo(result: public inline fun IntArray.flatMapTo(result: MutableCollection, transform: (Int) -> Collection) : Collection { for (element in this) { val list = transform(element) - if (list != null) { - for (r in list) result.add(r) - } + for (r in list) result.add(r) } return result } @@ -172,7 +170,7 @@ public inline fun IntArray.foldRight(initial: R, operation: (Int, R) -> R): * @includeFunctionBody ../../test/CollectionTest.kt reduce */ public inline fun IntArray.reduce(operation: (Int, Int) -> Int): Int { - val iterator = this.iterator()!! + val iterator = this.iterator() if (!iterator.hasNext()) { throw UnsupportedOperationException("Empty iterable can't be reduced") } @@ -226,7 +224,7 @@ public inline fun IntArray.groupByTo(result: MutableMap> public inline fun IntArray.makeString(separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "..."): String { val buffer = StringBuilder() appendString(buffer, separator, prefix, postfix, limit, truncated) - return buffer.toString()!! + return buffer.toString() } /** Returns a list containing the everything but the first elements that satisfy the given *predicate* */ diff --git a/libraries/stdlib/src/generated/IteratorsFromIterables.kt b/libraries/stdlib/src/generated/IteratorsFromIterables.kt index 38a929c81eb..25644807237 100644 --- a/libraries/stdlib/src/generated/IteratorsFromIterables.kt +++ b/libraries/stdlib/src/generated/IteratorsFromIterables.kt @@ -131,9 +131,7 @@ public inline fun > Iterator?.filterNotNullTo( public inline fun Iterator.flatMapTo(result: MutableCollection, transform: (T) -> Collection) : Collection { for (element in this) { val list = transform(element) - if (list != null) { - for (r in list) result.add(r) - } + for (r in list) result.add(r) } return result } @@ -171,7 +169,7 @@ public inline fun Iterator.foldRight(initial: R, operation: (T, R) -> R * @includeFunctionBody ../../test/CollectionTest.kt reduce */ public inline fun Iterator.reduce(operation: (T, T) -> T): T { - val iterator = this.iterator()!! + val iterator = this.iterator() if (!iterator.hasNext()) { throw UnsupportedOperationException("Empty iterable can't be reduced") } @@ -225,7 +223,7 @@ public inline fun Iterator.groupByTo(result: MutableMap Iterator.makeString(separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "..."): String { val buffer = StringBuilder() appendString(buffer, separator, prefix, postfix, limit, truncated) - return buffer.toString()!! + return buffer.toString() } /** Returns a list containing the everything but the first elements that satisfy the given *predicate* */ diff --git a/libraries/stdlib/src/generated/LongArraysFromIterables.kt b/libraries/stdlib/src/generated/LongArraysFromIterables.kt index 1a973905971..a7bf7fd69a9 100644 --- a/libraries/stdlib/src/generated/LongArraysFromIterables.kt +++ b/libraries/stdlib/src/generated/LongArraysFromIterables.kt @@ -132,9 +132,7 @@ public inline fun > LongArray?.filterNotNullTo(result public inline fun LongArray.flatMapTo(result: MutableCollection, transform: (Long) -> Collection) : Collection { for (element in this) { val list = transform(element) - if (list != null) { - for (r in list) result.add(r) - } + for (r in list) result.add(r) } return result } @@ -172,7 +170,7 @@ public inline fun LongArray.foldRight(initial: R, operation: (Long, R) -> R) * @includeFunctionBody ../../test/CollectionTest.kt reduce */ public inline fun LongArray.reduce(operation: (Long, Long) -> Long): Long { - val iterator = this.iterator()!! + val iterator = this.iterator() if (!iterator.hasNext()) { throw UnsupportedOperationException("Empty iterable can't be reduced") } @@ -226,7 +224,7 @@ public inline fun LongArray.groupByTo(result: MutableMap> ShortArray?.filterNotNullTo(resu public inline fun ShortArray.flatMapTo(result: MutableCollection, transform: (Short) -> Collection) : Collection { for (element in this) { val list = transform(element) - if (list != null) { - for (r in list) result.add(r) - } + for (r in list) result.add(r) } return result } @@ -172,7 +170,7 @@ public inline fun ShortArray.foldRight(initial: R, operation: (Short, R) -> * @includeFunctionBody ../../test/CollectionTest.kt reduce */ public inline fun ShortArray.reduce(operation: (Short, Short) -> Short): Short { - val iterator = this.iterator()!! + val iterator = this.iterator() if (!iterator.hasNext()) { throw UnsupportedOperationException("Empty iterable can't be reduced") } @@ -226,7 +224,7 @@ public inline fun ShortArray.groupByTo(result: MutableMap Array.fill(value: T) : Unit = Arrays.fill(this as Array, value) +public inline fun Array.fill(value: T) : Unit = Arrays.fill(this, value) public inline fun ByteArray.sort() : Unit = Arrays.sort(this) public inline fun ShortArray.sort() : Unit = Arrays.sort(this) @@ -75,29 +75,29 @@ public inline fun FloatArray.sort(fromIndex: Int, toIndex: Int) : Unit = Arrays public inline fun DoubleArray.sort(fromIndex: Int, toIndex: Int) : Unit = Arrays.sort(this, fromIndex, toIndex) public inline fun CharArray.sort(fromIndex: Int, toIndex: Int) : Unit = Arrays.sort(this, fromIndex, toIndex) -public inline fun BooleanArray.copyOf(newLength: Int = this.size) : BooleanArray = Arrays.copyOf(this, newLength)!! -public inline fun ByteArray.copyOf(newLength: Int = this.size) : ByteArray = Arrays.copyOf(this, newLength)!! -public inline fun ShortArray.copyOf(newLength: Int = this.size) : ShortArray = Arrays.copyOf(this, newLength)!! -public inline fun IntArray.copyOf(newLength: Int = this.size) : IntArray = Arrays.copyOf(this, newLength)!! -public inline fun LongArray.copyOf(newLength: Int = this.size) : LongArray = Arrays.copyOf(this, newLength)!! -public inline fun FloatArray.copyOf(newLength: Int = this.size) : FloatArray = Arrays.copyOf(this, newLength)!! -public inline fun DoubleArray.copyOf(newLength: Int = this.size) : DoubleArray = Arrays.copyOf(this, newLength)!! -public inline fun CharArray.copyOf(newLength: Int = this.size) : CharArray = Arrays.copyOf(this, newLength)!! +public inline fun BooleanArray.copyOf(newLength: Int = this.size) : BooleanArray = Arrays.copyOf(this, newLength) +public inline fun ByteArray.copyOf(newLength: Int = this.size) : ByteArray = Arrays.copyOf(this, newLength) +public inline fun ShortArray.copyOf(newLength: Int = this.size) : ShortArray = Arrays.copyOf(this, newLength) +public inline fun IntArray.copyOf(newLength: Int = this.size) : IntArray = Arrays.copyOf(this, newLength) +public inline fun LongArray.copyOf(newLength: Int = this.size) : LongArray = Arrays.copyOf(this, newLength) +public inline fun FloatArray.copyOf(newLength: Int = this.size) : FloatArray = Arrays.copyOf(this, newLength) +public inline fun DoubleArray.copyOf(newLength: Int = this.size) : DoubleArray = Arrays.copyOf(this, newLength) +public inline fun CharArray.copyOf(newLength: Int = this.size) : CharArray = Arrays.copyOf(this, newLength) // TODO: resuling array may contain nulls even if T is non-nullable -public inline fun Array.copyOf(newLength: Int = this.size) : Array = Arrays.copyOf(this as Array, newLength) as Array +public inline fun Array.copyOf(newLength: Int = this.size) : Array = Arrays.copyOf(this, newLength) as Array -public inline fun BooleanArray.copyOfRange(from: Int, to: Int) : BooleanArray = Arrays.copyOfRange(this, from, to)!! -public inline fun ByteArray.copyOfRange(from: Int, to: Int) : ByteArray = Arrays.copyOfRange(this, from, to)!! -public inline fun ShortArray.copyOfRange(from: Int, to: Int) : ShortArray = Arrays.copyOfRange(this, from, to)!! -public inline fun IntArray.copyOfRange(from: Int, to: Int) : IntArray = Arrays.copyOfRange(this, from, to)!! -public inline fun LongArray.copyOfRange(from: Int, to: Int) : LongArray = Arrays.copyOfRange(this, from, to)!! -public inline fun FloatArray.copyOfRange(from: Int, to: Int) : FloatArray = Arrays.copyOfRange(this, from, to)!! -public inline fun DoubleArray.copyOfRange(from: Int, to: Int) : DoubleArray = Arrays.copyOfRange(this, from, to)!! -public inline fun CharArray.copyOfRange(from: Int, to: Int) : CharArray = Arrays.copyOfRange(this, from, to)!! +public inline fun BooleanArray.copyOfRange(from: Int, to: Int) : BooleanArray = Arrays.copyOfRange(this, from, to) +public inline fun ByteArray.copyOfRange(from: Int, to: Int) : ByteArray = Arrays.copyOfRange(this, from, to) +public inline fun ShortArray.copyOfRange(from: Int, to: Int) : ShortArray = Arrays.copyOfRange(this, from, to) +public inline fun IntArray.copyOfRange(from: Int, to: Int) : IntArray = Arrays.copyOfRange(this, from, to) +public inline fun LongArray.copyOfRange(from: Int, to: Int) : LongArray = Arrays.copyOfRange(this, from, to) +public inline fun FloatArray.copyOfRange(from: Int, to: Int) : FloatArray = Arrays.copyOfRange(this, from, to) +public inline fun DoubleArray.copyOfRange(from: Int, to: Int) : DoubleArray = Arrays.copyOfRange(this, from, to) +public inline fun CharArray.copyOfRange(from: Int, to: Int) : CharArray = Arrays.copyOfRange(this, from, to) // TODO: resuling array may contain nulls even if T is non-nullable -public inline fun Array.copyOfRange(from: Int, to: Int) : Array = Arrays.copyOfRange(this as Array, from, to) as Array +public inline fun Array.copyOfRange(from: Int, to: Int) : Array = Arrays.copyOfRange(this, from, to) as Array public inline val ByteArray.inputStream : ByteArrayInputStream get() = ByteArrayInputStream(this) diff --git a/libraries/stdlib/src/kotlin/ImmutableArrayList.kt b/libraries/stdlib/src/kotlin/ImmutableArrayList.kt index 6b12e90c673..a120f06ba30 100644 --- a/libraries/stdlib/src/kotlin/ImmutableArrayList.kt +++ b/libraries/stdlib/src/kotlin/ImmutableArrayList.kt @@ -32,7 +32,7 @@ private class ImmutableArrayList( return index + offset } - public override fun get(index: Int): T = array[indexInArray(index)] as T + public override fun get(index: Int): T = array[indexInArray(index)] public override fun size() : Int = length diff --git a/libraries/stdlib/src/kotlin/Iterables.kt b/libraries/stdlib/src/kotlin/Iterables.kt index 7a33be874ed..95777062fbc 100644 --- a/libraries/stdlib/src/kotlin/Iterables.kt +++ b/libraries/stdlib/src/kotlin/Iterables.kt @@ -123,9 +123,7 @@ public inline fun > Iterable?.filterNotNullTo( public inline fun Iterable.flatMapTo(result: MutableCollection, transform: (T) -> Collection) : Collection { for (element in this) { val list = transform(element) - if (list != null) { - for (r in list) result.add(r) - } + for (r in list) result.add(r) } return result } @@ -163,7 +161,7 @@ public inline fun Iterable.foldRight(initial: R, operation: (T, R) -> R * @includeFunctionBody ../../test/CollectionTest.kt reduce */ public inline fun Iterable.reduce(operation: (T, T) -> T): T { - val iterator = this.iterator()!! + val iterator = this.iterator() if (!iterator.hasNext()) { throw UnsupportedOperationException("Empty iterable can't be reduced") } @@ -217,7 +215,7 @@ public inline fun Iterable.groupByTo(result: MutableMap Iterable.makeString(separator: String = ", ", prefix: String = "", postfix: String = "", limit: Int = -1, truncated: String = "..."): String { val buffer = StringBuilder() appendString(buffer, separator, prefix, postfix, limit, truncated) - return buffer.toString()!! + return buffer.toString() } /** Returns a list containing the everything but the first elements that satisfy the given *predicate* */ diff --git a/libraries/stdlib/src/kotlin/IterablesSpecial.kt b/libraries/stdlib/src/kotlin/IterablesSpecial.kt index b8157f476d0..fc1ed85728e 100644 --- a/libraries/stdlib/src/kotlin/IterablesSpecial.kt +++ b/libraries/stdlib/src/kotlin/IterablesSpecial.kt @@ -40,7 +40,7 @@ public inline fun Iterable.first() : T { return this.get(0) } - return this.iterator()!!.next() + return this.iterator().next() } /** @@ -60,7 +60,7 @@ public fun Iterable.last() : T { return this.get(this.size() - 1) } - val iterator = this.iterator()!! + val iterator = this.iterator() var last : T = iterator.next() while (iterator.hasNext()) { diff --git a/libraries/stdlib/src/kotlin/Maps.kt b/libraries/stdlib/src/kotlin/Maps.kt index c39f084d252..4f00239c174 100644 --- a/libraries/stdlib/src/kotlin/Maps.kt +++ b/libraries/stdlib/src/kotlin/Maps.kt @@ -23,20 +23,20 @@ public inline fun Map?.orEmpty() : Map /** Returns the key of the entry */ val Map.Entry.key : K - get() = getKey()!! + get() = getKey() /** Returns the value of the entry */ val Map.Entry.value : V - get() = getValue()!! + get() = getValue() /** Returns the key of the entry */ fun Map.Entry.component1() : K { - return getKey()!! + return getKey() } /** Returns the value of the entry */ fun Map.Entry.component2() : V { - return getValue()!! + return getValue() } /** @@ -74,8 +74,8 @@ public inline fun MutableMap.getOrPut(key: K, defaultValue: ()-> V) : * @includeFunctionBody ../../test/MapTest.kt iterateWithProperties */ public inline fun Map.iterator(): Iterator> { - val entrySet = this.entrySet()!! - return entrySet.iterator()!! + val entrySet = this.entrySet() + return entrySet.iterator() } /** diff --git a/libraries/stdlib/src/kotlin/Standard.kt b/libraries/stdlib/src/kotlin/Standard.kt index 2c2fb2e0523..082398ccf19 100644 --- a/libraries/stdlib/src/kotlin/Standard.kt +++ b/libraries/stdlib/src/kotlin/Standard.kt @@ -10,7 +10,7 @@ Helper to make java.util.Enumeration usable in for public fun java.util.Enumeration.iterator(): Iterator = object: Iterator { override fun hasNext(): Boolean = hasMoreElements() - public override fun next() : T = nextElement()!! + public override fun next() : T = nextElement() } /* diff --git a/libraries/stdlib/src/kotlin/StringsJVM.kt b/libraries/stdlib/src/kotlin/StringsJVM.kt index 560847bccc4..074b6df81bf 100644 --- a/libraries/stdlib/src/kotlin/StringsJVM.kt +++ b/libraries/stdlib/src/kotlin/StringsJVM.kt @@ -14,33 +14,33 @@ public inline fun String.indexOf(str : String) : Int = (this as java.lang.String public inline fun String.indexOf(str : String, fromIndex : Int) : Int = (this as java.lang.String).indexOf(str, fromIndex) -public inline fun String.replace(oldChar: Char, newChar : Char) : String = (this as java.lang.String).replace(oldChar, newChar)!! +public inline fun String.replace(oldChar: Char, newChar : Char) : String = (this as java.lang.String).replace(oldChar, newChar) -public inline fun String.replaceAll(regex: String, replacement : String) : String = (this as java.lang.String).replaceAll(regex, replacement)!! +public inline fun String.replaceAll(regex: String, replacement : String) : String = (this as java.lang.String).replaceAll(regex, replacement) -public inline fun String.trim() : String = (this as java.lang.String).trim()!! +public inline fun String.trim() : String = (this as java.lang.String).trim() -public inline fun String.toUpperCase() : String = (this as java.lang.String).toUpperCase()!! +public inline fun String.toUpperCase() : String = (this as java.lang.String).toUpperCase() -public inline fun String.toLowerCase() : String = (this as java.lang.String).toLowerCase()!! +public inline fun String.toLowerCase() : String = (this as java.lang.String).toLowerCase() public inline fun String.length() : Int = (this as java.lang.String).length() -public inline fun String.getBytes() : ByteArray = (this as java.lang.String).getBytes()!! +public inline fun String.getBytes() : ByteArray = (this as java.lang.String).getBytes() -public inline fun String.toCharArray() : CharArray = (this as java.lang.String).toCharArray()!! +public inline fun String.toCharArray() : CharArray = (this as java.lang.String).toCharArray() public inline fun String.toCharList(): List = toCharArray().toList() -public inline fun String.format(format : String, vararg args : Any?) : String = java.lang.String.format(format, args)!! +public inline fun String.format(format : String, vararg args : Any?) : String = java.lang.String.format(format, args) public inline fun String.split(regex : String) : Array = (this as java.lang.String).split(regex) as Array public inline fun String.split(ch : Char) : Array = (this as java.lang.String).split(java.util.regex.Pattern.quote(ch.toString())) as Array -public inline fun String.substring(beginIndex : Int) : String = (this as java.lang.String).substring(beginIndex)!! +public inline fun String.substring(beginIndex : Int) : String = (this as java.lang.String).substring(beginIndex) -public inline fun String.substring(beginIndex : Int, endIndex : Int) : String = (this as java.lang.String).substring(beginIndex, endIndex)!! +public inline fun String.substring(beginIndex : Int, endIndex : Int) : String = (this as java.lang.String).substring(beginIndex, endIndex) public inline fun String.startsWith(prefix: String) : Boolean = (this as java.lang.String).startsWith(prefix) @@ -74,59 +74,59 @@ public inline fun String(stringBuffer : java.lang.StringBuffer) : String = java. public inline fun String(stringBuilder : java.lang.StringBuilder) : String = java.lang.String(stringBuilder) as String -public inline fun String.replaceFirst(regex : String, replacement : String) : String = (this as java.lang.String).replaceFirst(regex, replacement)!! +public inline fun String.replaceFirst(regex : String, replacement : String) : String = (this as java.lang.String).replaceFirst(regex, replacement) -public inline fun String.charAt(index : Int) : Char = (this as java.lang.String).charAt(index)!! +public inline fun String.charAt(index : Int) : Char = (this as java.lang.String).charAt(index) public inline fun String.split(regex : String, limit : Int) : Array = (this as java.lang.String).split(regex, limit) -public inline fun String.codePointAt(index : Int) : Int = (this as java.lang.String).codePointAt(index)!! +public inline fun String.codePointAt(index : Int) : Int = (this as java.lang.String).codePointAt(index) -public inline fun String.codePointBefore(index : Int) : Int = (this as java.lang.String).codePointBefore(index)!! +public inline fun String.codePointBefore(index : Int) : Int = (this as java.lang.String).codePointBefore(index) public inline fun String.codePointCount(beginIndex : Int, endIndex : Int) : Int = (this as java.lang.String).codePointCount(beginIndex, endIndex) -public inline fun String.compareToIgnoreCase(str : String) : Int = (this as java.lang.String).compareToIgnoreCase(str)!! +public inline fun String.compareToIgnoreCase(str : String) : Int = (this as java.lang.String).compareToIgnoreCase(str) -public inline fun String.concat(str : String) : String = (this as java.lang.String).concat(str)!! +public inline fun String.concat(str : String) : String = (this as java.lang.String).concat(str) -public inline fun String.contentEquals(cs : CharSequence) : Boolean = (this as java.lang.String).contentEquals(cs)!! +public inline fun String.contentEquals(cs : CharSequence) : Boolean = (this as java.lang.String).contentEquals(cs) -public inline fun String.contentEquals(sb : StringBuffer) : Boolean = (this as java.lang.String).contentEquals(sb)!! +public inline fun String.contentEquals(sb : StringBuffer) : Boolean = (this as java.lang.String).contentEquals(sb) -public inline fun String.getBytes(charset : java.nio.charset.Charset) : ByteArray = (this as java.lang.String).getBytes(charset)!! +public inline fun String.getBytes(charset : java.nio.charset.Charset) : ByteArray = (this as java.lang.String).getBytes(charset) -public inline fun String.getBytes(charsetName : String) : ByteArray = (this as java.lang.String).getBytes(charsetName)!! +public inline fun String.getBytes(charsetName : String) : ByteArray = (this as java.lang.String).getBytes(charsetName) -public inline fun String.getChars(srcBegin : Int, srcEnd : Int, dst : CharArray, dstBegin : Int) : Tuple0 = (this as java.lang.String).getChars(srcBegin, srcEnd, dst, dstBegin)!! +public inline fun String.getChars(srcBegin : Int, srcEnd : Int, dst : CharArray, dstBegin : Int) : Tuple0 = (this as java.lang.String).getChars(srcBegin, srcEnd, dst, dstBegin) -public inline fun String.indexOf(ch : Char) : Int = (this as java.lang.String).indexOf(ch.toString())!! +public inline fun String.indexOf(ch : Char) : Int = (this as java.lang.String).indexOf(ch.toString()) -public inline fun String.indexOf(ch : Char, fromIndex : Int) : Int = (this as java.lang.String).indexOf(ch.toString(), fromIndex)!! +public inline fun String.indexOf(ch : Char, fromIndex : Int) : Int = (this as java.lang.String).indexOf(ch.toString(), fromIndex) -public inline fun String.intern() : String = (this as java.lang.String).intern()!! +public inline fun String.intern() : String = (this as java.lang.String).intern() -public inline fun String.isEmpty() : Boolean = (this as java.lang.String).isEmpty()!! +public inline fun String.isEmpty() : Boolean = (this as java.lang.String).isEmpty() -public inline fun String.lastIndexOf(ch : Char, fromIndex : Int) : Int = (this as java.lang.String).lastIndexOf(ch.toString(), fromIndex)!! +public inline fun String.lastIndexOf(ch : Char, fromIndex : Int) : Int = (this as java.lang.String).lastIndexOf(ch.toString(), fromIndex) -public inline fun String.lastIndexOf(str : String, fromIndex : Int) : Int = (this as java.lang.String).lastIndexOf(str, fromIndex)!! +public inline fun String.lastIndexOf(str : String, fromIndex : Int) : Int = (this as java.lang.String).lastIndexOf(str, fromIndex) -public inline fun String.matches(regex : String) : Boolean = (this as java.lang.String).matches(regex)!! +public inline fun String.matches(regex : String) : Boolean = (this as java.lang.String).matches(regex) -public inline fun String.offsetByCodePoints(index : Int, codePointOffset : Int) : Int = (this as java.lang.String).offsetByCodePoints(index, codePointOffset)!! +public inline fun String.offsetByCodePoints(index : Int, codePointOffset : Int) : Int = (this as java.lang.String).offsetByCodePoints(index, codePointOffset) -public inline fun String.regionMatches(ignoreCase : Boolean, toffset : Int, other : String, ooffset : Int, len : Int) : Boolean = (this as java.lang.String).regionMatches(ignoreCase, toffset, other, ooffset, len)!! +public inline fun String.regionMatches(ignoreCase : Boolean, toffset : Int, other : String, ooffset : Int, len : Int) : Boolean = (this as java.lang.String).regionMatches(ignoreCase, toffset, other, ooffset, len) -public inline fun String.regionMatches(toffset : Int, other : String, ooffset : Int, len : Int) : Boolean = (this as java.lang.String).regionMatches(toffset, other, ooffset, len)!! +public inline fun String.regionMatches(toffset : Int, other : String, ooffset : Int, len : Int) : Boolean = (this as java.lang.String).regionMatches(toffset, other, ooffset, len) -public inline fun String.replace(target : CharSequence, replacement : CharSequence) : String = (this as java.lang.String).replace(target, replacement)!! +public inline fun String.replace(target : CharSequence, replacement : CharSequence) : String = (this as java.lang.String).replace(target, replacement) -public inline fun String.subSequence(beginIndex : Int, endIndex : Int) : CharSequence = (this as java.lang.String).subSequence(beginIndex, endIndex)!! +public inline fun String.subSequence(beginIndex : Int, endIndex : Int) : CharSequence = (this as java.lang.String).subSequence(beginIndex, endIndex) -public inline fun String.toLowerCase(locale : java.util.Locale) : String = (this as java.lang.String).toLowerCase(locale)!! +public inline fun String.toLowerCase(locale : java.util.Locale) : String = (this as java.lang.String).toLowerCase(locale) -public inline fun String.toUpperCase(locale : java.util.Locale) : String = (this as java.lang.String).toUpperCase(locale)!! +public inline fun String.toUpperCase(locale : java.util.Locale) : String = (this as java.lang.String).toUpperCase(locale) public inline fun CharSequence.charAt(index : Int) : Char = (this as java.lang.CharSequence).charAt(index) @@ -144,19 +144,19 @@ public inline fun CharSequence.length() : Int = (this as java.lang.CharSequence) public inline fun String.toByteArray(encoding: String?=null):ByteArray { if(encoding==null) { - return (this as java.lang.String).getBytes()!! + return (this as java.lang.String).getBytes() } else { - return (this as java.lang.String).getBytes(encoding)!! + return (this as java.lang.String).getBytes(encoding) } } -public inline fun String.toByteArray(encoding: java.nio.charset.Charset):ByteArray = (this as java.lang.String).getBytes(encoding)!! +public inline fun String.toByteArray(encoding: java.nio.charset.Charset):ByteArray = (this as java.lang.String).getBytes(encoding) -public inline fun String.toBoolean() : Boolean = java.lang.Boolean.parseBoolean(this)!! -public inline fun String.toShort() : Short = java.lang.Short.parseShort(this)!! -public inline fun String.toInt() : Int = java.lang.Integer.parseInt(this)!! -public inline fun String.toLong() : Long = java.lang.Long.parseLong(this)!! -public inline fun String.toFloat() : Float = java.lang.Float.parseFloat(this)!! -public inline fun String.toDouble() : Double = java.lang.Double.parseDouble(this)!! +public inline fun String.toBoolean() : Boolean = java.lang.Boolean.parseBoolean(this) +public inline fun String.toShort() : Short = java.lang.Short.parseShort(this) +public inline fun String.toInt() : Int = java.lang.Integer.parseInt(this) +public inline fun String.toLong() : Long = java.lang.Long.parseLong(this) +public inline fun String.toFloat() : Float = java.lang.Float.parseFloat(this) +public inline fun String.toDouble() : Double = java.lang.Double.parseDouble(this) /** * Converts the string into a regular expression [[Pattern]] optionally @@ -164,7 +164,7 @@ public inline fun String.toDouble() : Double = java.lang.Double.parseDouble(this * so that strings can be split or matched on. */ public inline fun String.toRegex(flags: Int=0): java.util.regex.Pattern { - return java.util.regex.Pattern.compile(this, flags)!! + return java.util.regex.Pattern.compile(this, flags) } inline val String.reader : StringReader diff --git a/libraries/stdlib/src/kotlin/dom/Dom.kt b/libraries/stdlib/src/kotlin/dom/Dom.kt index 062ec165069..9a97f87cd8e 100644 --- a/libraries/stdlib/src/kotlin/dom/Dom.kt +++ b/libraries/stdlib/src/kotlin/dom/Dom.kt @@ -11,8 +11,8 @@ import java.lang.IndexOutOfBoundsException // Properties -private fun emptyElementList(): List = Collections.emptyList()!! -private fun emptyNodeList(): List = Collections.emptyList()!! +private fun emptyElementList(): List = Collections.emptyList() +private fun emptyNodeList(): List = Collections.emptyList() var Node.text : String get() { @@ -26,23 +26,21 @@ var Element.childrenText: String get() { val buffer = StringBuilder() val nodeList = this.childNodes - if (nodeList != null) { - var i = 0 - val size = nodeList.length - while (i < size) { - val node = nodeList.item(i) - if (node != null) { - if (node.isText()) { - buffer.append(node.nodeValue) - } + var i = 0 + val size = nodeList.length + while (i < size) { + val node = nodeList.item(i) + if (node != null) { + if (node.isText()) { + buffer.append(node.nodeValue) } - i++ } + i++ } - return buffer.toString()!! + return buffer.toString() } set(value) { - val element = this as Element + val element = this // lets remove all the previous text nodes first for (node in element.children()) { if (node.isText()) { @@ -74,9 +72,7 @@ set(value) { /** Returns true if the element has the given CSS class style in its 'class' attribute */ fun Element.hasClass(cssClass: String): Boolean { val c = this.classes - return if (c != null) - c.matches("""(^|.*\s+)$cssClass($|\s+.*)""") - else false + return c.matches("""(^|.*\s+)$cssClass($|\s+.*)""") } @@ -341,7 +337,7 @@ public fun nodesToXmlString(nodes: Iterable, xmlDeclaration: Boolean = fal for (n in nodes) { builder.append(n.toXmlString(xmlDeclaration)) } - return builder.toString()!! + return builder.toString() } // Syntax sugar diff --git a/libraries/stdlib/src/kotlin/dom/DomJVM.kt b/libraries/stdlib/src/kotlin/dom/DomJVM.kt index f26a42c4530..e7cf03ecdd7 100644 --- a/libraries/stdlib/src/kotlin/dom/DomJVM.kt +++ b/libraries/stdlib/src/kotlin/dom/DomJVM.kt @@ -54,7 +54,7 @@ val Node.ownerDocument: Document? get() = getOwnerDocument() val Document.documentElement: Element? -get() = if (this != null) this.getDocumentElement() else null +get() = this.getDocumentElement() val Node.namespaceURI: String get() = getNamespaceURI() ?: "" @@ -123,7 +123,7 @@ get() { val answer = LinkedHashSet() val array = this.classes.split("""\s""") for (s in array) { - if (s != null && s.size > 0) { + if (s.size > 0) { answer.add(s) } } @@ -225,7 +225,7 @@ public fun Node.toXmlString(): String = toXmlString(false) public fun Node.toXmlString(xmlDeclaration: Boolean): String { val writer = StringWriter() writeXmlString(writer, xmlDeclaration) - return writer.toString()!! + return writer.toString() } /** Converts the node to an XML String and writes it to the given [[Writer]] */ diff --git a/libraries/stdlib/src/kotlin/io/Files.kt b/libraries/stdlib/src/kotlin/io/Files.kt index b2d76273072..4efe9616ee7 100644 --- a/libraries/stdlib/src/kotlin/io/Files.kt +++ b/libraries/stdlib/src/kotlin/io/Files.kt @@ -14,9 +14,7 @@ public fun File.recurse(block: (File) -> Unit): Unit { block(this) if (this.isDirectory()) { for (child in this.listFiles()!!) { - if (child != null) { - child.recurse(block) - } + child.recurse(block) } } } @@ -31,19 +29,19 @@ get() = if (this.isDirectory()) this else this.getParentFile()!! * Returns the canoncial path of the file */ inline val File.canonicalPath: String -get() = getCanonicalPath() ?: "" +get() = getCanonicalPath() /** * Returns the file name or "" for an empty name */ inline val File.name: String -get() = getName() ?: "" +get() = getName() /** * Returns the file path or "" for an empty name */ inline val File.path: String -get() = getPath() ?: "" +get() = getPath() /** * Returns true if the file ends with the given extension @@ -212,4 +210,4 @@ fun File.listFiles(filter : (file : File) -> Boolean) : Array? = listFiles object : FileFilter { override fun accept(file: File) = filter(file) } -) as Array? +) diff --git a/libraries/stdlib/src/kotlin/io/JIO.kt b/libraries/stdlib/src/kotlin/io/JIO.kt index b800af03689..b3bf5b261eb 100644 --- a/libraries/stdlib/src/kotlin/io/JIO.kt +++ b/libraries/stdlib/src/kotlin/io/JIO.kt @@ -18,125 +18,125 @@ public val defaultCharset: Charset = Charset.forName("UTF-8")!! /** Prints the given message to [[System.out]] */ public inline fun print(message : Any?) { - System.out?.print(message) + System.out.print(message) } /** Prints the given message to [[System.out]] */ public inline fun print(message : Int) { - System.out?.print(message) + System.out.print(message) } /** Prints the given message to [[System.out]] */ public inline fun print(message : Long) { - System.out?.print(message) + System.out.print(message) } /** Prints the given message to [[System.out]] */ public inline fun print(message : Byte) { - System.out?.print(message) + System.out.print(message) } /** Prints the given message to [[System.out]] */ public inline fun print(message : Short) { - System.out?.print(message) + System.out.print(message) } /** Prints the given message to [[System.out]] */ public inline fun print(message : Char) { - System.out?.print(message) + System.out.print(message) } /** Prints the given message to [[System.out]] */ public inline fun print(message : Boolean) { - System.out?.print(message) + System.out.print(message) } /** Prints the given message to [[System.out]] */ public inline fun print(message : Float) { - System.out?.print(message) + System.out.print(message) } /** Prints the given message to [[System.out]] */ public inline fun print(message : Double) { - System.out?.print(message) + System.out.print(message) } /** Prints the given message to [[System.out]] */ public inline fun print(message : CharArray) { - System.out?.print(message) + System.out.print(message) } /** Prints the given message and newline to [[System.out]] */ public inline fun println(message : Any?) { - System.out?.println(message) + System.out.println(message) } /** Prints the given message and newline to [[System.out]] */ public inline fun println(message : Int) { - System.out?.println(message) + System.out.println(message) } /** Prints the given message and newline to [[System.out]] */ public inline fun println(message : Long) { - System.out?.println(message) + System.out.println(message) } /** Prints the given message and newline to [[System.out]] */ public inline fun println(message : Byte) { - System.out?.println(message) + System.out.println(message) } /** Prints the given message and newline to [[System.out]] */ public inline fun println(message : Short) { - System.out?.println(message) + System.out.println(message) } /** Prints the given message and newline to [[System.out]] */ public inline fun println(message : Char) { - System.out?.println(message) + System.out.println(message) } /** Prints the given message and newline to [[System.out]] */ public inline fun println(message : Boolean) { - System.out?.println(message) + System.out.println(message) } /** Prints the given message and newline to [[System.out]] */ public inline fun println(message : Float) { - System.out?.println(message) + System.out.println(message) } /** Prints the given message and newline to [[System.out]] */ public inline fun println(message : Double) { - System.out?.println(message) + System.out.println(message) } /** Prints the given message and newline to [[System.out]] */ public inline fun println(message : CharArray) { - System.out?.println(message) + System.out.println(message) } /** Prints a newline t[[System.out]] */ public inline fun println() { - System.out?.println() + System.out.println() } private val stdin : BufferedReader = BufferedReader(InputStreamReader(object : InputStream() { public override fun read() : Int { - return System.`in`?.read() ?: -1 + return System.`in`.read() } public override fun reset() { - System.`in`?.reset() + System.`in`.reset() } public override fun read(b: ByteArray): Int { - return System.`in`?.read(b) ?: -1 + return System.`in`.read(b) } public override fun close() { - System.`in`?.close() + System.`in`.close() } public override fun mark(readlimit: Int) { - System.`in`?.mark(readlimit) + System.`in`.mark(readlimit) } public override fun skip(n: Long): Long { - return System.`in`?.skip(n) ?: -1.toLong() + return System.`in`.skip(n) } public override fun available(): Int { - return System.`in`?.available() ?: 0 + return System.`in`.available() } public override fun markSupported(): Boolean { - return System.`in`?.markSupported() ?: false + return System.`in`.markSupported() } public override fun read(b: ByteArray, off: Int, len: Int): Int { - return System.`in`?.read(b, off, len) ?: -1 + return System.`in`.read(b, off, len) } })) @@ -266,7 +266,7 @@ class LineIterator(val reader: BufferedReader) : Iterator { public fun InputStream.readBytes(estimatedSize: Int = defaultBufferSize): ByteArray { val buffer = ByteArrayOutputStream(estimatedSize) this.copyTo(buffer) - return buffer.toByteArray()!! + return buffer.toByteArray() } /** @@ -277,7 +277,7 @@ public fun InputStream.readBytes(estimatedSize: Int = defaultBufferSize): ByteAr public fun Reader.readText(): String { val buffer = StringWriter() copyTo(buffer) - return buffer.toString()!! + return buffer.toString() } /** diff --git a/libraries/stdlib/src/kotlin/math/JMath.kt b/libraries/stdlib/src/kotlin/math/JMath.kt index 5a4aa45801b..708b0d7041b 100644 --- a/libraries/stdlib/src/kotlin/math/JMath.kt +++ b/libraries/stdlib/src/kotlin/math/JMath.kt @@ -3,25 +3,25 @@ package kotlin.math import java.math.BigInteger import java.math.BigDecimal -public fun BigInteger.plus(other: BigInteger) : BigInteger = this.add(other)!! +public fun BigInteger.plus(other: BigInteger) : BigInteger = this.add(other) -public fun BigInteger.minus(other: BigInteger) : BigInteger = this.subtract(other)!! +public fun BigInteger.minus(other: BigInteger) : BigInteger = this.subtract(other) -public fun BigInteger.times(other: BigInteger) : BigInteger = this.multiply(other)!! +public fun BigInteger.times(other: BigInteger) : BigInteger = this.multiply(other) -public fun BigInteger.div(other: BigInteger) : BigInteger = this.divide(other)!! +public fun BigInteger.div(other: BigInteger) : BigInteger = this.divide(other) -public fun BigInteger.minus() : BigInteger = this.negate()!! +public fun BigInteger.minus() : BigInteger = this.negate() -public fun BigDecimal.plus(other: BigDecimal) : BigDecimal = this.add(other)!! +public fun BigDecimal.plus(other: BigDecimal) : BigDecimal = this.add(other) -public fun BigDecimal.minus(other: BigDecimal) : BigDecimal = this.subtract(other)!! +public fun BigDecimal.minus(other: BigDecimal) : BigDecimal = this.subtract(other) -public fun BigDecimal.times(other: BigDecimal) : BigDecimal = this.multiply(other)!! +public fun BigDecimal.times(other: BigDecimal) : BigDecimal = this.multiply(other) -public fun BigDecimal.div(other: BigDecimal) : BigDecimal = this.divide(other)!! +public fun BigDecimal.div(other: BigDecimal) : BigDecimal = this.divide(other) -public fun BigDecimal.mod(other: BigDecimal) : BigDecimal = this.remainder(other)!! +public fun BigDecimal.mod(other: BigDecimal) : BigDecimal = this.remainder(other) -public fun BigDecimal.minus() : BigDecimal = this.negate()!! \ No newline at end of file +public fun BigDecimal.minus() : BigDecimal = this.negate() \ No newline at end of file diff --git a/libraries/stdlib/src/kotlin/modules/ModuleBuilder.kt b/libraries/stdlib/src/kotlin/modules/ModuleBuilder.kt index 95db7d82f78..7a9a85319ab 100644 --- a/libraries/stdlib/src/kotlin/modules/ModuleBuilder.kt +++ b/libraries/stdlib/src/kotlin/modules/ModuleBuilder.kt @@ -6,7 +6,7 @@ import jet.modules.* public fun module(name: String, callback: ModuleBuilder.() -> Unit) { val builder = ModuleBuilder(name) builder.callback() - AllModules.modules!!.get()?.add(builder) + AllModules.modules.get()?.add(builder) } class SourcesBuilder(val parent: ModuleBuilder) { diff --git a/libraries/stdlib/src/kotlin/nullable/Nullables.kt b/libraries/stdlib/src/kotlin/nullable/Nullables.kt index c5641b10ce0..aad110f069d 100644 --- a/libraries/stdlib/src/kotlin/nullable/Nullables.kt +++ b/libraries/stdlib/src/kotlin/nullable/Nullables.kt @@ -69,10 +69,8 @@ public inline fun T?.flatMap(transform: (T)-> MutableCollection): public inline fun T?.flatMapTo(result: MutableCollection, transform: (T)-> MutableCollection): Collection { if (this != null) { val coll = transform(this) - if (coll != null) { - for (r in coll) { - result.add(r) - } + for (r in coll) { + result.add(r) } } return result @@ -124,7 +122,6 @@ public inline fun T?.groupBy(result: MutableMap> = /** Creates a String from the nullable or item with the given prefix and postfix if supplied */ public inline fun T?.makeString(separator: String = ", ", prefix: String = "", postfix: String = ""): String { val buffer = StringBuilder(prefix) - var first = true if (this != null) { buffer.append(this) } diff --git a/libraries/stdlib/src/kotlin/template/Templates.kt b/libraries/stdlib/src/kotlin/template/Templates.kt index 6126ecc604f..b887329791e 100644 --- a/libraries/stdlib/src/kotlin/template/Templates.kt +++ b/libraries/stdlib/src/kotlin/template/Templates.kt @@ -18,7 +18,7 @@ class StringTemplate(val values : Array) { public fun toString() : String { val out = StringBuilder() forEach{ out.append(it) } - return out.toString() ?: "" + return out.toString() } /** @@ -41,7 +41,7 @@ class StringTemplate(val values : Array) { public fun StringTemplate.toString(formatter : Formatter) : String { val buffer = StringBuilder() append(buffer, formatter) - return buffer.toString() ?: "" + return buffer.toString() } /** @@ -56,9 +56,7 @@ public fun StringTemplate.append(out : Appendable, formatter : Formatter) : Unit throw IllegalStateException("No constant checks should be null"); } else { val text = it.toString() - if (text != null) { - out.append(text) - } + out.append(text) } } else { formatter.format(out, it) diff --git a/libraries/stdlib/src/kotlin/test/TestJVM.kt b/libraries/stdlib/src/kotlin/test/TestJVM.kt index 0d8dbcf5b50..1bfa217648f 100644 --- a/libraries/stdlib/src/kotlin/test/TestJVM.kt +++ b/libraries/stdlib/src/kotlin/test/TestJVM.kt @@ -65,7 +65,6 @@ class DefaultAsserter() : Asserter { } } public override fun fail(message : String) { - // TODO work around compiler bug as it should never try call the private constructor - throw AssertionError(message as Any) + throw AssertionError(message) } } \ No newline at end of file diff --git a/libraries/stdlib/test/CollectionTest.kt b/libraries/stdlib/test/CollectionTest.kt index bee7d40570a..a5c98d1255d 100644 --- a/libraries/stdlib/test/CollectionTest.kt +++ b/libraries/stdlib/test/CollectionTest.kt @@ -211,7 +211,7 @@ class CollectionTest { assertEquals(4, byLength.size()) val l3 = byLength.getOrElse(3, {ArrayList()}) - assertEquals(2, l3?.size) + assertEquals(2, l3.size) } test fun makeString() { diff --git a/libraries/stdlib/test/OldStdlibTest.kt b/libraries/stdlib/test/OldStdlibTest.kt index 3d1bcdfb465..b2d56240413 100644 --- a/libraries/stdlib/test/OldStdlibTest.kt +++ b/libraries/stdlib/test/OldStdlibTest.kt @@ -11,13 +11,13 @@ import junit.framework.TestCase class OldStdlibTest() : TestCase() { fun testCollectionEmpty() { assertNot { - Arrays.asList(0, 1, 2)?.empty ?: false + Arrays.asList(0, 1, 2).empty } } fun testCollectionSize() { assertTrue { - Arrays.asList(0, 1, 2)?.size == 3 + Arrays.asList(0, 1, 2).size == 3 } } @@ -29,7 +29,7 @@ class OldStdlibTest() : TestCase() { } for(b in x.inputStream) { - System.out?.println(b) + System.out.println(b) } } } diff --git a/libraries/stdlib/test/TuplesTest.kt b/libraries/stdlib/test/TuplesTest.kt index 8b165a624f8..f0a068e29dd 100644 --- a/libraries/stdlib/test/TuplesTest.kt +++ b/libraries/stdlib/test/TuplesTest.kt @@ -26,8 +26,8 @@ class PairTest { assertTrue(p == Pair(1, "a")) assertTrue(p != Pair(2, "a")) assertTrue(p != Pair(1, "b")) - assertTrue(!(p as Object).equals(null)) - assertTrue((p as Any) != "") + assertTrue(!(p : Object).equals(null)) + assertTrue((p : Any) != "") } test fun pairHashCode() { @@ -70,8 +70,8 @@ class TripleTest { assertTrue(t != Triple(2, "a", 0.0)) assertTrue(t != Triple(1, "b", 0.0)) assertTrue(t != Triple(1, "a", 0.1)) - assertTrue(!(t as Object).equals(null)) - assertTrue((t as Any) != "") + assertTrue(!(t : Object).equals(null)) + assertTrue((t : Any) != "") } test fun tripleHashCode() {