Fix some warnings in JS-specific stdlib sources

This commit is contained in:
Alexander Udalov
2016-11-01 16:48:52 +03:00
parent 52511845fc
commit b52f67132e
6 changed files with 25 additions and 26 deletions
+1 -1
View File
@@ -5,7 +5,7 @@ public class IOException(message: String = "") : Exception() {}
@library @library
public interface Closeable { public interface Closeable {
public open fun close(): Unit public fun close(): Unit
} }
interface Serializable interface Serializable
+4 -5
View File
@@ -16,10 +16,9 @@
package java.lang package java.lang
@library @library
public interface Runnable { public interface Runnable {
public open fun run(): Unit public fun run(): Unit
} }
public fun Runnable(action: () -> Unit): Runnable = object : Runnable { public fun Runnable(action: () -> Unit): Runnable = object : Runnable {
@@ -28,9 +27,9 @@ public fun Runnable(action: () -> Unit): Runnable = object : Runnable {
@library @library
public interface Appendable { public interface Appendable {
public open fun append(csq: CharSequence?): Appendable public fun append(csq: CharSequence?): Appendable
public open fun append(csq: CharSequence?, start: Int, end: Int): Appendable public fun append(csq: CharSequence?, start: Int, end: Int): Appendable
public open fun append(c: Char): Appendable public fun append(c: Char): Appendable
} }
@library @library
+2 -2
View File
@@ -18,11 +18,11 @@ package java.util
@library @library
public interface Comparator<T> { public interface Comparator<T> {
public fun compare(obj1: T, obj2: T): Int public fun compare(a: T, b: T): Int
} }
public inline fun <T> Comparator(crossinline comparison: (T, T) -> Int): Comparator<T> = object : Comparator<T> { public inline fun <T> Comparator(crossinline comparison: (T, T) -> Int): Comparator<T> = object : Comparator<T> {
override fun compare(obj1: T, obj2: T): Int = comparison(obj1, obj2) override fun compare(a: T, b: T): Int = comparison(a, b)
} }
+14 -14
View File
@@ -499,7 +499,7 @@ public inline fun <T> Array<out T>.plusElement(element: T): Array<T> {
*/ */
@library("primitiveArraySort") @library("primitiveArraySort")
public fun ByteArray.sort(): Unit { public fun ByteArray.sort(): Unit {
return noImpl noImpl
} }
/** /**
@@ -507,7 +507,7 @@ public fun ByteArray.sort(): Unit {
*/ */
@library("primitiveArraySort") @library("primitiveArraySort")
public fun CharArray.sort(): Unit { public fun CharArray.sort(): Unit {
return noImpl noImpl
} }
/** /**
@@ -515,7 +515,7 @@ public fun CharArray.sort(): Unit {
*/ */
@library("primitiveArraySort") @library("primitiveArraySort")
public fun DoubleArray.sort(): Unit { public fun DoubleArray.sort(): Unit {
return noImpl noImpl
} }
/** /**
@@ -523,7 +523,7 @@ public fun DoubleArray.sort(): Unit {
*/ */
@library("primitiveArraySort") @library("primitiveArraySort")
public fun FloatArray.sort(): Unit { public fun FloatArray.sort(): Unit {
return noImpl noImpl
} }
/** /**
@@ -531,7 +531,7 @@ public fun FloatArray.sort(): Unit {
*/ */
@library("primitiveArraySort") @library("primitiveArraySort")
public fun IntArray.sort(): Unit { public fun IntArray.sort(): Unit {
return noImpl noImpl
} }
/** /**
@@ -539,7 +539,7 @@ public fun IntArray.sort(): Unit {
*/ */
@library("primitiveArraySort") @library("primitiveArraySort")
public fun ShortArray.sort(): Unit { public fun ShortArray.sort(): Unit {
return noImpl noImpl
} }
/** /**
@@ -563,7 +563,7 @@ public fun LongArray.sort(): Unit {
*/ */
@native @native
public fun <T> Array<out T>.sort(comparison: (T, T) -> Int): Unit { public fun <T> Array<out T>.sort(comparison: (T, T) -> Int): Unit {
return noImpl noImpl
} }
/** /**
@@ -571,7 +571,7 @@ public fun <T> Array<out T>.sort(comparison: (T, T) -> Int): Unit {
*/ */
@native @native
public fun ByteArray.sort(comparison: (Byte, Byte) -> Int): Unit { public fun ByteArray.sort(comparison: (Byte, Byte) -> Int): Unit {
return noImpl noImpl
} }
/** /**
@@ -579,7 +579,7 @@ public fun ByteArray.sort(comparison: (Byte, Byte) -> Int): Unit {
*/ */
@native @native
public fun CharArray.sort(comparison: (Char, Char) -> Int): Unit { public fun CharArray.sort(comparison: (Char, Char) -> Int): Unit {
return noImpl noImpl
} }
/** /**
@@ -587,7 +587,7 @@ public fun CharArray.sort(comparison: (Char, Char) -> Int): Unit {
*/ */
@native @native
public fun DoubleArray.sort(comparison: (Double, Double) -> Int): Unit { public fun DoubleArray.sort(comparison: (Double, Double) -> Int): Unit {
return noImpl noImpl
} }
/** /**
@@ -595,7 +595,7 @@ public fun DoubleArray.sort(comparison: (Double, Double) -> Int): Unit {
*/ */
@native @native
public fun FloatArray.sort(comparison: (Float, Float) -> Int): Unit { public fun FloatArray.sort(comparison: (Float, Float) -> Int): Unit {
return noImpl noImpl
} }
/** /**
@@ -603,7 +603,7 @@ public fun FloatArray.sort(comparison: (Float, Float) -> Int): Unit {
*/ */
@native @native
public fun IntArray.sort(comparison: (Int, Int) -> Int): Unit { public fun IntArray.sort(comparison: (Int, Int) -> Int): Unit {
return noImpl noImpl
} }
/** /**
@@ -611,7 +611,7 @@ public fun IntArray.sort(comparison: (Int, Int) -> Int): Unit {
*/ */
@native @native
public fun LongArray.sort(comparison: (Long, Long) -> Int): Unit { public fun LongArray.sort(comparison: (Long, Long) -> Int): Unit {
return noImpl noImpl
} }
/** /**
@@ -619,7 +619,7 @@ public fun LongArray.sort(comparison: (Long, Long) -> Int): Unit {
*/ */
@native @native
public fun ShortArray.sort(comparison: (Short, Short) -> Int): Unit { public fun ShortArray.sort(comparison: (Short, Short) -> Int): Unit {
return noImpl noImpl
} }
/** /**
@@ -303,13 +303,13 @@ private class ReversedComparator<T>(public val comparator: Comparator<T>): Compa
} }
private object NaturalOrderComparator : Comparator<Comparable<Any>> { private object NaturalOrderComparator : Comparator<Comparable<Any>> {
override fun compare(c1: Comparable<Any>, c2: Comparable<Any>): Int = c1.compareTo(c2) override fun compare(a: Comparable<Any>, b: Comparable<Any>): Int = a.compareTo(b)
@Suppress("VIRTUAL_MEMBER_HIDDEN") @Suppress("VIRTUAL_MEMBER_HIDDEN")
fun reversed(): Comparator<Comparable<Any>> = ReverseOrderComparator fun reversed(): Comparator<Comparable<Any>> = ReverseOrderComparator
} }
private object ReverseOrderComparator: Comparator<Comparable<Any>> { private object ReverseOrderComparator: Comparator<Comparable<Any>> {
override fun compare(c1: Comparable<Any>, c2: Comparable<Any>): Int = c2.compareTo(c1) override fun compare(a: Comparable<Any>, b: Comparable<Any>): Int = b.compareTo(a)
@Suppress("VIRTUAL_MEMBER_HIDDEN") @Suppress("VIRTUAL_MEMBER_HIDDEN")
fun reversed(): Comparator<Comparable<Any>> = NaturalOrderComparator fun reversed(): Comparator<Comparable<Any>> = NaturalOrderComparator
} }
@@ -171,7 +171,7 @@ fun specialJS(): List<GenericFunction> {
annotations("@native") annotations("@native")
returns("Unit") returns("Unit")
doc { "Sorts the array in-place according to the order specified by the given [comparison] function." } doc { "Sorts the array in-place according to the order specified by the given [comparison] function." }
body { "return noImpl" } body { "noImpl" }
} }
templates add f("sortWith(comparator: Comparator<in T>)") { templates add f("sortWith(comparator: Comparator<in T>)") {
@@ -194,7 +194,7 @@ fun specialJS(): List<GenericFunction> {
returns("Unit") returns("Unit")
doc { "Sorts the array in-place." } doc { "Sorts the array in-place." }
annotations("""@library("primitiveArraySort")""") annotations("""@library("primitiveArraySort")""")
body { "return noImpl" } body { "noImpl" }
} }
templates add f("sort()") { templates add f("sort()") {