From 167a9c444a392329484b4fa1a83e22d5505e4340 Mon Sep 17 00:00:00 2001 From: Svetlana Isakova Date: Thu, 29 Mar 2012 20:45:59 +0400 Subject: [PATCH] Added 'public' annotation and specified return types for library functions --- compiler/frontend/src/jet/Arrays.jet | 92 +- compiler/frontend/src/jet/Iterables.jet | 36 +- compiler/frontend/src/jet/Iterators.jet | 72 +- compiler/frontend/src/jet/Library.jet | 70 +- compiler/frontend/src/jet/Numbers.jet | 1120 ++++++++--------- compiler/frontend/src/jet/Ranges.jet | 108 +- .../ast/enum/class/runnableImplementation.kt | 2 +- .../file/extendsBaseWhichExtendsObject.kt | 6 +- j2k/tests/testData/ast/issues/file/kt-696.kt | 6 +- j2k/tests/testData/ast/issues/file/kt-836.kt | 2 +- .../ast/kotlinExclusion/file/kt-656.kt | 4 +- .../expression/newClassWithAnonymousScope.kt | 2 +- .../ast/objectLiteral/file/MyFrame.kt | 4 +- .../src/java/util/AbstractCollection.kt | 30 +- jdk-headers/src/java/util/AbstractList.kt | 32 +- jdk-headers/src/java/util/AbstractMap.kt | 32 +- .../src/java/util/AbstractSequentialList.kt | 16 +- jdk-headers/src/java/util/AbstractSet.kt | 8 +- jdk-headers/src/java/util/ArrayList.kt | 34 +- jdk-headers/src/java/util/Deque.kt | 2 +- jdk-headers/src/java/util/HashMap.kt | 26 +- jdk-headers/src/java/util/HashSet.kt | 16 +- jdk-headers/src/java/util/LinkedHashMap.kt | 6 +- jdk-headers/src/java/util/LinkedList.kt | 78 +- js/js.libraries/src/core/javautil.kt | 94 +- .../generated/ArraysFromJavaCollections.kt | 4 +- .../JavaUtilIterablesFromJavaCollections.kt | 4 +- .../generated/StandardFromJavaCollections.kt | 4 +- libraries/stdlib/src/kotlin/Arrays.kt | 148 +-- libraries/stdlib/src/kotlin/Integers.kt | 2 +- libraries/stdlib/src/kotlin/JLang.kt | 2 +- libraries/stdlib/src/kotlin/JUMaps.kt | 42 +- libraries/stdlib/src/kotlin/JUtil.kt | 34 +- .../stdlib/src/kotlin/JavaCollections.kt | 4 +- .../stdlib/src/kotlin/JavaIterablesSpecial.kt | 18 +- libraries/stdlib/src/kotlin/Ordering.kt | 12 +- libraries/stdlib/src/kotlin/Preconditions.kt | 18 +- libraries/stdlib/src/kotlin/Standard.kt | 24 +- libraries/stdlib/src/kotlin/Strings.kt | 168 +-- .../src/kotlin/concurrent/FunctionalList.kt | 12 +- .../src/kotlin/concurrent/FunctionalQueue.kt | 6 +- .../stdlib/src/kotlin/concurrent/Locks.kt | 6 +- .../stdlib/src/kotlin/concurrent/Thread.kt | 8 +- .../stdlib/src/kotlin/concurrent/Timer.kt | 22 +- libraries/stdlib/src/kotlin/dom/Dom.kt | 72 +- libraries/stdlib/src/kotlin/dom/DomJVM.kt | 12 +- libraries/stdlib/src/kotlin/io/JIO.kt | 144 +-- libraries/stdlib/src/kotlin/math/JMath.kt | 22 +- .../src/kotlin/modules/ModuleBuilder.kt | 16 +- .../stdlib/src/kotlin/nullable/Nullables.kt | 52 +- .../src/kotlin/properties/Properties.kt | 16 +- .../stdlib/src/kotlin/template/Templates.kt | 44 +- libraries/stdlib/src/kotlin/test/Test.kt | 50 +- libraries/stdlib/src/kotlin/util/System.kt | 4 +- libraries/stdlib/test/Test.kt | 2 +- 55 files changed, 1435 insertions(+), 1435 deletions(-) diff --git a/compiler/frontend/src/jet/Arrays.jet b/compiler/frontend/src/jet/Arrays.jet index be3608b03ef..35aadde0c18 100644 --- a/compiler/frontend/src/jet/Arrays.jet +++ b/compiler/frontend/src/jet/Arrays.jet @@ -1,84 +1,84 @@ package jet -fun Array(val size : Int) : Array +public fun Array(public val size : Int) : Array -class Array(val size : Int, init : (Int) -> T) { - fun get(index : Int) : T - fun set(index : Int, value : T) : Unit +public class Array(public val size : Int, init : (Int) -> T) { + public fun get(index : Int) : T + public fun set(index : Int, value : T) : Unit - fun iterator() : Iterator + public fun iterator() : Iterator - val indices : IntRange + public val indices : IntRange } -class ByteArray(val size : Int) { - fun get(index : Int) : Byte - fun set(index : Int, value : Byte) : Unit +public class ByteArray(public val size : Int) { + public fun get(index : Int) : Byte + public fun set(index : Int, value : Byte) : Unit - fun iterator() : ByteIterator + public fun iterator() : ByteIterator - val indices : IntRange + public val indices : IntRange } -class ShortArray(val size : Int) { - fun get(index : Int) : Short - fun set(index : Int, value : Short) : Unit +public class ShortArray(public val size : Int) { + public fun get(index : Int) : Short + public fun set(index : Int, value : Short) : Unit - fun iterator() : ShortIterator + public fun iterator() : ShortIterator - val indices : IntRange + public val indices : IntRange } -class IntArray(val size : Int) { - fun get(index : Int) : Int - fun set(index : Int, value : Int) : Unit +public class IntArray(public val size : Int) { + public fun get(index : Int) : Int + public fun set(index : Int, value : Int) : Unit - fun iterator() : IntIterator + public fun iterator() : IntIterator - val indices : IntRange + public val indices : IntRange } -class LongArray(val size : Int) { - fun get(index : Int) : Long - fun set(index : Int, value : Long) : Unit +public class LongArray(public val size : Int) { + public fun get(index : Int) : Long + public fun set(index : Int, value : Long) : Unit - fun iterator() : LongIterator + public fun iterator() : LongIterator - val indices : IntRange + public val indices : IntRange } -class FloatArray(val size : Int) { - fun get(index : Int) : Float - fun set(index : Int, value : Float) : Unit +public class FloatArray(public val size : Int) { + public fun get(index : Int) : Float + public fun set(index : Int, value : Float) : Unit - fun iterator() : FloatIterator + public fun iterator() : FloatIterator - val indices : IntRange + public val indices : IntRange } -class DoubleArray(val size : Int) { - fun get(index : Int) : Double - fun set(index : Int, value : Double) : Unit +public class DoubleArray(public val size : Int) { + public fun get(index : Int) : Double + public fun set(index : Int, value : Double) : Unit - fun iterator() : DoubleIterator + public fun iterator() : DoubleIterator - val indices : IntRange + public val indices : IntRange } -class CharArray(val size : Int) { - fun get(index : Int) : Char - fun set(index : Int, value : Char) : Unit +public class CharArray(public val size : Int) { + public fun get(index : Int) : Char + public fun set(index : Int, value : Char) : Unit - fun iterator() : CharIterator + public fun iterator() : CharIterator - val indices : IntRange + public val indices : IntRange } -class BooleanArray(val size : Int) { - fun get(index : Int) : Boolean - fun set(index : Int, value : Boolean) : Unit +public class BooleanArray(public val size : Int) { + public fun get(index : Int) : Boolean + public fun set(index : Int, value : Boolean) : Unit - fun iterator() : BooleanIterator + public fun iterator() : BooleanIterator - val indices : IntRange + public val indices : IntRange } diff --git a/compiler/frontend/src/jet/Iterables.jet b/compiler/frontend/src/jet/Iterables.jet index 900ed28a17b..901636139f4 100644 --- a/compiler/frontend/src/jet/Iterables.jet +++ b/compiler/frontend/src/jet/Iterables.jet @@ -1,37 +1,37 @@ package jet -trait Iterable { - fun iterator() : Iterator +public trait Iterable { + public fun iterator() : Iterator } -trait ByteIterable : Iterable { - override fun iterator() : ByteIterator +public trait ByteIterable : Iterable { + public override fun iterator() : ByteIterator } -trait ShortIterable : Iterable { - override fun iterator() : ShortIterator +public trait ShortIterable : Iterable { + public override fun iterator() : ShortIterator } -trait IntIterable : Iterable { - override fun iterator() : IntIterator +public trait IntIterable : Iterable { + public override fun iterator() : IntIterator } -trait LongIterable : Iterable { - override fun iterator() : LongIterator +public trait LongIterable : Iterable { + public override fun iterator() : LongIterator } -trait FloatIterable : Iterable { - override fun iterator() : FloatIterator +public trait FloatIterable : Iterable { + public override fun iterator() : FloatIterator } -trait DoubleIterable : Iterable { - override fun iterator() : DoubleIterator +public trait DoubleIterable : Iterable { + public override fun iterator() : DoubleIterator } -trait BooleanIterable : Iterable { - override fun iterator() : BooleanIterator +public trait BooleanIterable : Iterable { + public override fun iterator() : BooleanIterator } -trait CharIterable : Iterable { - override fun iterator() : CharIterator +public trait CharIterable : Iterable { + public override fun iterator() : CharIterator } diff --git a/compiler/frontend/src/jet/Iterators.jet b/compiler/frontend/src/jet/Iterators.jet index e82a6ff6ca8..04827207c30 100644 --- a/compiler/frontend/src/jet/Iterators.jet +++ b/compiler/frontend/src/jet/Iterators.jet @@ -1,73 +1,73 @@ package jet -trait Iterator { - fun next() : T - val hasNext : Boolean +public trait Iterator { + public fun next() : T + public val hasNext : Boolean } -abstract open class ByteIterator() : Iterator { - abstract open fun nextByte() : Byte +public abstract class ByteIterator() : Iterator { + public abstract open fun nextByte() : Byte - override fun next() : Byte + public override fun next() : Byte } -abstract open class ShortIterator() : Iterator { - abstract open fun nextShort() : Short +public abstract class ShortIterator() : Iterator { + public abstract open fun nextShort() : Short - override fun next() : Short + public override fun next() : Short } -abstract open class CharIterator() : Iterator { - abstract open fun nextChar() : Char +public abstract class CharIterator() : Iterator { + public abstract open fun nextChar() : Char - override fun next() : Char + public override fun next() : Char } -abstract open class IntIterator() : Iterator { - abstract open fun nextInt() : Int +public abstract class IntIterator() : Iterator { + public abstract open fun nextInt() : Int - override fun next() : Int + public override fun next() : Int } -abstract open class LongIterator() : Iterator { - abstract open fun nextLong() : Long +public abstract class LongIterator() : Iterator { + public abstract open fun nextLong() : Long - override fun next() : Long + public override fun next() : Long } -abstract open class FloatIterator() : Iterator { - abstract open fun nextFloat() : Float +public abstract class FloatIterator() : Iterator { + public abstract open fun nextFloat() : Float - override fun next() : Float + public override fun next() : Float } -abstract open class DoubleIterator() : Iterator { - abstract open fun nextDouble() : Double +public abstract class DoubleIterator() : Iterator { + public abstract open fun nextDouble() : Double - override fun next() : Double + public override fun next() : Double } -abstract open class BooleanIterator() : Iterator { - abstract open fun nextBoolean() : Boolean +abstract open public class BooleanIterator() : Iterator { + public abstract open fun nextBoolean() : Boolean - override fun next() : Boolean + public override fun next() : Boolean } -fun Iterator.iterator() : Iterator +public fun Iterator.iterator() : Iterator -fun ByteIterator.iterator() : ByteIterator +public fun ByteIterator.iterator() : ByteIterator -fun ShortIterator.iterator() : ShortIterator +public fun ShortIterator.iterator() : ShortIterator -fun CharIterator.iterator() : CharIterator +public fun CharIterator.iterator() : CharIterator -fun IntIterator.iterator() : IntIterator +public fun IntIterator.iterator() : IntIterator -fun BooleanIterator.iterator() : BooleanIterator +public fun BooleanIterator.iterator() : BooleanIterator -fun DoubleIterator.iterator() : DoubleIterator +public fun DoubleIterator.iterator() : DoubleIterator -fun FloatIterator.iterator() : FloatIterator +public fun FloatIterator.iterator() : FloatIterator -fun LongIterator.iterator() : LongIterator +public fun LongIterator.iterator() : LongIterator diff --git a/compiler/frontend/src/jet/Library.jet b/compiler/frontend/src/jet/Library.jet index b83a98caf2f..1837e6f8e26 100644 --- a/compiler/frontend/src/jet/Library.jet +++ b/compiler/frontend/src/jet/Library.jet @@ -1,66 +1,66 @@ package jet -annotation class volatile -annotation class atomic +public annotation class volatile +public annotation class atomic -fun synchronized(lock: Any, block : () -> R) : R +public fun synchronized(lock: Any, block : () -> R) : R -fun Any?.identityEquals(other : Any?) : Boolean // = this === other +public fun Any?.identityEquals(other : Any?) : Boolean // = this === other // Can't write a body due to a bootstrapping problem (see JET-74) -fun Any?.equals(other : Any?) : Boolean// = this === other +public fun Any?.equals(other : Any?) : Boolean// = this === other // Returns "null" for null -fun Any?.toString() : String// = this === other +public fun Any?.toString() : String// = this === other -fun T?.sure() : T +public fun T?.sure() : T -fun String?.plus(other: Any?) : String +public fun String?.plus(other: Any?) : String -trait Comparable { - fun compareTo(other : T) : Int +public trait Comparable { + public fun compareTo(other : T) : Int } -trait Hashable { - fun hashCode() : Int - fun equals(other : Any?) : Boolean +public trait Hashable { + public fun hashCode() : Int + public fun equals(other : Any?) : Boolean } -class Boolean : Comparable { - fun not() : Boolean +public class Boolean : Comparable { + public fun not() : Boolean - fun and(other : Boolean) : Boolean + public fun and(other : Boolean) : Boolean - fun or(other : Boolean) : Boolean + public fun or(other : Boolean) : Boolean - fun xor(other : Boolean) : Boolean + public fun xor(other : Boolean) : Boolean - fun equals(other : Any?) : Boolean + public fun equals(other : Any?) : Boolean - override fun compareTo(that : Boolean) : Int + public override fun compareTo(that : Boolean) : Int } -trait CharSequence { - fun get(index : Int) : Char +public trait CharSequence { + public fun get(index : Int) : Char - val length : Int + public val length : Int - fun toString() : String + public fun toString() : String } -class String() : Comparable, CharSequence { - fun plus(other : Any?) : String +public class String() : Comparable, CharSequence { + public fun plus(other : Any?) : String - fun equals(other : Any?) : Boolean + public fun equals(other : Any?) : Boolean - override fun compareTo(that : String) : Int - override fun get(index : Int) : Char - override fun toString() : String - override val length: Int + public override fun compareTo(that : String) : Int + public override fun get(index : Int) : Char + public override fun toString() : String + public override val length: Int } -open class Throwable(message : String? = null, cause: Throwable? = null) { - fun getMessage() : String? - fun getCause() : Throwable? - fun printStackTrace() : Unit +public open class Throwable(message : String? = null, cause: Throwable? = null) { + public fun getMessage() : String? + public fun getCause() : Throwable? + public fun printStackTrace() : Unit } diff --git a/compiler/frontend/src/jet/Numbers.jet b/compiler/frontend/src/jet/Numbers.jet index ddfb911754c..793b09f7ebd 100644 --- a/compiler/frontend/src/jet/Numbers.jet +++ b/compiler/frontend/src/jet/Numbers.jet @@ -1,13 +1,13 @@ package jet -abstract class Number : Hashable { - abstract fun toDouble() : Double - abstract fun toFloat() : Float - abstract fun toLong() : Long - abstract fun toInt() : Int - abstract fun toChar() : Char - abstract fun toShort() : Short - abstract fun toByte() : Byte +public abstract class Number : Hashable { + public abstract fun toDouble() : Double + public abstract fun toFloat() : Float + public abstract fun toLong() : Long + public abstract fun toInt() : Int + public abstract fun toChar() : Char + public abstract fun toShort() : Short + public abstract fun toByte() : Byte // fun equals(other : Double) : Boolean // fun equals(other : Float) : Boolean // fun equals(other : Long) : Boolean @@ -17,647 +17,647 @@ abstract class Number : Hashable { // fun equals(other : Char) : Boolean } -class Double : Number, Comparable { - override fun compareTo(other : Double) : Int - fun compareTo(other : Float) : Int - fun compareTo(other : Long) : Int - fun compareTo(other : Int) : Int - fun compareTo(other : Short) : Int - fun compareTo(other : Byte) : Int - fun compareTo(other : Char) : Int +public class Double : Number, Comparable { + public override fun compareTo(other : Double) : Int + public fun compareTo(other : Float) : Int + public fun compareTo(other : Long) : Int + public fun compareTo(other : Int) : Int + public fun compareTo(other : Short) : Int + public fun compareTo(other : Byte) : Int + public fun compareTo(other : Char) : Int - fun plus(other : Double) : Double - fun plus(other : Float) : Double - fun plus(other : Long) : Double - fun plus(other : Int) : Double - fun plus(other : Short) : Double - fun plus(other : Byte) : Double - fun plus(other : Char) : Double + public fun plus(other : Double) : Double + public fun plus(other : Float) : Double + public fun plus(other : Long) : Double + public fun plus(other : Int) : Double + public fun plus(other : Short) : Double + public fun plus(other : Byte) : Double + public fun plus(other : Char) : Double - fun minus(other : Double) : Double - fun minus(other : Float) : Double - fun minus(other : Long) : Double - fun minus(other : Int) : Double - fun minus(other : Short) : Double - fun minus(other : Byte) : Double - fun minus(other : Char) : Double + public fun minus(other : Double) : Double + public fun minus(other : Float) : Double + public fun minus(other : Long) : Double + public fun minus(other : Int) : Double + public fun minus(other : Short) : Double + public fun minus(other : Byte) : Double + public fun minus(other : Char) : Double - fun times(other : Double) : Double - fun times(other : Float) : Double - fun times(other : Long) : Double - fun times(other : Int) : Double - fun times(other : Short) : Double - fun times(other : Byte) : Double - fun times(other : Char) : Double + public fun times(other : Double) : Double + public fun times(other : Float) : Double + public fun times(other : Long) : Double + public fun times(other : Int) : Double + public fun times(other : Short) : Double + public fun times(other : Byte) : Double + public fun times(other : Char) : Double - fun div(other : Double) : Double - fun div(other : Float) : Double - fun div(other : Long) : Double - fun div(other : Int) : Double - fun div(other : Short) : Double - fun div(other : Byte) : Double - fun div(other : Char) : Double + public fun div(other : Double) : Double + public fun div(other : Float) : Double + public fun div(other : Long) : Double + public fun div(other : Int) : Double + public fun div(other : Short) : Double + public fun div(other : Byte) : Double + public fun div(other : Char) : Double - fun mod(other : Double) : Double - fun mod(other : Float) : Double - fun mod(other : Long) : Double - fun mod(other : Int) : Double - fun mod(other : Short) : Double - fun mod(other : Byte) : Double + public fun mod(other : Double) : Double + public fun mod(other : Float) : Double + public fun mod(other : Long) : Double + public fun mod(other : Int) : Double + public fun mod(other : Short) : Double + public fun mod(other : Byte) : Double - fun rangeTo(other : Double) : DoubleRange - fun rangeTo(other : Float) : DoubleRange - fun rangeTo(other : Long) : DoubleRange - fun rangeTo(other : Int) : DoubleRange - fun rangeTo(other : Short) : DoubleRange - fun rangeTo(other : Byte) : DoubleRange - fun rangeTo(other : Char) : DoubleRange + public fun rangeTo(other : Double) : DoubleRange + public fun rangeTo(other : Float) : DoubleRange + public fun rangeTo(other : Long) : DoubleRange + public fun rangeTo(other : Int) : DoubleRange + public fun rangeTo(other : Short) : DoubleRange + public fun rangeTo(other : Byte) : DoubleRange + public fun rangeTo(other : Char) : DoubleRange - fun upto(other : Double) : DoubleRange - fun upto(other : Float) : DoubleRange - fun upto(other : Long) : DoubleRange - fun upto(other : Int) : DoubleRange - fun upto(other : Short) : DoubleRange - fun upto(other : Byte) : DoubleRange - fun upto(other : Char) : DoubleRange + public fun upto(other : Double) : DoubleRange + public fun upto(other : Float) : DoubleRange + public fun upto(other : Long) : DoubleRange + public fun upto(other : Int) : DoubleRange + public fun upto(other : Short) : DoubleRange + public fun upto(other : Byte) : DoubleRange + public fun upto(other : Char) : DoubleRange - fun downto(other : Double) : DoubleRange - fun downto(other : Float) : DoubleRange - fun downto(other : Long) : DoubleRange - fun downto(other : Int) : DoubleRange - fun downto(other : Short) : DoubleRange - fun downto(other : Byte) : DoubleRange - fun downto(other : Char) : DoubleRange + public fun downto(other : Double) : DoubleRange + public fun downto(other : Float) : DoubleRange + public fun downto(other : Long) : DoubleRange + public fun downto(other : Int) : DoubleRange + public fun downto(other : Short) : DoubleRange + public fun downto(other : Byte) : DoubleRange + public fun downto(other : Char) : DoubleRange - fun inc() : Double - fun dec() : Double - fun plus() : Double - fun minus() : Double + public fun inc() : Double + public fun dec() : Double + public fun plus() : Double + public fun minus() : Double - override fun toDouble() : Double - override fun toFloat() : Float - override fun toLong() : Long - override fun toInt() : Int - override fun toChar() : Char - override fun toShort() : Short - override fun toByte() : Byte + public override fun toDouble() : Double + public override fun toFloat() : Float + public override fun toLong() : Long + public override fun toInt() : Int + public override fun toChar() : Char + public override fun toShort() : Short + public override fun toByte() : Byte - override fun hashCode() : Int - override fun equals(val other : Any?) : Boolean + public override fun hashCode() : Int + public override fun equals(val other : Any?) : Boolean } -class Float : Number, Comparable { - fun compareTo(other : Double) : Int - override fun compareTo(other : Float) : Int - fun compareTo(other : Long) : Int - fun compareTo(other : Int) : Int - fun compareTo(other : Short) : Int - fun compareTo(other : Byte) : Int - fun compareTo(other : Char) : Int +public class Float : Number, Comparable { + public fun compareTo(other : Double) : Int + public override fun compareTo(other : Float) : Int + public fun compareTo(other : Long) : Int + public fun compareTo(other : Int) : Int + public fun compareTo(other : Short) : Int + public fun compareTo(other : Byte) : Int + public fun compareTo(other : Char) : Int - fun plus(other : Double) : Double - fun plus(other : Float) : Float - fun plus(other : Long) : Float - fun plus(other : Int) : Float - fun plus(other : Short) : Float - fun plus(other : Byte) : Float - fun plus(other : Char) : Float + public fun plus(other : Double) : Double + public fun plus(other : Float) : Float + public fun plus(other : Long) : Float + public fun plus(other : Int) : Float + public fun plus(other : Short) : Float + public fun plus(other : Byte) : Float + public fun plus(other : Char) : Float - fun minus(other : Double) : Double - fun minus(other : Float) : Float - fun minus(other : Long) : Float - fun minus(other : Int) : Float - fun minus(other : Short) : Float - fun minus(other : Byte) : Float - fun minus(other : Char) : Float + public fun minus(other : Double) : Double + public fun minus(other : Float) : Float + public fun minus(other : Long) : Float + public fun minus(other : Int) : Float + public fun minus(other : Short) : Float + public fun minus(other : Byte) : Float + public fun minus(other : Char) : Float - fun times(other : Double) : Double - fun times(other : Float) : Float - fun times(other : Long) : Float - fun times(other : Int) : Float - fun times(other : Short) : Float - fun times(other : Byte) : Float - fun times(other : Char) : Float + public fun times(other : Double) : Double + public fun times(other : Float) : Float + public fun times(other : Long) : Float + public fun times(other : Int) : Float + public fun times(other : Short) : Float + public fun times(other : Byte) : Float + public fun times(other : Char) : Float - fun div(other : Double) : Double - fun div(other : Float) : Float - fun div(other : Long) : Float - fun div(other : Int) : Float - fun div(other : Short) : Float - fun div(other : Byte) : Float - fun div(other : Char) : Float + public fun div(other : Double) : Double + public fun div(other : Float) : Float + public fun div(other : Long) : Float + public fun div(other : Int) : Float + public fun div(other : Short) : Float + public fun div(other : Byte) : Float + public fun div(other : Char) : Float - fun mod(other : Double) : Double - fun mod(other : Float) : Float - fun mod(other : Long) : Float - fun mod(other : Int) : Float - fun mod(other : Short) : Float - fun mod(other : Byte) : Float - fun mod(other : Char) : Float + public fun mod(other : Double) : Double + public fun mod(other : Float) : Float + public fun mod(other : Long) : Float + public fun mod(other : Int) : Float + public fun mod(other : Short) : Float + public fun mod(other : Byte) : Float + public fun mod(other : Char) : Float - fun rangeTo(other : Double) : DoubleRange - fun rangeTo(other : Float) : FloatRange - fun rangeTo(other : Long) : DoubleRange - fun rangeTo(other : Int) : FloatRange - fun rangeTo(other : Short) : FloatRange - fun rangeTo(other : Byte) : FloatRange - fun rangeTo(other : Char) : FloatRange + public fun rangeTo(other : Double) : DoubleRange + public fun rangeTo(other : Float) : FloatRange + public fun rangeTo(other : Long) : DoubleRange + public fun rangeTo(other : Int) : FloatRange + public fun rangeTo(other : Short) : FloatRange + public fun rangeTo(other : Byte) : FloatRange + public fun rangeTo(other : Char) : FloatRange - fun upto(other : Double) : DoubleRange - fun upto(other : Float) : FloatRange - fun upto(other : Long) : DoubleRange - fun upto(other : Int) : FloatRange - fun upto(other : Short) : FloatRange - fun upto(other : Byte) : FloatRange - fun upto(other : Char) : FloatRange + public fun upto(other : Double) : DoubleRange + public fun upto(other : Float) : FloatRange + public fun upto(other : Long) : DoubleRange + public fun upto(other : Int) : FloatRange + public fun upto(other : Short) : FloatRange + public fun upto(other : Byte) : FloatRange + public fun upto(other : Char) : FloatRange - fun downto(other : Double) : DoubleRange - fun downto(other : Float) : FloatRange - fun downto(other : Long) : DoubleRange - fun downto(other : Int) : FloatRange - fun downto(other : Short) : FloatRange - fun downto(other : Byte) : FloatRange - fun downto(other : Char) : FloatRange + public fun downto(other : Double) : DoubleRange + public fun downto(other : Float) : FloatRange + public fun downto(other : Long) : DoubleRange + public fun downto(other : Int) : FloatRange + public fun downto(other : Short) : FloatRange + public fun downto(other : Byte) : FloatRange + public fun downto(other : Char) : FloatRange - fun inc() : Float - fun dec() : Float - fun plus() : Float - fun minus() : Float + public fun inc() : Float + public fun dec() : Float + public fun plus() : Float + public fun minus() : Float - override fun toDouble() : Double - override fun toFloat() : Float - override fun toLong() : Long - override fun toInt() : Int - override fun toChar() : Char - override fun toShort() : Short - override fun toByte() : Byte + public override fun toDouble() : Double + public override fun toFloat() : Float + public override fun toLong() : Long + public override fun toInt() : Int + public override fun toChar() : Char + public override fun toShort() : Short + public override fun toByte() : Byte - override fun hashCode() : Int - override fun equals(val other : Any?) : Boolean + public override fun hashCode() : Int + public override fun equals(val other : Any?) : Boolean } -class Long : Number, Comparable { - fun compareTo(other : Double) : Int - fun compareTo(other : Float) : Int - override fun compareTo(other : Long) : Int - fun compareTo(other : Int) : Int - fun compareTo(other : Short) : Int - fun compareTo(other : Byte) : Int - fun compareTo(other : Char) : Int +public class Long : Number, Comparable { + public fun compareTo(other : Double) : Int + public fun compareTo(other : Float) : Int + public override fun compareTo(other : Long) : Int + public fun compareTo(other : Int) : Int + public fun compareTo(other : Short) : Int + public fun compareTo(other : Byte) : Int + public fun compareTo(other : Char) : Int - fun plus(other : Double) : Double - fun plus(other : Float) : Float - fun plus(other : Long) : Long - fun plus(other : Int) : Long - fun plus(other : Short) : Long - fun plus(other : Byte) : Long - fun plus(other : Char) : Long + public fun plus(other : Double) : Double + public fun plus(other : Float) : Float + public fun plus(other : Long) : Long + public fun plus(other : Int) : Long + public fun plus(other : Short) : Long + public fun plus(other : Byte) : Long + public fun plus(other : Char) : Long - fun minus(other : Double) : Double - fun minus(other : Float) : Float - fun minus(other : Long) : Long - fun minus(other : Int) : Long - fun minus(other : Short) : Long - fun minus(other : Byte) : Long - fun minus(other : Char) : Long + public fun minus(other : Double) : Double + public fun minus(other : Float) : Float + public fun minus(other : Long) : Long + public fun minus(other : Int) : Long + public fun minus(other : Short) : Long + public fun minus(other : Byte) : Long + public fun minus(other : Char) : Long - fun times(other : Double) : Double - fun times(other : Float) : Float - fun times(other : Long) : Long - fun times(other : Int) : Long - fun times(other : Short) : Long - fun times(other : Byte) : Long - fun times(other : Char) : Long + public fun times(other : Double) : Double + public fun times(other : Float) : Float + public fun times(other : Long) : Long + public fun times(other : Int) : Long + public fun times(other : Short) : Long + public fun times(other : Byte) : Long + public fun times(other : Char) : Long - fun div(other : Double) : Double - fun div(other : Float) : Float - fun div(other : Long) : Long - fun div(other : Int) : Long - fun div(other : Short) : Long - fun div(other : Byte) : Long - fun div(other : Char) : Long + public fun div(other : Double) : Double + public fun div(other : Float) : Float + public fun div(other : Long) : Long + public fun div(other : Int) : Long + public fun div(other : Short) : Long + public fun div(other : Byte) : Long + public fun div(other : Char) : Long - fun mod(other : Double) : Double - fun mod(other : Float) : Float - fun mod(other : Long) : Long - fun mod(other : Int) : Long - fun mod(other : Short) : Long - fun mod(other : Byte) : Long - fun mod(other : Char) : Long + public fun mod(other : Double) : Double + public fun mod(other : Float) : Float + public fun mod(other : Long) : Long + public fun mod(other : Int) : Long + public fun mod(other : Short) : Long + public fun mod(other : Byte) : Long + public fun mod(other : Char) : Long - fun rangeTo(other : Double) : DoubleRange - fun rangeTo(other : Float) : FloatRange - fun rangeTo(other : Long) : LongRange - fun rangeTo(other : Int) : LongRange - fun rangeTo(other : Short) : LongRange - fun rangeTo(other : Byte) : LongRange - fun rangeTo(other : Char) : LongRange + public fun rangeTo(other : Double) : DoubleRange + public fun rangeTo(other : Float) : FloatRange + public fun rangeTo(other : Long) : LongRange + public fun rangeTo(other : Int) : LongRange + public fun rangeTo(other : Short) : LongRange + public fun rangeTo(other : Byte) : LongRange + public fun rangeTo(other : Char) : LongRange - fun upto(other : Double) : DoubleRange - fun upto(other : Float) : FloatRange - fun upto(other : Long) : LongRange - fun upto(other : Int) : LongRange - fun upto(other : Short) : LongRange - fun upto(other : Byte) : LongRange - fun upto(other : Char) : LongRange + public fun upto(other : Double) : DoubleRange + public fun upto(other : Float) : FloatRange + public fun upto(other : Long) : LongRange + public fun upto(other : Int) : LongRange + public fun upto(other : Short) : LongRange + public fun upto(other : Byte) : LongRange + public fun upto(other : Char) : LongRange - fun downto(other : Double) : DoubleRange - fun downto(other : Float) : FloatRange - fun downto(other : Long) : LongRange - fun downto(other : Int) : LongRange - fun downto(other : Short) : LongRange - fun downto(other : Byte) : LongRange - fun downto(other : Char) : LongRange + public fun downto(other : Double) : DoubleRange + public fun downto(other : Float) : FloatRange + public fun downto(other : Long) : LongRange + public fun downto(other : Int) : LongRange + public fun downto(other : Short) : LongRange + public fun downto(other : Byte) : LongRange + public fun downto(other : Char) : LongRange - fun inc() : Long - fun dec() : Long - fun plus() : Long - fun minus() : Long + public fun inc() : Long + public fun dec() : Long + public fun plus() : Long + public fun minus() : Long - fun shl(bits : Int) : Long - fun shr(bits : Int) : Long - fun ushr(bits : Int) : Long - fun and(other : Long) : Long - fun or(other : Long) : Long - fun xor(other : Long) : Long - fun inv() : Long + public fun shl(bits : Int) : Long + public fun shr(bits : Int) : Long + public fun ushr(bits : Int) : Long + public fun and(other : Long) : Long + public fun or(other : Long) : Long + public fun xor(other : Long) : Long + public fun inv() : Long - override fun toDouble() : Double - override fun toFloat() : Float - override fun toLong() : Long - override fun toInt() : Int - override fun toChar() : Char - override fun toShort() : Short - override fun toByte() : Byte + public override fun toDouble() : Double + public override fun toFloat() : Float + public override fun toLong() : Long + public override fun toInt() : Int + public override fun toChar() : Char + public override fun toShort() : Short + public override fun toByte() : Byte - override fun hashCode() : Int - override fun equals(val other : Any?) : Boolean + public override fun hashCode() : Int + public override fun equals(val other : Any?) : Boolean } -class Int : Number, Comparable { - fun compareTo(other : Double) : Int - fun compareTo(other : Float) : Int - fun compareTo(other : Long) : Int - override fun compareTo(other : Int) : Int - fun compareTo(other : Short) : Int - fun compareTo(other : Byte) : Int - fun compareTo(other : Char) : Int +public class Int : Number, Comparable { + public fun compareTo(other : Double) : Int + public fun compareTo(other : Float) : Int + public fun compareTo(other : Long) : Int + public override fun compareTo(other : Int) : Int + public fun compareTo(other : Short) : Int + public fun compareTo(other : Byte) : Int + public fun compareTo(other : Char) : Int - fun plus(other : Double) : Double - fun plus(other : Float) : Float - fun plus(other : Long) : Long - fun plus(other : Int) : Int - fun plus(other : Short) : Int - fun plus(other : Byte) : Int - fun plus(other : Char) : Int + public fun plus(other : Double) : Double + public fun plus(other : Float) : Float + public fun plus(other : Long) : Long + public fun plus(other : Int) : Int + public fun plus(other : Short) : Int + public fun plus(other : Byte) : Int + public fun plus(other : Char) : Int - fun minus(other : Double) : Double - fun minus(other : Float) : Float - fun minus(other : Long) : Long - fun minus(other : Int) : Int - fun minus(other : Short) : Int - fun minus(other : Byte) : Int - fun minus(other : Char) : Int + public fun minus(other : Double) : Double + public fun minus(other : Float) : Float + public fun minus(other : Long) : Long + public fun minus(other : Int) : Int + public fun minus(other : Short) : Int + public fun minus(other : Byte) : Int + public fun minus(other : Char) : Int - fun times(other : Double) : Double - fun times(other : Float) : Float - fun times(other : Long) : Long - fun times(other : Int) : Int - fun times(other : Short) : Int - fun times(other : Byte) : Int - fun times(other : Char) : Int + public fun times(other : Double) : Double + public fun times(other : Float) : Float + public fun times(other : Long) : Long + public fun times(other : Int) : Int + public fun times(other : Short) : Int + public fun times(other : Byte) : Int + public fun times(other : Char) : Int - fun div(other : Double) : Double - fun div(other : Float) : Float - fun div(other : Long) : Long - fun div(other : Int) : Int - fun div(other : Short) : Int - fun div(other : Byte) : Int - fun div(other : Char) : Int + public fun div(other : Double) : Double + public fun div(other : Float) : Float + public fun div(other : Long) : Long + public fun div(other : Int) : Int + public fun div(other : Short) : Int + public fun div(other : Byte) : Int + public fun div(other : Char) : Int - fun mod(other : Double) : Double - fun mod(other : Float) : Float - fun mod(other : Long) : Long - fun mod(other : Int) : Int - fun mod(other : Short) : Int - fun mod(other : Byte) : Int - fun mod(other : Char) : Int + public fun mod(other : Double) : Double + public fun mod(other : Float) : Float + public fun mod(other : Long) : Long + public fun mod(other : Int) : Int + public fun mod(other : Short) : Int + public fun mod(other : Byte) : Int + public fun mod(other : Char) : Int - fun rangeTo(other : Double) : DoubleRange - fun rangeTo(other : Float) : FloatRange - fun rangeTo(other : Long) : LongRange - fun rangeTo(other : Int) : IntRange - fun rangeTo(other : Short) : IntRange - fun rangeTo(other : Byte) : IntRange - fun rangeTo(other : Char) : IntRange + public fun rangeTo(other : Double) : DoubleRange + public fun rangeTo(other : Float) : FloatRange + public fun rangeTo(other : Long) : LongRange + public fun rangeTo(other : Int) : IntRange + public fun rangeTo(other : Short) : IntRange + public fun rangeTo(other : Byte) : IntRange + public fun rangeTo(other : Char) : IntRange - fun upto(other : Double) : DoubleRange - fun upto(other : Float) : FloatRange - fun upto(other : Long) : LongRange - fun upto(other : Int) : IntRange - fun upto(other : Short) : IntRange - fun upto(other : Byte) : IntRange - fun upto(other : Char) : IntRange + public fun upto(other : Double) : DoubleRange + public fun upto(other : Float) : FloatRange + public fun upto(other : Long) : LongRange + public fun upto(other : Int) : IntRange + public fun upto(other : Short) : IntRange + public fun upto(other : Byte) : IntRange + public fun upto(other : Char) : IntRange - fun downto(other : Double) : DoubleRange - fun downto(other : Float) : FloatRange - fun downto(other : Long) : LongRange - fun downto(other : Int) : IntRange - fun downto(other : Short) : IntRange - fun downto(other : Byte) : IntRange - fun downto(other : Char) : IntRange + public fun downto(other : Double) : DoubleRange + public fun downto(other : Float) : FloatRange + public fun downto(other : Long) : LongRange + public fun downto(other : Int) : IntRange + public fun downto(other : Short) : IntRange + public fun downto(other : Byte) : IntRange + public fun downto(other : Char) : IntRange - fun inc() : Int - fun dec() : Int - fun plus() : Int - fun minus() : Int + public fun inc() : Int + public fun dec() : Int + public fun plus() : Int + public fun minus() : Int - fun shl(bits : Int) : Int - fun shr(bits : Int) : Int - fun ushr(bits : Int) : Int - fun and(other : Int) : Int - fun or(other : Int) : Int - fun xor(other : Int) : Int - fun inv() : Int + public fun shl(bits : Int) : Int + public fun shr(bits : Int) : Int + public fun ushr(bits : Int) : Int + public fun and(other : Int) : Int + public fun or(other : Int) : Int + public fun xor(other : Int) : Int + public fun inv() : Int - override fun toDouble() : Double - override fun toFloat() : Float - override fun toLong() : Long - override fun toInt() : Int - override fun toChar() : Char - override fun toShort() : Short - override fun toByte() : Byte + public override fun toDouble() : Double + public override fun toFloat() : Float + public override fun toLong() : Long + public override fun toInt() : Int + public override fun toChar() : Char + public override fun toShort() : Short + public override fun toByte() : Byte - override fun hashCode() : Int - override fun equals(val other : Any?) : Boolean + public override fun hashCode() : Int + public override fun equals(val other : Any?) : Boolean } -class Char : Number, Comparable { - fun compareTo(other : Double) : Int - fun compareTo(other : Float) : Int - fun compareTo(other : Long) : Int - fun compareTo(other : Int) : Int - fun compareTo(other : Short) : Int - override fun compareTo(other : Char) : Int - fun compareTo(other : Byte) : Int +public class Char : Number, Comparable { + public fun compareTo(other : Double) : Int + public fun compareTo(other : Float) : Int + public fun compareTo(other : Long) : Int + public fun compareTo(other : Int) : Int + public fun compareTo(other : Short) : Int + public override fun compareTo(other : Char) : Int + public fun compareTo(other : Byte) : Int - fun plus(other : Double) : Double - fun plus(other : Float) : Float - fun plus(other : Long) : Long - fun plus(other : Int) : Int - fun plus(other : Short) : Int - fun plus(other : Byte) : Int -// fun plus(other : Char) : Int + public fun plus(other : Double) : Double + public fun plus(other : Float) : Float + public fun plus(other : Long) : Long + public fun plus(other : Int) : Int + public fun plus(other : Short) : Int + public fun plus(other : Byte) : Int +// public fun plus(other : Char) : Int - fun minus(other : Double) : Double - fun minus(other : Float) : Float - fun minus(other : Long) : Long - fun minus(other : Int) : Int - fun minus(other : Short) : Int - fun minus(other : Byte) : Int - fun minus(other : Char) : Int + public fun minus(other : Double) : Double + public fun minus(other : Float) : Float + public fun minus(other : Long) : Long + public fun minus(other : Int) : Int + public fun minus(other : Short) : Int + public fun minus(other : Byte) : Int + public fun minus(other : Char) : Int - fun times(other : Double) : Double - fun times(other : Float) : Float - fun times(other : Long) : Long - fun times(other : Int) : Int - fun times(other : Short) : Int - fun times(other : Byte) : Int -// fun times(other : Char) : Int + public fun times(other : Double) : Double + public fun times(other : Float) : Float + public fun times(other : Long) : Long + public fun times(other : Int) : Int + public fun times(other : Short) : Int + public fun times(other : Byte) : Int +// public fun times(other : Char) : Int - fun div(other : Double) : Double - fun div(other : Float) : Float - fun div(other : Long) : Long - fun div(other : Int) : Int - fun div(other : Short) : Int - fun div(other : Byte) : Int -// fun div(other : Char) : Int + public fun div(other : Double) : Double + public fun div(other : Float) : Float + public fun div(other : Long) : Long + public fun div(other : Int) : Int + public fun div(other : Short) : Int + public fun div(other : Byte) : Int +// public fun div(other : Char) : Int - fun mod(other : Double) : Double - fun mod(other : Float) : Float - fun mod(other : Long) : Long - fun mod(other : Int) : Int - fun mod(other : Short) : Int - fun mod(other : Byte) : Int -// fun mod(other : Char) : Int + public fun mod(other : Double) : Double + public fun mod(other : Float) : Float + public fun mod(other : Long) : Long + public fun mod(other : Int) : Int + public fun mod(other : Short) : Int + public fun mod(other : Byte) : Int +// public fun mod(other : Char) : Int - fun rangeTo(other : Double) : DoubleRange - fun rangeTo(other : Float) : FloatRange - fun rangeTo(other : Long) : LongRange - fun rangeTo(other : Int) : IntRange - fun rangeTo(other : Short) : ShortRange - fun rangeTo(other : Byte) : CharRange - fun rangeTo(other : Char) : CharRange + public fun rangeTo(other : Double) : DoubleRange + public fun rangeTo(other : Float) : FloatRange + public fun rangeTo(other : Long) : LongRange + public fun rangeTo(other : Int) : IntRange + public fun rangeTo(other : Short) : ShortRange + public fun rangeTo(other : Byte) : CharRange + public fun rangeTo(other : Char) : CharRange - fun upto(other : Double) : DoubleRange - fun upto(other : Float) : FloatRange - fun upto(other : Long) : LongRange - fun upto(other : Int) : IntRange - fun upto(other : Short) : ShortRange - fun upto(other : Byte) : CharRange - fun upto(other : Char) : CharRange + public fun upto(other : Double) : DoubleRange + public fun upto(other : Float) : FloatRange + public fun upto(other : Long) : LongRange + public fun upto(other : Int) : IntRange + public fun upto(other : Short) : ShortRange + public fun upto(other : Byte) : CharRange + public fun upto(other : Char) : CharRange - fun downto(other : Double) : DoubleRange - fun downto(other : Float) : FloatRange - fun downto(other : Long) : LongRange - fun downto(other : Int) : IntRange - fun downto(other : Short) : ShortRange - fun downto(other : Byte) : CharRange - fun downto(other : Char) : CharRange + public fun downto(other : Double) : DoubleRange + public fun downto(other : Float) : FloatRange + public fun downto(other : Long) : LongRange + public fun downto(other : Int) : IntRange + public fun downto(other : Short) : ShortRange + public fun downto(other : Byte) : CharRange + public fun downto(other : Char) : CharRange - fun inc() : Char - fun dec() : Char - fun plus() : Int - fun minus() : Int + public fun inc() : Char + public fun dec() : Char + public fun plus() : Int + public fun minus() : Int - override fun toDouble() : Double - override fun toFloat() : Float - override fun toLong() : Long - override fun toInt() : Int - override fun toChar() : Char - override fun toShort() : Short - override fun toByte() : Byte + public override fun toDouble() : Double + public override fun toFloat() : Float + public override fun toLong() : Long + public override fun toInt() : Int + public override fun toChar() : Char + public override fun toShort() : Short + public override fun toByte() : Byte - override fun hashCode() : Int - override fun equals(val other : Any?) : Boolean + public override fun hashCode() : Int + public override fun equals(val other : Any?) : Boolean } -class Short : Number, Comparable { - fun compareTo(other : Double) : Int - fun compareTo(other : Float) : Int - fun compareTo(other : Long) : Int - fun compareTo(other : Int) : Int - override fun compareTo(other : Short) : Int - fun compareTo(other : Byte) : Int - fun compareTo(other : Char) : Int +public class Short : Number, Comparable { + public fun compareTo(other : Double) : Int + public fun compareTo(other : Float) : Int + public fun compareTo(other : Long) : Int + public fun compareTo(other : Int) : Int + public override fun compareTo(other : Short) : Int + public fun compareTo(other : Byte) : Int + public fun compareTo(other : Char) : Int - fun plus(other : Double) : Double - fun plus(other : Float) : Float - fun plus(other : Long) : Long - fun plus(other : Int) : Int - fun plus(other : Short) : Int - fun plus(other : Byte) : Int - fun plus(other : Char) : Int + public fun plus(other : Double) : Double + public fun plus(other : Float) : Float + public fun plus(other : Long) : Long + public fun plus(other : Int) : Int + public fun plus(other : Short) : Int + public fun plus(other : Byte) : Int + public fun plus(other : Char) : Int - fun minus(other : Double) : Double - fun minus(other : Float) : Float - fun minus(other : Long) : Long - fun minus(other : Int) : Int - fun minus(other : Short) : Int - fun minus(other : Byte) : Int - fun minus(other : Char) : Int + public fun minus(other : Double) : Double + public fun minus(other : Float) : Float + public fun minus(other : Long) : Long + public fun minus(other : Int) : Int + public fun minus(other : Short) : Int + public fun minus(other : Byte) : Int + public fun minus(other : Char) : Int - fun times(other : Double) : Double - fun times(other : Float) : Float - fun times(other : Long) : Long - fun times(other : Int) : Int - fun times(other : Short) : Int - fun times(other : Byte) : Int - fun times(other : Char) : Int + public fun times(other : Double) : Double + public fun times(other : Float) : Float + public fun times(other : Long) : Long + public fun times(other : Int) : Int + public fun times(other : Short) : Int + public fun times(other : Byte) : Int + public fun times(other : Char) : Int - fun div(other : Double) : Double - fun div(other : Float) : Float - fun div(other : Long) : Long - fun div(other : Int) : Int - fun div(other : Short) : Int - fun div(other : Byte) : Int - fun div(other : Char) : Int + public fun div(other : Double) : Double + public fun div(other : Float) : Float + public fun div(other : Long) : Long + public fun div(other : Int) : Int + public fun div(other : Short) : Int + public fun div(other : Byte) : Int + public fun div(other : Char) : Int - fun mod(other : Double) : Double - fun mod(other : Float) : Float - fun mod(other : Long) : Long - fun mod(other : Int) : Int - fun mod(other : Short) : Int - fun mod(other : Byte) : Int - fun mod(other : Char) : Int + public fun mod(other : Double) : Double + public fun mod(other : Float) : Float + public fun mod(other : Long) : Long + public fun mod(other : Int) : Int + public fun mod(other : Short) : Int + public fun mod(other : Byte) : Int + public fun mod(other : Char) : Int - fun rangeTo(other : Double) : DoubleRange - fun rangeTo(other : Float) : FloatRange - fun rangeTo(other : Long) : LongRange - fun rangeTo(other : Int) : IntRange - fun rangeTo(other : Short) : ShortRange - fun rangeTo(other : Byte) : ShortRange - fun rangeTo(other : Char) : ShortRange + public fun rangeTo(other : Double) : DoubleRange + public fun rangeTo(other : Float) : FloatRange + public fun rangeTo(other : Long) : LongRange + public fun rangeTo(other : Int) : IntRange + public fun rangeTo(other : Short) : ShortRange + public fun rangeTo(other : Byte) : ShortRange + public fun rangeTo(other : Char) : ShortRange - fun upto(other : Double) : DoubleRange - fun upto(other : Float) : FloatRange - fun upto(other : Long) : LongRange - fun upto(other : Int) : IntRange - fun upto(other : Short) : ShortRange - fun upto(other : Byte) : ShortRange - fun upto(other : Char) : ShortRange + public fun upto(other : Double) : DoubleRange + public fun upto(other : Float) : FloatRange + public fun upto(other : Long) : LongRange + public fun upto(other : Int) : IntRange + public fun upto(other : Short) : ShortRange + public fun upto(other : Byte) : ShortRange + public fun upto(other : Char) : ShortRange - fun downto(other : Double) : DoubleRange - fun downto(other : Float) : FloatRange - fun downto(other : Long) : LongRange - fun downto(other : Int) : IntRange - fun downto(other : Short) : ShortRange - fun downto(other : Byte) : ShortRange - fun downto(other : Char) : ShortRange + public fun downto(other : Double) : DoubleRange + public fun downto(other : Float) : FloatRange + public fun downto(other : Long) : LongRange + public fun downto(other : Int) : IntRange + public fun downto(other : Short) : ShortRange + public fun downto(other : Byte) : ShortRange + public fun downto(other : Char) : ShortRange - fun inc() : Short - fun dec() : Short - fun plus() : Short - fun minus() : Short + public fun inc() : Short + public fun dec() : Short + public fun plus() : Short + public fun minus() : Short - override fun toDouble() : Double - override fun toFloat() : Float - override fun toLong() : Long - override fun toInt() : Int - override fun toChar() : Char - override fun toShort() : Short - override fun toByte() : Byte + public override fun toDouble() : Double + public override fun toFloat() : Float + public override fun toLong() : Long + public override fun toInt() : Int + public override fun toChar() : Char + public override fun toShort() : Short + public override fun toByte() : Byte - override fun hashCode() : Int - override fun equals(val other : Any?) : Boolean + public override fun hashCode() : Int + public override fun equals(val other : Any?) : Boolean } -class Byte : Number, Comparable { - fun compareTo(other : Double) : Int - fun compareTo(other : Float) : Int - fun compareTo(other : Long) : Int - fun compareTo(other : Int) : Int - fun compareTo(other : Short) : Int - fun compareTo(other : Char) : Int - override fun compareTo(other : Byte) : Int +public class Byte : Number, Comparable { + public fun compareTo(other : Double) : Int + public fun compareTo(other : Float) : Int + public fun compareTo(other : Long) : Int + public fun compareTo(other : Int) : Int + public fun compareTo(other : Short) : Int + public fun compareTo(other : Char) : Int + public override fun compareTo(other : Byte) : Int - fun plus(other : Double) : Double - fun plus(other : Float) : Float - fun plus(other : Long) : Long - fun plus(other : Int) : Int - fun plus(other : Short) : Int - fun plus(other : Byte) : Int - fun plus(other : Char) : Int + public fun plus(other : Double) : Double + public fun plus(other : Float) : Float + public fun plus(other : Long) : Long + public fun plus(other : Int) : Int + public fun plus(other : Short) : Int + public fun plus(other : Byte) : Int + public fun plus(other : Char) : Int - fun minus(other : Double) : Double - fun minus(other : Float) : Float - fun minus(other : Long) : Long - fun minus(other : Int) : Int - fun minus(other : Short) : Int - fun minus(other : Byte) : Int - fun minus(other : Char) : Int + public fun minus(other : Double) : Double + public fun minus(other : Float) : Float + public fun minus(other : Long) : Long + public fun minus(other : Int) : Int + public fun minus(other : Short) : Int + public fun minus(other : Byte) : Int + public fun minus(other : Char) : Int - fun times(other : Double) : Double - fun times(other : Float) : Float - fun times(other : Long) : Long - fun times(other : Int) : Int - fun times(other : Short) : Int - fun times(other : Byte) : Int - fun times(other : Char) : Int + public fun times(other : Double) : Double + public fun times(other : Float) : Float + public fun times(other : Long) : Long + public fun times(other : Int) : Int + public fun times(other : Short) : Int + public fun times(other : Byte) : Int + public fun times(other : Char) : Int - fun div(other : Double) : Double - fun div(other : Float) : Float - fun div(other : Long) : Long - fun div(other : Int) : Int - fun div(other : Short) : Int - fun div(other : Byte) : Int - fun div(other : Char) : Int + public fun div(other : Double) : Double + public fun div(other : Float) : Float + public fun div(other : Long) : Long + public fun div(other : Int) : Int + public fun div(other : Short) : Int + public fun div(other : Byte) : Int + public fun div(other : Char) : Int - fun mod(other : Double) : Double - fun mod(other : Float) : Float - fun mod(other : Long) : Long - fun mod(other : Int) : Int - fun mod(other : Short) : Int - fun mod(other : Byte) : Int - fun mod(other : Char) : Int + public fun mod(other : Double) : Double + public fun mod(other : Float) : Float + public fun mod(other : Long) : Long + public fun mod(other : Int) : Int + public fun mod(other : Short) : Int + public fun mod(other : Byte) : Int + public fun mod(other : Char) : Int - fun rangeTo(other : Double) : DoubleRange - fun rangeTo(other : Float) : FloatRange - fun rangeTo(other : Long) : LongRange - fun rangeTo(other : Int) : IntRange - fun rangeTo(other : Short) : ShortRange - fun rangeTo(other : Byte) : ByteRange - fun rangeTo(other : Char) : CharRange + public fun rangeTo(other : Double) : DoubleRange + public fun rangeTo(other : Float) : FloatRange + public fun rangeTo(other : Long) : LongRange + public fun rangeTo(other : Int) : IntRange + public fun rangeTo(other : Short) : ShortRange + public fun rangeTo(other : Byte) : ByteRange + public fun rangeTo(other : Char) : CharRange - fun upto(other : Double) : DoubleRange - fun upto(other : Float) : FloatRange - fun upto(other : Long) : LongRange - fun upto(other : Int) : IntRange - fun upto(other : Short) : ShortRange - fun upto(other : Byte) : ByteRange - fun upto(other : Char) : CharRange + public fun upto(other : Double) : DoubleRange + public fun upto(other : Float) : FloatRange + public fun upto(other : Long) : LongRange + public fun upto(other : Int) : IntRange + public fun upto(other : Short) : ShortRange + public fun upto(other : Byte) : ByteRange + public fun upto(other : Char) : CharRange - fun downto(other : Double) : DoubleRange - fun downto(other : Float) : FloatRange - fun downto(other : Long) : LongRange - fun downto(other : Int) : IntRange - fun downto(other : Short) : ShortRange - fun downto(other : Byte) : ByteRange - fun downto(other : Char) : CharRange + public fun downto(other : Double) : DoubleRange + public fun downto(other : Float) : FloatRange + public fun downto(other : Long) : LongRange + public fun downto(other : Int) : IntRange + public fun downto(other : Short) : ShortRange + public fun downto(other : Byte) : ByteRange + public fun downto(other : Char) : CharRange - fun inc() : Byte - fun dec() : Byte - fun plus() : Byte - fun minus() : Byte + public fun inc() : Byte + public fun dec() : Byte + public fun plus() : Byte + public fun minus() : Byte - override fun toDouble() : Double - override fun toFloat() : Float - override fun toLong() : Long - override fun toInt() : Int - override fun toChar() : Char - override fun toShort() : Short - override fun toByte() : Byte + public override fun toDouble() : Double + public override fun toFloat() : Float + public override fun toLong() : Long + public override fun toInt() : Int + public override fun toChar() : Char + public override fun toShort() : Short + public override fun toByte() : Byte - override fun hashCode() : Int - override fun equals(val other : Any?) : Boolean + public override fun hashCode() : Int + public override fun equals(val other : Any?) : Boolean } diff --git a/compiler/frontend/src/jet/Ranges.jet b/compiler/frontend/src/jet/Ranges.jet index ae0f08b5b51..ff24d077f30 100644 --- a/compiler/frontend/src/jet/Ranges.jet +++ b/compiler/frontend/src/jet/Ranges.jet @@ -1,109 +1,109 @@ package jet -trait Range> { - fun contains(item : T) : Boolean +public trait Range> { + public fun contains(item : T) : Boolean } -class IntRange(val start : Int, val size : Int) : Range, IntIterable { - override fun iterator () : IntIterator +public class IntRange(public val start : Int, public val size : Int) : Range, IntIterable { + public override fun iterator () : IntIterator - override fun contains (elem: Int) : Boolean + public override fun contains (elem: Int) : Boolean - val end : Int + public val end : Int - val iteratorStart : Int + public val iteratorStart : Int - fun minus() : IntRange + public fun minus() : IntRange - fun step(step: Int) : IntIterator + public fun step(step: Int) : IntIterator - val isReversed : Boolean + public val isReversed : Boolean } -class LongRange(val start : Long, val size : Long) : Range, LongIterable { - override fun iterator () : LongIterator +public class LongRange(public val start : Long, public val size : Long) : Range, LongIterable { + public override fun iterator () : LongIterator - override fun contains (elem: Long) : Boolean + public override fun contains (elem: Long) : Boolean - val iteratorStart : Long + public val iteratorStart : Long - val end : Long + public val end : Long - fun minus() : LongRange + public fun minus() : LongRange - fun step(step: Long) : LongIterator + public fun step(step: Long) : LongIterator - val isReversed : Boolean + public val isReversed : Boolean } -class ByteRange(val start : Byte, val size : Int) : Range, ByteIterable { - override fun iterator () : ByteIterator +public class ByteRange(public val start : Byte, public val size : Int) : Range, ByteIterable { + public override fun iterator () : ByteIterator - override fun contains (elem: Byte) : Boolean + public override fun contains (elem: Byte) : Boolean - val end : Byte + public val end : Byte - val iteratorStart : Byte + public val iteratorStart : Byte - fun minus() : ByteRange + public fun minus() : ByteRange - fun step(step: Int) : ByteIterator + public fun step(step: Int) : ByteIterator - val isReversed : Boolean + public val isReversed : Boolean } -class ShortRange(val start : Short, val size : Int) : Range, ShortIterable { - override fun iterator () : ShortIterator +public class ShortRange(public val start : Short, public val size : Int) : Range, ShortIterable { + public override fun iterator () : ShortIterator - override fun contains (elem: Short) : Boolean + public override fun contains (elem: Short) : Boolean - val iteratorStart : Short + public val iteratorStart : Short - val end : Short + public val end : Short - fun minus() : ShortRange + public fun minus() : ShortRange - fun step(step: Int) : ShortIterator + public fun step(step: Int) : ShortIterator - val isReversed : Boolean + public val isReversed : Boolean } -class CharRange(val start : Char, val size : Int) : Range, CharIterable { - override fun iterator () : CharIterator +public class CharRange(public val start : Char, public val size : Int) : Range, CharIterable { + public override fun iterator () : CharIterator - override fun contains (elem: Char) : Boolean + public override fun contains (elem: Char) : Boolean - val iteratorStart : Char + public val iteratorStart : Char - val end : Char + public val end : Char - fun minus() : CharRange + public fun minus() : CharRange - fun step(step: Int) : CharIterator + public fun step(step: Int) : CharIterator - val isReversed : Boolean + public val isReversed : Boolean } -class FloatRange(val start : Float, val size : Float) : Range { - override fun contains (elem: Float) : Boolean +public class FloatRange(public val start : Float, public val size : Float) : Range { + public override fun contains (elem: Float) : Boolean - val end : Float + public val end : Float - fun minus() : FloatRange + public fun minus() : FloatRange - fun step(step: Float) : FloatIterator + public fun step(step: Float) : FloatIterator - val isReversed : Boolean + public val isReversed : Boolean } -class DoubleRange(val start : Double, val size : Double) : Range { - override fun contains (elem: Double) : Boolean +public class DoubleRange(public val start : Double, public val size : Double) : Range { + public override fun contains (elem: Double) : Boolean - val end : Double + public val end : Double - fun minus() : DoubleRange + public fun minus() : DoubleRange - fun step(step: Double) : DoubleIterator + public fun step(step: Double) : DoubleIterator - val isReversed : Boolean + public val isReversed : Boolean } diff --git a/j2k/tests/testData/ast/enum/class/runnableImplementation.kt b/j2k/tests/testData/ast/enum/class/runnableImplementation.kt index dad0edf7366..e3bce19be72 100644 --- a/j2k/tests/testData/ast/enum/class/runnableImplementation.kt +++ b/j2k/tests/testData/ast/enum/class/runnableImplementation.kt @@ -4,7 +4,7 @@ BLACK RED YELLOW BLUE -override public fun run() : Unit { +public override fun run() : Unit { System.out?.println("name()=" + name() + ", toString()=" + toString()) } public fun name() : String { return "" } diff --git a/j2k/tests/testData/ast/function/file/extendsBaseWhichExtendsObject.kt b/j2k/tests/testData/ast/function/file/extendsBaseWhichExtendsObject.kt index eea76d734e4..b132aa896a5 100644 --- a/j2k/tests/testData/ast/function/file/extendsBaseWhichExtendsObject.kt +++ b/j2k/tests/testData/ast/function/file/extendsBaseWhichExtendsObject.kt @@ -1,15 +1,15 @@ package test open class Test() : Base() { -override public fun hashCode() : Int { +public override fun hashCode() : Int { return super.hashCode() } -override public fun equals(o : Any?) : Boolean { +public override fun equals(o : Any?) : Boolean { return super.equals(o) } override protected fun clone() : Any? { return super.clone() } -override public fun toString() : String? { +public override fun toString() : String? { return super.toString() } override protected fun finalize() : Unit { diff --git a/j2k/tests/testData/ast/issues/file/kt-696.kt b/j2k/tests/testData/ast/issues/file/kt-696.kt index 9369e8ec092..512d0de5d2f 100644 --- a/j2k/tests/testData/ast/issues/file/kt-696.kt +++ b/j2k/tests/testData/ast/issues/file/kt-696.kt @@ -11,13 +11,13 @@ return getJavaClass.getName() + '@' + Integer.toHexString(hashCode()) } } open class Child() : Base() { -override public fun hashCode() : Int { +public override fun hashCode() : Int { return super.hashCode() } -override public fun equals(o : Any?) : Boolean { +public override fun equals(o : Any?) : Boolean { return super.equals(o) } -override public fun toString() : String? { +public override fun toString() : String? { return super.toString() } } \ No newline at end of file diff --git a/j2k/tests/testData/ast/issues/file/kt-836.kt b/j2k/tests/testData/ast/issues/file/kt-836.kt index d7ab78c24fd..938269632b7 100644 --- a/j2k/tests/testData/ast/issues/file/kt-836.kt +++ b/j2k/tests/testData/ast/issues/file/kt-836.kt @@ -2,7 +2,7 @@ package com.voltvoodoo.saplo4j.model import java.io.Serializable public open class Language(code : String?) : Serializable { protected var code : String? = null -override public fun toString() : String? { +public override fun toString() : String? { return this.code } { diff --git a/j2k/tests/testData/ast/kotlinExclusion/file/kt-656.kt b/j2k/tests/testData/ast/kotlinExclusion/file/kt-656.kt index 4d8d3ac6e19..502ace95174 100644 --- a/j2k/tests/testData/ast/kotlinExclusion/file/kt-656.kt +++ b/j2k/tests/testData/ast/kotlinExclusion/file/kt-656.kt @@ -1,7 +1,7 @@ package demo import java.util.Iterator open class Test() : java.lang.Iterable { -override public fun iterator() : java.util.Iterator? { +public override fun iterator() : java.util.Iterator? { return null } open public fun push(i : java.util.Iterator?) : java.util.Iterator? { @@ -10,7 +10,7 @@ return j } } open class FullTest() : java.lang.Iterable { -override public fun iterator() : java.util.Iterator? { +public override fun iterator() : java.util.Iterator? { return null } open public fun push(i : java.util.Iterator?) : java.util.Iterator? { diff --git a/j2k/tests/testData/ast/newClassExpression/expression/newClassWithAnonymousScope.kt b/j2k/tests/testData/ast/newClassExpression/expression/newClassWithAnonymousScope.kt index bfee0514886..29038a298dc 100644 --- a/j2k/tests/testData/ast/newClassExpression/expression/newClassWithAnonymousScope.kt +++ b/j2k/tests/testData/ast/newClassExpression/expression/newClassWithAnonymousScope.kt @@ -1,5 +1,5 @@ object : Runnable() { -override public fun run() : Unit { +public override fun run() : Unit { System.out?.println("Run") } } \ No newline at end of file diff --git a/j2k/tests/testData/ast/objectLiteral/file/MyFrame.kt b/j2k/tests/testData/ast/objectLiteral/file/MyFrame.kt index bb49c2e14d5..b704b724419 100644 --- a/j2k/tests/testData/ast/objectLiteral/file/MyFrame.kt +++ b/j2k/tests/testData/ast/objectLiteral/file/MyFrame.kt @@ -6,12 +6,12 @@ open public fun windowClosing() : Unit { public class Client() : Frame() { { var a : WindowAdapter? = object : WindowAdapter() { -override public fun windowClosing() : Unit { +public override fun windowClosing() : Unit { } } addWindowListener(a) addWindowListener(object : WindowAdapter() { -override public fun windowClosing() : Unit { +public override fun windowClosing() : Unit { } }) } diff --git a/jdk-headers/src/java/util/AbstractCollection.kt b/jdk-headers/src/java/util/AbstractCollection.kt index 6b9b8100d3c..fdfe933496d 100644 --- a/jdk-headers/src/java/util/AbstractCollection.kt +++ b/jdk-headers/src/java/util/AbstractCollection.kt @@ -1,17 +1,17 @@ package java.util -abstract public open class AbstractCollection protected () : java.lang.Object(), java.util.Collection { - abstract override public fun iterator() : java.util.Iterator - abstract override public fun size() : Int - override public fun isEmpty() : Boolean {} - override public fun contains(o : Any?) : Boolean {} - override public fun toArray() : Array {} - override public fun toArray(a : Array) : Array {} - override public fun add(e : E) : Boolean {} - override public fun remove(o : Any?) : Boolean {} - override public fun containsAll(c : java.util.Collection<*>) : Boolean {} - override public fun addAll(c : java.util.Collection) : Boolean {} - override public fun removeAll(c : java.util.Collection<*>) : Boolean {} - override public fun retainAll(c : java.util.Collection<*>) : Boolean {} - override public fun clear() : Unit {} -//override public fun toString() : java.lang.String {} +public abstract class AbstractCollection protected () : java.lang.Object(), java.util.Collection { + public abstract override fun iterator() : java.util.Iterator + public abstract override fun size() : Int + public override fun isEmpty() : Boolean {} + public override fun contains(o : Any?) : Boolean {} + public override fun toArray() : Array {} + public override fun toArray(a : Array) : Array {} + public override fun add(e : E) : Boolean {} + public override fun remove(o : Any?) : Boolean {} + public override fun containsAll(c : java.util.Collection<*>) : Boolean {} + public override fun addAll(c : java.util.Collection) : Boolean {} + public override fun removeAll(c : java.util.Collection<*>) : Boolean {} + public override fun retainAll(c : java.util.Collection<*>) : Boolean {} + public override fun clear() : Unit {} +//public override fun toString() : java.lang.String {} } diff --git a/jdk-headers/src/java/util/AbstractList.kt b/jdk-headers/src/java/util/AbstractList.kt index 4c94916b6d2..277f733c791 100644 --- a/jdk-headers/src/java/util/AbstractList.kt +++ b/jdk-headers/src/java/util/AbstractList.kt @@ -1,20 +1,20 @@ package java.util -abstract public open class AbstractList protected () : java.util.AbstractCollection(), java.util.List { - override public fun add(e : E) : Boolean {} - abstract override public fun get(index : Int) : E - override public fun set(index : Int, element : E) : E {} - override public fun add(index : Int, element : E) : Unit {} - override public fun remove(index : Int) : E {} - override public fun indexOf(o : Any?) : Int {} - override public fun lastIndexOf(o : Any?) : Int {} - override public fun clear() : Unit {} - override public fun addAll(index : Int, c : java.util.Collection) : Boolean {} - override public fun iterator() : java.util.Iterator {} - override public fun listIterator() : java.util.ListIterator {} - override public fun listIterator(index : Int) : java.util.ListIterator {} - override public fun subList(fromIndex : Int, toIndex : Int) : java.util.List {} -// override public fun equals(o : Any?) : Boolean -// override public fun hashCode() : Int +public abstract class AbstractList protected () : java.util.AbstractCollection(), java.util.List { + public override fun add(e : E) : Boolean {} + public abstract override fun get(index : Int) : E + public override fun set(index : Int, element : E) : E {} + public override fun add(index : Int, element : E) : Unit {} + public override fun remove(index : Int) : E {} + public override fun indexOf(o : Any?) : Int {} + public override fun lastIndexOf(o : Any?) : Int {} + public override fun clear() : Unit {} + public override fun addAll(index : Int, c : java.util.Collection) : Boolean {} + public override fun iterator() : java.util.Iterator {} + public override fun listIterator() : java.util.ListIterator {} + public override fun listIterator(index : Int) : java.util.ListIterator {} + public override fun subList(fromIndex : Int, toIndex : Int) : java.util.List {} +// public override fun equals(o : Any?) : Boolean +// public override fun hashCode() : Int open protected fun removeRange(fromIndex : Int, toIndex : Int) : Unit {} protected var modCount : Int = 0 } \ No newline at end of file diff --git a/jdk-headers/src/java/util/AbstractMap.kt b/jdk-headers/src/java/util/AbstractMap.kt index 43101e4cb44..ca06c1afa2b 100644 --- a/jdk-headers/src/java/util/AbstractMap.kt +++ b/jdk-headers/src/java/util/AbstractMap.kt @@ -2,20 +2,20 @@ package java.util import java.util.Map.Entry -abstract public open class AbstractMap protected () : java.lang.Object(), java.util.Map { - override public fun size() : Int {} - override public fun isEmpty() : Boolean {} - override public fun containsValue(value : Any?) : Boolean {} - override public fun containsKey(key : Any?) : Boolean {} - override public fun get(key : Any?) : V? {} - override public fun put(key : K, value : V) : V? {} - override public fun remove(key : Any?) : V? {} - override public fun putAll(m : java.util.Map) : Unit {} - override public fun clear() : Unit {} - override public fun keySet() : java.util.Set {} - override public fun values() : java.util.Collection {} - abstract override public fun entrySet() : java.util.Set> - //override public fun equals(o : Any?) : Boolean - //override public fun hashCode() : Int - //override public fun toString() : java.lang.String? +public abstract class AbstractMap protected () : java.lang.Object(), java.util.Map { + public override fun size() : Int {} + public override fun isEmpty() : Boolean {} + public override fun containsValue(value : Any?) : Boolean {} + public override fun containsKey(key : Any?) : Boolean {} + public override fun get(key : Any?) : V? {} + public override fun put(key : K, value : V) : V? {} + public override fun remove(key : Any?) : V? {} + public override fun putAll(m : java.util.Map) : Unit {} + public override fun clear() : Unit {} + public override fun keySet() : java.util.Set {} + public override fun values() : java.util.Collection {} + public abstract override fun entrySet() : java.util.Set> + //public override fun equals(o : Any?) : Boolean + //public override fun hashCode() : Int + //public override fun toString() : java.lang.String? } diff --git a/jdk-headers/src/java/util/AbstractSequentialList.kt b/jdk-headers/src/java/util/AbstractSequentialList.kt index 719c111662b..9fa0afdb716 100644 --- a/jdk-headers/src/java/util/AbstractSequentialList.kt +++ b/jdk-headers/src/java/util/AbstractSequentialList.kt @@ -1,10 +1,10 @@ package java.util -abstract public open class AbstractSequentialList protected () : java.util.AbstractList() { - override public fun get(index : Int) : E {} - override public fun set(index : Int, element : E) : E {} - override public fun add(index : Int, element : E) : Unit {} - override public fun remove(index : Int) : E {} - override public fun addAll(index : Int, c : java.util.Collection) : Boolean {} - override public fun iterator() : java.util.Iterator {} - abstract override public fun listIterator(index : Int) : java.util.ListIterator {} +public abstract class AbstractSequentialList protected () : java.util.AbstractList() { + public override fun get(index : Int) : E {} + public override fun set(index : Int, element : E) : E {} + public override fun add(index : Int, element : E) : Unit {} + public override fun remove(index : Int) : E {} + public override fun addAll(index : Int, c : java.util.Collection) : Boolean {} + public override fun iterator() : java.util.Iterator {} + public abstract override fun listIterator(index : Int) : java.util.ListIterator {} } \ No newline at end of file diff --git a/jdk-headers/src/java/util/AbstractSet.kt b/jdk-headers/src/java/util/AbstractSet.kt index b2dbe4f5363..397fb5164da 100644 --- a/jdk-headers/src/java/util/AbstractSet.kt +++ b/jdk-headers/src/java/util/AbstractSet.kt @@ -1,6 +1,6 @@ package java.util -abstract public open class AbstractSet protected () : java.util.AbstractCollection(), java.util.Set { -// override public fun equals(o : Any?) : Boolean -// override public fun hashCode() : Int - override public fun removeAll(c : java.util.Collection<*>) : Boolean {} +public abstract class AbstractSet protected () : java.util.AbstractCollection(), java.util.Set { +// public override fun equals(o : Any?) : Boolean +// public override fun hashCode() : Int + public override fun removeAll(c : java.util.Collection<*>) : Boolean {} } \ No newline at end of file diff --git a/jdk-headers/src/java/util/ArrayList.kt b/jdk-headers/src/java/util/ArrayList.kt index 288168f5142..2df62623df8 100644 --- a/jdk-headers/src/java/util/ArrayList.kt +++ b/jdk-headers/src/java/util/ArrayList.kt @@ -8,23 +8,23 @@ public open class ArrayList(c : java.util.Collection) : java.ut public this(initialCapacity : Int) {} open public fun trimToSize() : Unit {} open public fun ensureCapacity(minCapacity : Int) : Unit {} - override public fun size() : Int {} - override public fun isEmpty() : Boolean {} - override public fun contains(o : Any?) : Boolean {} - override public fun indexOf(o : Any?) : Int {} - override public fun lastIndexOf(o : Any?) : Int {} - override public fun clone() : java.lang.Object {} - override public fun toArray() : Array {} - override public fun toArray(a : Array) : Array {} - override public fun get(index : Int) : E {} - override public fun set(index : Int, element : E) : E {} - override public fun add(e : E) : Boolean {} - override public fun add(index : Int, element : E) : Unit {} - override public fun remove(index : Int) : E {} - override public fun remove(o : Any?) : Boolean {} - override public fun clear() : Unit {} - override public fun addAll(c : java.util.Collection) : Boolean {} - override public fun addAll(index : Int, c : java.util.Collection) : Boolean {} + public override fun size() : Int {} + public override fun isEmpty() : Boolean {} + public override fun contains(o : Any?) : Boolean {} + public override fun indexOf(o : Any?) : Int {} + public override fun lastIndexOf(o : Any?) : Int {} + public override fun clone() : java.lang.Object {} + public override fun toArray() : Array {} + public override fun toArray(a : Array) : Array {} + public override fun get(index : Int) : E {} + public override fun set(index : Int, element : E) : E {} + public override fun add(e : E) : Boolean {} + public override fun add(index : Int, element : E) : Unit {} + public override fun remove(index : Int) : E {} + public override fun remove(o : Any?) : Boolean {} + public override fun clear() : Unit {} + public override fun addAll(c : java.util.Collection) : Boolean {} + public override fun addAll(index : Int, c : java.util.Collection) : Boolean {} override protected fun removeRange(fromIndex : Int, toIndex : Int) : Unit {} // class object { // open public fun init() : ArrayList { diff --git a/jdk-headers/src/java/util/Deque.kt b/jdk-headers/src/java/util/Deque.kt index 5282d85c672..105f8f66eb0 100644 --- a/jdk-headers/src/java/util/Deque.kt +++ b/jdk-headers/src/java/util/Deque.kt @@ -24,7 +24,7 @@ public trait Deque : java.util.Queue { open fun pop() : E override fun remove(o : Any?) : Boolean override fun contains(o : Any?) : Boolean - override public fun size() : Int + public override fun size() : Int override fun iterator() : java.util.Iterator open fun descendingIterator() : java.util.Iterator } \ No newline at end of file diff --git a/jdk-headers/src/java/util/HashMap.kt b/jdk-headers/src/java/util/HashMap.kt index 35a9d6c9e5f..0a27a8a3649 100644 --- a/jdk-headers/src/java/util/HashMap.kt +++ b/jdk-headers/src/java/util/HashMap.kt @@ -8,17 +8,17 @@ public open class HashMap(m : java.util.Map) : public this() {} public this(initialCapacity : Int) {} public this(initialCapacity : Int, loadFactor : Float) {} - override public fun size() : Int {} - override public fun isEmpty() : Boolean {} - override public fun get(key : Any?) : V? {} - override public fun containsKey(key : Any?) : Boolean {} - override public fun put(key : K, value : V) : V? {} - override public fun putAll(m : java.util.Map) : Unit {} - override public fun remove(key : Any?) : V? {} - override public fun clear() : Unit {} - override public fun containsValue(value : Any?) : Boolean {} - override public fun clone() : Any? {} - override public fun keySet() : java.util.Set {} - override public fun values() : java.util.Collection {} - override public fun entrySet() : java.util.Set> {} + public override fun size() : Int {} + public override fun isEmpty() : Boolean {} + public override fun get(key : Any?) : V? {} + public override fun containsKey(key : Any?) : Boolean {} + public override fun put(key : K, value : V) : V? {} + public override fun putAll(m : java.util.Map) : Unit {} + public override fun remove(key : Any?) : V? {} + public override fun clear() : Unit {} + public override fun containsValue(value : Any?) : Boolean {} + public override fun clone() : Any? {} + public override fun keySet() : java.util.Set {} + public override fun values() : java.util.Collection {} + public override fun entrySet() : java.util.Set> {} } diff --git a/jdk-headers/src/java/util/HashSet.kt b/jdk-headers/src/java/util/HashSet.kt index 4dfa28077e9..4b1bdd7d8a5 100644 --- a/jdk-headers/src/java/util/HashSet.kt +++ b/jdk-headers/src/java/util/HashSet.kt @@ -6,14 +6,14 @@ public open class HashSet(c : java.util.Collection) : java.util public this() {} public this(initialCapacity : Int) {} public this(initialCapacity : Int, loadFactor : Float) {} - override public fun iterator() : java.util.Iterator {} - override public fun size() : Int {} - override public fun isEmpty() : Boolean {} - override public fun contains(o : Any?) : Boolean {} - override public fun add(e : E) : Boolean {} - override public fun remove(o : Any?) : Boolean {} - override public fun clear() : Unit {} - override public fun clone() : Any? {} + public override fun iterator() : java.util.Iterator {} + public override fun size() : Int {} + public override fun isEmpty() : Boolean {} + public override fun contains(o : Any?) : Boolean {} + public override fun add(e : E) : Boolean {} + public override fun remove(o : Any?) : Boolean {} + public override fun clear() : Unit {} + public override fun clone() : Any? {} //class object { //open public fun init() : HashSet { //val __ = HashSet(0, null, null) diff --git a/jdk-headers/src/java/util/LinkedHashMap.kt b/jdk-headers/src/java/util/LinkedHashMap.kt index b2c0f2fcd4b..06b7af131ef 100644 --- a/jdk-headers/src/java/util/LinkedHashMap.kt +++ b/jdk-headers/src/java/util/LinkedHashMap.kt @@ -7,9 +7,9 @@ public open class LinkedHashMap(m : java.util.Map) : Boolean {} //class object { //open public fun init(initialCapacity : Int, loadFactor : Float) : LinkedHashMap { diff --git a/jdk-headers/src/java/util/LinkedList.kt b/jdk-headers/src/java/util/LinkedList.kt index 18ae65b8eb8..583b0bf8ebf 100644 --- a/jdk-headers/src/java/util/LinkedList.kt +++ b/jdk-headers/src/java/util/LinkedList.kt @@ -6,45 +6,45 @@ public open class LinkedList(c : java.util.Collection) : java.u java.io.Serializable { public this() {} - override public fun getFirst() : E {} - override public fun getLast() : E {} - override public fun removeFirst() : E {} - override public fun removeLast() : E {} - override public fun addFirst(e : E) : Unit {} - override public fun addLast(e : E) : Unit {} - override public fun contains(o : Any?) : Boolean {} - override public fun size() : Int {} - override public fun add(e : E) : Boolean {} - override public fun remove(o : Any?) : Boolean {} - override public fun addAll(c : java.util.Collection) : Boolean {} - override public fun addAll(index : Int, c : java.util.Collection) : Boolean {} - override public fun clear() : Unit {} - override public fun get(index : Int) : E {} - override public fun set(index : Int, element : E) : E {} - override public fun add(index : Int, element : E) : Unit {} - override public fun remove(index : Int) : E {} - override public fun indexOf(o : Any?) : Int {} - override public fun lastIndexOf(o : Any?) : Int {} - override public fun peek() : E? {} - override public fun element() : E {} - override public fun poll() : E? {} - override public fun remove() : E {} - override public fun offer(e : E) : Boolean {} - override public fun offerFirst(e : E) : Boolean {} - override public fun offerLast(e : E) : Boolean {} - override public fun peekFirst() : E? {} - override public fun peekLast() : E? {} - override public fun pollFirst() : E? {} - override public fun pollLast() : E? {} - override public fun push(e : E) : Unit {} - override public fun pop() : E {} - override public fun removeFirstOccurrence(o : Any?) : Boolean {} - override public fun removeLastOccurrence(o : Any?) : Boolean {} - override public fun listIterator(index : Int) : java.util.ListIterator {} - override public fun descendingIterator() : java.util.Iterator {} - override public fun clone() : Any? {} - override public fun toArray() : Array {} - override public fun toArray(a : Array) : Array {} + public override fun getFirst() : E {} + public override fun getLast() : E {} + public override fun removeFirst() : E {} + public override fun removeLast() : E {} + public override fun addFirst(e : E) : Unit {} + public override fun addLast(e : E) : Unit {} + public override fun contains(o : Any?) : Boolean {} + public override fun size() : Int {} + public override fun add(e : E) : Boolean {} + public override fun remove(o : Any?) : Boolean {} + public override fun addAll(c : java.util.Collection) : Boolean {} + public override fun addAll(index : Int, c : java.util.Collection) : Boolean {} + public override fun clear() : Unit {} + public override fun get(index : Int) : E {} + public override fun set(index : Int, element : E) : E {} + public override fun add(index : Int, element : E) : Unit {} + public override fun remove(index : Int) : E {} + public override fun indexOf(o : Any?) : Int {} + public override fun lastIndexOf(o : Any?) : Int {} + public override fun peek() : E? {} + public override fun element() : E {} + public override fun poll() : E? {} + public override fun remove() : E {} + public override fun offer(e : E) : Boolean {} + public override fun offerFirst(e : E) : Boolean {} + public override fun offerLast(e : E) : Boolean {} + public override fun peekFirst() : E? {} + public override fun peekLast() : E? {} + public override fun pollFirst() : E? {} + public override fun pollLast() : E? {} + public override fun push(e : E) : Unit {} + public override fun pop() : E {} + public override fun removeFirstOccurrence(o : Any?) : Boolean {} + public override fun removeLastOccurrence(o : Any?) : Boolean {} + public override fun listIterator(index : Int) : java.util.ListIterator {} + public override fun descendingIterator() : java.util.Iterator {} + public override fun clone() : Any? {} + public override fun toArray() : Array {} + public override fun toArray(a : Array) : Array {} //class object { //open public fun init(c : java.util.Collection?) : LinkedList { //return __ diff --git a/js/js.libraries/src/core/javautil.kt b/js/js.libraries/src/core/javautil.kt index 954801cbcd6..e3973c3a37e 100644 --- a/js/js.libraries/src/core/javautil.kt +++ b/js/js.libraries/src/core/javautil.kt @@ -29,23 +29,23 @@ val Collections = object { library public open class ArrayList() : java.util.List { - override public fun size() : Int = js.noImpl - override public fun isEmpty() : Boolean = js.noImpl - override public fun contains(o : Any?) : Boolean = js.noImpl - override public fun iterator() : Iterator = js.noImpl - // override public fun indexOf(o : Any?) : Int = js.noImpl - // override public fun lastIndexOf(o : Any?) : Int = js.noImpl - // override public fun toArray() : Array = js.noImpl - // override public fun toArray(a : Array) : Array = js.noImpl - override public fun get(index : Int) : E = js.noImpl - override public fun set(index : Int, element : E) : E = js.noImpl - override public fun add(e : E) : Boolean = js.noImpl - override public fun add(index : Int, element : E) : Unit = js.noImpl - override public fun remove(index : Int) : E = js.noImpl - override public fun remove(o : Any?) : Boolean = js.noImpl - override public fun clear() : Unit = js.noImpl - override public fun addAll(c : java.util.Collection) : Boolean = js.noImpl - // override public fun addAll(index : Int, c : java.util.Collection) : Boolean = js.noImpl + public override fun size() : Int = js.noImpl + public override fun isEmpty() : Boolean = js.noImpl + public override fun contains(o : Any?) : Boolean = js.noImpl + public override fun iterator() : Iterator = js.noImpl + // public override fun indexOf(o : Any?) : Int = js.noImpl + // public override fun lastIndexOf(o : Any?) : Int = js.noImpl + // public override fun toArray() : Array = js.noImpl + // public override fun toArray(a : Array) : Array = js.noImpl + public override fun get(index : Int) : E = js.noImpl + public override fun set(index : Int, element : E) : E = js.noImpl + public override fun add(e : E) : Boolean = js.noImpl + public override fun add(index : Int, element : E) : Unit = js.noImpl + public override fun remove(index : Int) : E = js.noImpl + public override fun remove(o : Any?) : Boolean = js.noImpl + public override fun clear() : Unit = js.noImpl + public override fun addAll(c : java.util.Collection) : Boolean = js.noImpl + // public override fun addAll(index : Int, c : java.util.Collection) : Boolean = js.noImpl } library @@ -109,13 +109,13 @@ public trait Set : Collection { library public open class HashSet() : java.util.Set { - override public fun iterator() : java.util.Iterator = js.noImpl - override public fun size() : Int = js.noImpl - override public fun isEmpty() : Boolean = js.noImpl - override public fun contains(o : Any?) : Boolean = js.noImpl - override public fun add(e : E) : Boolean = js.noImpl - override public fun remove(o : Any?) : Boolean = js.noImpl - override public fun clear() : Unit = js.noImpl + public override fun iterator() : java.util.Iterator = js.noImpl + public override fun size() : Int = js.noImpl + public override fun isEmpty() : Boolean = js.noImpl + public override fun contains(o : Any?) : Boolean = js.noImpl + public override fun add(e : E) : Boolean = js.noImpl + public override fun remove(o : Any?) : Boolean = js.noImpl + public override fun clear() : Unit = js.noImpl override fun addAll(c : java.util.Collection) : Boolean = js.noImpl } @@ -136,33 +136,33 @@ public trait Map { library public open class HashMap() : java.util.Map { - override public fun size() : Int = js.noImpl - override public fun isEmpty() : Boolean = js.noImpl - override public fun get(key : Any?) : V = js.noImpl - override public fun containsKey(key : Any?) : Boolean = js.noImpl - override public fun put(key : K, value : V) : V = js.noImpl - override public fun putAll(m : java.util.Map) : Unit = js.noImpl - override public fun remove(key : Any?) : V? = js.noImpl - override public fun clear() : Unit = js.noImpl - override public fun containsValue(value : Any?) : Boolean = js.noImpl - override public fun keySet() : java.util.Set = js.noImpl - override public fun values() : java.util.Collection = js.noImpl + public override fun size() : Int = js.noImpl + public override fun isEmpty() : Boolean = js.noImpl + public override fun get(key : Any?) : V = js.noImpl + public override fun containsKey(key : Any?) : Boolean = js.noImpl + public override fun put(key : K, value : V) : V = js.noImpl + public override fun putAll(m : java.util.Map) : Unit = js.noImpl + public override fun remove(key : Any?) : V? = js.noImpl + public override fun clear() : Unit = js.noImpl + public override fun containsValue(value : Any?) : Boolean = js.noImpl + public override fun keySet() : java.util.Set = js.noImpl + public override fun values() : java.util.Collection = js.noImpl } library public open class LinkedList() : List { - override public fun iterator() : java.util.Iterator = js.noImpl - override public fun isEmpty() : Boolean = js.noImpl - override public fun contains(o : Any?) : Boolean = js.noImpl - override public fun size() : Int = js.noImpl - override public fun add(e : E) : Boolean = js.noImpl - override public fun remove(o : Any?) : Boolean = js.noImpl - override public fun addAll(c : java.util.Collection) : Boolean = js.noImpl - override public fun clear() : Unit = js.noImpl - override public fun get(index : Int) : E = js.noImpl - override public fun set(index : Int, element : E) : E = js.noImpl - override public fun add(index : Int, element : E) : Unit = js.noImpl - override public fun remove(index : Int) : E = js.noImpl + public override fun iterator() : java.util.Iterator = js.noImpl + public override fun isEmpty() : Boolean = js.noImpl + public override fun contains(o : Any?) : Boolean = js.noImpl + public override fun size() : Int = js.noImpl + public override fun add(e : E) : Boolean = js.noImpl + public override fun remove(o : Any?) : Boolean = js.noImpl + public override fun addAll(c : java.util.Collection) : Boolean = js.noImpl + public override fun clear() : Unit = js.noImpl + public override fun get(index : Int) : E = js.noImpl + public override fun set(index : Int, element : E) : E = js.noImpl + public override fun add(index : Int, element : E) : Unit = js.noImpl + public override fun remove(index : Int) : E = js.noImpl public fun poll() : E? = js.noImpl public fun peek() : E? = js.noImpl public fun offer(e : E) : Boolean = js.noImpl diff --git a/libraries/stdlib/src/generated/ArraysFromJavaCollections.kt b/libraries/stdlib/src/generated/ArraysFromJavaCollections.kt index 5d72ce73c9f..120d8247c20 100644 --- a/libraries/stdlib/src/generated/ArraysFromJavaCollections.kt +++ b/libraries/stdlib/src/generated/ArraysFromJavaCollections.kt @@ -15,12 +15,12 @@ import java.util.* * * @includeFunction ../../test/CollectionTest.kt map */ -inline fun Array.map(transform : (T) -> R) : java.util.List { +public inline fun Array.map(transform : (T) -> R) : java.util.List { return mapTo(java.util.ArrayList(this.size), transform) } /** Transforms each element of this collection with the given function then adds the results to the given collection */ -inline fun > Array.mapTo(result: C, transform : (T) -> R) : C { +public inline fun > Array.mapTo(result: C, transform : (T) -> R) : C { for (item in this) result.add(transform(item)) return result diff --git a/libraries/stdlib/src/generated/JavaUtilIterablesFromJavaCollections.kt b/libraries/stdlib/src/generated/JavaUtilIterablesFromJavaCollections.kt index 0ab7e3e1d8e..0808f6bfedb 100644 --- a/libraries/stdlib/src/generated/JavaUtilIterablesFromJavaCollections.kt +++ b/libraries/stdlib/src/generated/JavaUtilIterablesFromJavaCollections.kt @@ -15,12 +15,12 @@ import java.util.* * * @includeFunction ../../test/CollectionTest.kt map */ -inline fun java.lang.Iterable.map(transform : (T) -> R) : java.util.List { +public inline fun java.lang.Iterable.map(transform : (T) -> R) : java.util.List { return mapTo(java.util.ArrayList(), transform) } /** Transforms each element of this collection with the given function then adds the results to the given collection */ -inline fun > java.lang.Iterable.mapTo(result: C, transform : (T) -> R) : C { +public inline fun > java.lang.Iterable.mapTo(result: C, transform : (T) -> R) : C { for (item in this) result.add(transform(item)) return result diff --git a/libraries/stdlib/src/generated/StandardFromJavaCollections.kt b/libraries/stdlib/src/generated/StandardFromJavaCollections.kt index 685fe9ffc2b..e0894bdf2e8 100644 --- a/libraries/stdlib/src/generated/StandardFromJavaCollections.kt +++ b/libraries/stdlib/src/generated/StandardFromJavaCollections.kt @@ -15,12 +15,12 @@ import java.util.* * * @includeFunction ../../test/CollectionTest.kt map */ -inline fun Iterable.map(transform : (T) -> R) : java.util.List { +public inline fun Iterable.map(transform : (T) -> R) : java.util.List { return mapTo(java.util.ArrayList(), transform) } /** Transforms each element of this collection with the given function then adds the results to the given collection */ -inline fun > Iterable.mapTo(result: C, transform : (T) -> R) : C { +public inline fun > Iterable.mapTo(result: C, transform : (T) -> R) : C { for (item in this) result.add(transform(item)) return result diff --git a/libraries/stdlib/src/kotlin/Arrays.kt b/libraries/stdlib/src/kotlin/Arrays.kt index ff488a3a81b..83770a8cae7 100644 --- a/libraries/stdlib/src/kotlin/Arrays.kt +++ b/libraries/stdlib/src/kotlin/Arrays.kt @@ -8,103 +8,103 @@ import java.util.List import java.util.ArrayList // Array "constructor" -inline fun array(vararg t : T) : Array = t +public inline fun array(vararg t : T) : Array = t // "constructors" for primitive types array -inline fun doubleArray(vararg content : Double) = content +public inline fun doubleArray(vararg content : Double) : DoubleArray = content -inline fun floatArray(vararg content : Float) = content +public inline fun floatArray(vararg content : Float) : FloatArray = content -inline fun longArray(vararg content : Long) = content +public inline fun longArray(vararg content : Long) : LongArray = content -inline fun intArray(vararg content : Int) = content +public inline fun intArray(vararg content : Int) : IntArray = content -inline fun charArray(vararg content : Char) = content +public inline fun charArray(vararg content : Char) : CharArray = content -inline fun shortArray(vararg content : Short) = content +public inline fun shortArray(vararg content : Short) : ShortArray = content -inline fun byteArray(vararg content : Byte) = content +public inline fun byteArray(vararg content : Byte) : ByteArray = content -inline fun booleanArray(vararg content : Boolean) = content +public inline fun booleanArray(vararg content : Boolean) : BooleanArray = content -inline fun ByteArray.binarySearch(key: Byte) = Arrays.binarySearch(this, key) -inline fun ShortArray.binarySearch(key: Short) = Arrays.binarySearch(this, key) -inline fun IntArray.binarySearch(key: Int) = Arrays.binarySearch(this, key) -inline fun LongArray.binarySearch(key: Long) = Arrays.binarySearch(this, key) -inline fun FloatArray.binarySearch(key: Float) = Arrays.binarySearch(this, key) -inline fun DoubleArray.binarySearch(key: Double) = Arrays.binarySearch(this, key) -inline fun CharArray.binarySearch(key: Char) = Arrays.binarySearch(this, key) +public inline fun ByteArray.binarySearch(key: Byte) : Int = Arrays.binarySearch(this, key) +public inline fun ShortArray.binarySearch(key: Short) : Int = Arrays.binarySearch(this, key) +public inline fun IntArray.binarySearch(key: Int) : Int = Arrays.binarySearch(this, key) +public inline fun LongArray.binarySearch(key: Long) : Int = Arrays.binarySearch(this, key) +public inline fun FloatArray.binarySearch(key: Float) : Int = Arrays.binarySearch(this, key) +public inline fun DoubleArray.binarySearch(key: Double) : Int = Arrays.binarySearch(this, key) +public inline fun CharArray.binarySearch(key: Char) : Int = Arrays.binarySearch(this, key) -inline fun ByteArray.binarySearch(fromIndex: Int, toIndex: Int, key: Byte) = Arrays.binarySearch(this, fromIndex, toIndex, key) -inline fun ShortArray.binarySearch(fromIndex: Int, toIndex: Int, key: Short) = Arrays.binarySearch(this, fromIndex, toIndex, key) -inline fun IntArray.binarySearch(fromIndex: Int, toIndex: Int, key: Int) = Arrays.binarySearch(this, fromIndex, toIndex, key) -inline fun LongArray.binarySearch(fromIndex: Int, toIndex: Int, key: Long) = Arrays.binarySearch(this, fromIndex, toIndex, key) -inline fun FloatArray.binarySearch(fromIndex: Int, toIndex: Int, key: Float) = Arrays.binarySearch(this, fromIndex, toIndex, key) -inline fun DoubleArray.binarySearch(fromIndex: Int, toIndex: Int, key: Double) = Arrays.binarySearch(this, fromIndex, toIndex, key) -inline fun CharArray.binarySearch(fromIndex: Int, toIndex: Int, key: Char) = Arrays.binarySearch(this, fromIndex, toIndex, key) +public inline fun ByteArray.binarySearch(fromIndex: Int, toIndex: Int, key: Byte) : Int = Arrays.binarySearch(this, fromIndex, toIndex, key) +public inline fun ShortArray.binarySearch(fromIndex: Int, toIndex: Int, key: Short) : Int = Arrays.binarySearch(this, fromIndex, toIndex, key) +public inline fun IntArray.binarySearch(fromIndex: Int, toIndex: Int, key: Int) : Int = Arrays.binarySearch(this, fromIndex, toIndex, key) +public inline fun LongArray.binarySearch(fromIndex: Int, toIndex: Int, key: Long) : Int = Arrays.binarySearch(this, fromIndex, toIndex, key) +public inline fun FloatArray.binarySearch(fromIndex: Int, toIndex: Int, key: Float) : Int = Arrays.binarySearch(this, fromIndex, toIndex, key) +public inline fun DoubleArray.binarySearch(fromIndex: Int, toIndex: Int, key: Double) : Int = Arrays.binarySearch(this, fromIndex, toIndex, key) +public inline fun CharArray.binarySearch(fromIndex: Int, toIndex: Int, key: Char) : Int = Arrays.binarySearch(this, fromIndex, toIndex, key) /* -inline fun Array.binarySearch(key: T, comparator: fun(T,T):Int) = Arrays.binarySearch(this, key, object: java.util.Comparator { - override fun compare(a: T, b: T) = comparator(a, b) +public inline fun Array.binarySearch(key: T, comparator: public fun(T,T):Int) = Arrays.binarySearch(this, key, object: java.util.Comparator { + public override fun compare(a: T, b: T) = comparator(a, b) - override fun equals(obj: Any?) = obj.identityEquals(this) + public override fun equals(obj: Any?) = obj.identityEquals(this) }) */ -inline fun BooleanArray.fill(value: Boolean) = Arrays.fill(this, value) -inline fun ByteArray.fill(value: Byte) = Arrays.fill(this, value) -inline fun ShortArray.fill(value: Short) = Arrays.fill(this, value) -inline fun IntArray.fill(value: Int) = Arrays.fill(this, value) -inline fun LongArray.fill(value: Long) = Arrays.fill(this, value) -inline fun FloatArray.fill(value: Float) = Arrays.fill(this, value) -inline fun DoubleArray.fill(value: Double) = Arrays.fill(this, value) -inline fun CharArray.fill(value: Char) = Arrays.fill(this, value) +public inline fun BooleanArray.fill(value: Boolean) : Unit = Arrays.fill(this, value) +public inline fun ByteArray.fill(value: Byte) : Unit = Arrays.fill(this, value) +public inline fun ShortArray.fill(value: Short) : Unit = Arrays.fill(this, value) +public inline fun IntArray.fill(value: Int) : Unit = Arrays.fill(this, value) +public inline fun LongArray.fill(value: Long) : Unit = Arrays.fill(this, value) +public inline fun FloatArray.fill(value: Float) : Unit = Arrays.fill(this, value) +public inline fun DoubleArray.fill(value: Double) : Unit = Arrays.fill(this, value) +public inline fun CharArray.fill(value: Char) : Unit = Arrays.fill(this, value) -inline fun Array.fill(value: T) = Arrays.fill(this as Array, value) +public inline fun Array.fill(value: T) : Unit = Arrays.fill(this as Array, value) -inline fun ByteArray.sort() = Arrays.sort(this) -inline fun ShortArray.sort() = Arrays.sort(this) -inline fun IntArray.sort() = Arrays.sort(this) -inline fun LongArray.sort() = Arrays.sort(this) -inline fun FloatArray.sort() = Arrays.sort(this) -inline fun DoubleArray.sort() = Arrays.sort(this) -inline fun CharArray.sort() = Arrays.sort(this) +public inline fun ByteArray.sort() : Unit = Arrays.sort(this) +public inline fun ShortArray.sort() : Unit = Arrays.sort(this) +public inline fun IntArray.sort() : Unit = Arrays.sort(this) +public inline fun LongArray.sort() : Unit = Arrays.sort(this) +public inline fun FloatArray.sort() : Unit = Arrays.sort(this) +public inline fun DoubleArray.sort() : Unit = Arrays.sort(this) +public inline fun CharArray.sort() : Unit = Arrays.sort(this) -inline fun ByteArray.sort(fromIndex: Int, toIndex: Int) = Arrays.sort(this, fromIndex, toIndex) -inline fun ShortArray.sort(fromIndex: Int, toIndex: Int) = Arrays.sort(this, fromIndex, toIndex) -inline fun IntArray.sort(fromIndex: Int, toIndex: Int) = Arrays.sort(this, fromIndex, toIndex) -inline fun LongArray.sort(fromIndex: Int, toIndex: Int) = Arrays.sort(this, fromIndex, toIndex) -inline fun FloatArray.sort(fromIndex: Int, toIndex: Int) = Arrays.sort(this, fromIndex, toIndex) -inline fun DoubleArray.sort(fromIndex: Int, toIndex: Int) = Arrays.sort(this, fromIndex, toIndex) -inline fun CharArray.sort(fromIndex: Int, toIndex: Int) = Arrays.sort(this, fromIndex, toIndex) +public inline fun ByteArray.sort(fromIndex: Int, toIndex: Int) : Unit = Arrays.sort(this, fromIndex, toIndex) +public inline fun ShortArray.sort(fromIndex: Int, toIndex: Int) : Unit = Arrays.sort(this, fromIndex, toIndex) +public inline fun IntArray.sort(fromIndex: Int, toIndex: Int) : Unit = Arrays.sort(this, fromIndex, toIndex) +public inline fun LongArray.sort(fromIndex: Int, toIndex: Int) : Unit = Arrays.sort(this, fromIndex, toIndex) +public inline fun FloatArray.sort(fromIndex: Int, toIndex: Int) : Unit = Arrays.sort(this, fromIndex, toIndex) +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) -inline fun BooleanArray.copyOf(newLength: Int = this.size) = Arrays.copyOf(this, newLength).sure() -inline fun ByteArray.copyOf(newLength: Int = this.size) = Arrays.copyOf(this, newLength).sure() -inline fun ShortArray.copyOf(newLength: Int = this.size) = Arrays.copyOf(this, newLength).sure() -inline fun IntArray.copyOf(newLength: Int = this.size) = Arrays.copyOf(this, newLength).sure() -inline fun LongArray.copyOf(newLength: Int = this.size) = Arrays.copyOf(this, newLength).sure() -inline fun FloatArray.copyOf(newLength: Int = this.size) = Arrays.copyOf(this, newLength).sure() -inline fun DoubleArray.copyOf(newLength: Int = this.size) = Arrays.copyOf(this, newLength).sure() -inline fun CharArray.copyOf(newLength: Int = this.size) = Arrays.copyOf(this, newLength).sure() +public inline fun BooleanArray.copyOf(newLength: Int = this.size) : BooleanArray = Arrays.copyOf(this, newLength).sure() +public inline fun ByteArray.copyOf(newLength: Int = this.size) : ByteArray = Arrays.copyOf(this, newLength).sure() +public inline fun ShortArray.copyOf(newLength: Int = this.size) : ShortArray = Arrays.copyOf(this, newLength).sure() +public inline fun IntArray.copyOf(newLength: Int = this.size) : IntArray = Arrays.copyOf(this, newLength).sure() +public inline fun LongArray.copyOf(newLength: Int = this.size) : LongArray = Arrays.copyOf(this, newLength).sure() +public inline fun FloatArray.copyOf(newLength: Int = this.size) : FloatArray = Arrays.copyOf(this, newLength).sure() +public inline fun DoubleArray.copyOf(newLength: Int = this.size) : DoubleArray = Arrays.copyOf(this, newLength).sure() +public inline fun CharArray.copyOf(newLength: Int = this.size) : CharArray = Arrays.copyOf(this, newLength).sure() -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 as Array, newLength) as Array -inline fun BooleanArray.copyOfRange(from: Int, to: Int) = Arrays.copyOfRange(this, from, to).sure() -inline fun ByteArray.copyOfRange(from: Int, to: Int) = Arrays.copyOfRange(this, from, to).sure() -inline fun ShortArray.copyOfRange(from: Int, to: Int) = Arrays.copyOfRange(this, from, to).sure() -inline fun IntArray.copyOfRange(from: Int, to: Int) = Arrays.copyOfRange(this, from, to).sure() -inline fun LongArray.copyOfRange(from: Int, to: Int) = Arrays.copyOfRange(this, from, to).sure() -inline fun FloatArray.copyOfRange(from: Int, to: Int) = Arrays.copyOfRange(this, from, to).sure() -inline fun DoubleArray.copyOfRange(from: Int, to: Int) = Arrays.copyOfRange(this, from, to).sure() -inline fun CharArray.copyOfRange(from: Int, to: Int) = Arrays.copyOfRange(this, from, to).sure() +public inline fun BooleanArray.copyOfRange(from: Int, to: Int) : BooleanArray = Arrays.copyOfRange(this, from, to).sure() +public inline fun ByteArray.copyOfRange(from: Int, to: Int) : ByteArray = Arrays.copyOfRange(this, from, to).sure() +public inline fun ShortArray.copyOfRange(from: Int, to: Int) : ShortArray = Arrays.copyOfRange(this, from, to).sure() +public inline fun IntArray.copyOfRange(from: Int, to: Int) : IntArray = Arrays.copyOfRange(this, from, to).sure() +public inline fun LongArray.copyOfRange(from: Int, to: Int) : LongArray = Arrays.copyOfRange(this, from, to).sure() +public inline fun FloatArray.copyOfRange(from: Int, to: Int) : FloatArray = Arrays.copyOfRange(this, from, to).sure() +public inline fun DoubleArray.copyOfRange(from: Int, to: Int) : DoubleArray = Arrays.copyOfRange(this, from, to).sure() +public inline fun CharArray.copyOfRange(from: Int, to: Int) : CharArray = Arrays.copyOfRange(this, from, to).sure() -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 as Array, from, to) as Array inline val ByteArray.inputStream : ByteArrayInputStream get() = ByteArrayInputStream(this) -inline fun ByteArray.inputStream(offset: Int, length: Int) = ByteArrayInputStream(this, offset, length) +public inline fun ByteArray.inputStream(offset: Int, length: Int) : ByteArrayInputStream = ByteArrayInputStream(this, offset, length) -inline fun ByteArray.toString(encoding: String?): String { +public inline fun ByteArray.toString(encoding: String?): String { if (encoding != null) { return String(this, encoding) } else { @@ -112,18 +112,18 @@ inline fun ByteArray.toString(encoding: String?): String { } } -inline fun ByteArray.toString(encoding: Charset) = String(this, encoding) +public inline fun ByteArray.toString(encoding: Charset) : String = String(this, encoding) /** Returns true if the array is not empty */ -inline fun Array.notEmpty() : Boolean = !this.isEmpty() +public inline fun Array.notEmpty() : Boolean = !this.isEmpty() /** Returns true if the array is empty */ -inline fun Array.isEmpty() : Boolean = this.size == 0 +public inline fun Array.isEmpty() : Boolean = this.size == 0 /** Returns the array if its not null or else returns an empty array */ -inline fun Array?.orEmpty() : Array = if (this != null) this else array() +public inline fun Array?.orEmpty() : Array = if (this != null) this else array() -inline fun CharArray.toList(): List { +public inline fun CharArray.toList(): List { val list = ArrayList(this.size) for (c in this) { if (c != null) { diff --git a/libraries/stdlib/src/kotlin/Integers.kt b/libraries/stdlib/src/kotlin/Integers.kt index dd8af8e21be..4637bcaa201 100644 --- a/libraries/stdlib/src/kotlin/Integers.kt +++ b/libraries/stdlib/src/kotlin/Integers.kt @@ -1,6 +1,6 @@ package kotlin -inline fun Int.times(body : () -> Unit) { +public inline fun Int.times(body : () -> Unit) { var count = this; while (count > 0) { body() diff --git a/libraries/stdlib/src/kotlin/JLang.kt b/libraries/stdlib/src/kotlin/JLang.kt index 83212bc03e6..24201d0e005 100644 --- a/libraries/stdlib/src/kotlin/JLang.kt +++ b/libraries/stdlib/src/kotlin/JLang.kt @@ -5,7 +5,7 @@ import java.lang.Object import jet.runtime.Intrinsic -val T.javaClass : Class +public val T.javaClass : Class [Intrinsic("kotlin.javaClass.property")] get() = (this as java.lang.Object).getClass() as Class [Intrinsic("kotlin.javaClass.function")] fun javaClass() : Class = null as Class diff --git a/libraries/stdlib/src/kotlin/JUMaps.kt b/libraries/stdlib/src/kotlin/JUMaps.kt index 079b87a3278..7c755212b19 100644 --- a/libraries/stdlib/src/kotlin/JUMaps.kt +++ b/libraries/stdlib/src/kotlin/JUMaps.kt @@ -11,18 +11,18 @@ import java.util.Collections /** Returns the size of the map */ val JMap<*,*>.size : Int - get() = size() +get() = size() /** Returns true if this map is empty */ val JMap<*,*>.empty : Boolean - get() = isEmpty() +get() = isEmpty() /** Provides [] access to maps */ -fun JMap.set(key : K, value : V) = this.put(key, value) +public fun JMap.set(key : K, value : V) : V? = this.put(key, value) /** Returns the [[Map]] if its not null otherwise it returns the empty [[Map]] */ -inline fun java.util.Map?.orEmpty() : java.util.Map - = if (this != null) this else Collections.EMPTY_MAP as java.util.Map +public inline fun java.util.Map?.orEmpty() : java.util.Map += if (this != null) this else Collections.EMPTY_MAP as java.util.Map /** Returns the key of the entry */ @@ -40,13 +40,13 @@ inline fun java.util.Map?.orEmpty() : java.util.Map * * @includeFunction ../../test/MapTest.kt getOrElse */ -inline fun java.util.Map.getOrElse(key: K, defaultValue: ()-> V) : V { - val current = this.get(key) - if (current != null) { - return current - } else { - return defaultValue() - } +public inline fun java.util.Map.getOrElse(key: K, defaultValue: ()-> V) : V { + val current = this.get(key) + if (current != null) { + return current + } else { + return defaultValue() + } } /** @@ -54,13 +54,13 @@ inline fun java.util.Map.getOrElse(key: K, defaultValue: ()-> V) : V * * @includeFunction ../../test/MapTest.kt getOrElse */ -inline fun java.util.Map.getOrPut(key: K, defaultValue: ()-> V) : V { - val current = this.get(key) - if (current != null) { - return current - } else { - val answer = defaultValue() - this.put(key, answer) - return answer - } +public inline fun java.util.Map.getOrPut(key: K, defaultValue: ()-> V) : V { + val current = this.get(key) + if (current != null) { + return current + } else { + val answer = defaultValue() + this.put(key, answer) + return answer + } } diff --git a/libraries/stdlib/src/kotlin/JUtil.kt b/libraries/stdlib/src/kotlin/JUtil.kt index bb9798f7b52..59b69ef4ce9 100644 --- a/libraries/stdlib/src/kotlin/JUtil.kt +++ b/libraries/stdlib/src/kotlin/JUtil.kt @@ -12,26 +12,26 @@ val Collection<*>.empty : Boolean get() = isEmpty() /** Returns a new ArrayList with a variable number of initial elements */ -inline fun arrayList(vararg values: T) : ArrayList = values.to(ArrayList(values.size)) +public inline fun arrayList(vararg values: T) : ArrayList = values.to(ArrayList(values.size)) /** Returns a new LinkedList with a variable number of initial elements */ -inline fun linkedList(vararg values: T) : LinkedList = values.to(LinkedList()) +public inline fun linkedList(vararg values: T) : LinkedList = values.to(LinkedList()) /** Returns a new HashSet with a variable number of initial elements */ -inline fun hashSet(vararg values: T) : HashSet = values.to(HashSet(values.size)) +public inline fun hashSet(vararg values: T) : HashSet = values.to(HashSet(values.size)) /** Returns a new SortedSet with a variable number of initial elements */ -inline fun sortedSet(vararg values: T) : TreeSet = values.to(TreeSet()) +public inline fun sortedSet(vararg values: T) : TreeSet = values.to(TreeSet()) -inline fun hashMap(): HashMap = HashMap() +public inline fun hashMap(): HashMap = HashMap() -inline fun sortedMap(): SortedMap = TreeMap() +public inline fun sortedMap(): SortedMap = TreeMap() val Collection<*>.indices : IntRange get() = 0..size-1 -inline fun java.util.Collection.toArray() : Array { +public inline fun java.util.Collection.toArray() : Array { val answer = Array(this.size) var idx = 0 for (elem in this) @@ -40,37 +40,37 @@ inline fun java.util.Collection.toArray() : Array { } /** TODO these functions don't work when they generate the Array versions when they are in JavaIterables */ -inline fun > java.lang.Iterable.toSortedList() : List = toList().sort() +public inline fun > java.lang.Iterable.toSortedList() : List = toList().sort() -inline fun > java.lang.Iterable.toSortedList(comparator: java.util.Comparator) : List = toList().sort(comparator) +public inline fun > java.lang.Iterable.toSortedList(comparator: java.util.Comparator) : List = toList().sort(comparator) // List APIs -inline fun > List.sort() : List { +public inline fun > List.sort() : List { Collections.sort(this) return this } -inline fun List.sort(comparator: java.util.Comparator) : List { +public inline fun List.sort(comparator: java.util.Comparator) : List { Collections.sort(this, comparator) return this } /** Returns the List if its not null otherwise returns the empty list */ -inline fun java.util.List?.orEmpty() : java.util.List +public inline fun java.util.List?.orEmpty() : java.util.List = if (this != null) this else Collections.EMPTY_LIST as java.util.List /** Returns the Set if its not null otherwise returns the empty set */ -inline fun java.util.Set?.orEmpty() : java.util.Set +public inline fun java.util.Set?.orEmpty() : java.util.Set = if (this != null) this else Collections.EMPTY_SET as java.util.Set /** TODO figure out necessary variance/generics ninja stuff... :) -inline fun List.sort(transform: fun(T) : java.lang.Comparable<*>) : List { +public inline fun List.sort(transform: fun(T) : java.lang.Comparable<*>) : List { val comparator = java.util.Comparator() { - fun compare(o1: T, o2: T): Int { + public fun compare(o1: T, o2: T): Int { val v1 = transform(o1) val v2 = transform(o2) if (v1 == v2) { @@ -101,9 +101,9 @@ val List.last : T? /** Returns true if the collection is not empty */ -inline fun java.util.Collection.notEmpty() : Boolean = !this.isEmpty() +public inline fun java.util.Collection.notEmpty() : Boolean = !this.isEmpty() /** Returns the Collection if its not null otherwise it returns the empty list */ -inline fun java.util.Collection?.orEmpty() : Collection +public inline fun java.util.Collection?.orEmpty() : Collection = if (this != null) this else Collections.EMPTY_LIST as Collection diff --git a/libraries/stdlib/src/kotlin/JavaCollections.kt b/libraries/stdlib/src/kotlin/JavaCollections.kt index 8f31dd5c165..69f4de8c163 100644 --- a/libraries/stdlib/src/kotlin/JavaCollections.kt +++ b/libraries/stdlib/src/kotlin/JavaCollections.kt @@ -14,12 +14,12 @@ import java.util.* * * @includeFunction ../../test/CollectionTest.kt map */ -inline fun java.util.Collection.map(transform : (T) -> R) : java.util.List { +public inline fun java.util.Collection.map(transform : (T) -> R) : java.util.List { return mapTo(java.util.ArrayList(this.size), transform) } /** Transforms each element of this collection with the given function then adds the results to the given collection */ -inline fun > java.util.Collection.mapTo(result: C, transform : (T) -> R) : C { +public inline fun > java.util.Collection.mapTo(result: C, transform : (T) -> R) : C { for (item in this) result.add(transform(item)) return result diff --git a/libraries/stdlib/src/kotlin/JavaIterablesSpecial.kt b/libraries/stdlib/src/kotlin/JavaIterablesSpecial.kt index 71a10cf31e4..245e1551324 100644 --- a/libraries/stdlib/src/kotlin/JavaIterablesSpecial.kt +++ b/libraries/stdlib/src/kotlin/JavaIterablesSpecial.kt @@ -12,7 +12,7 @@ import java.util.Iterator * If base collection implements [[Collection]] interface method [[Collection.size()]] will be used. * Otherwise, this method determines the count by iterating through the all items. */ -fun java.lang.Iterable.count() : Int { +public fun java.lang.Iterable.count() : Int { if (this is Collection) { return this.size() } @@ -30,7 +30,7 @@ fun java.lang.Iterable.count() : Int { * Will throw an exception if there are no elements */ // TODO: Specify type of the exception -inline fun java.lang.Iterable.first() : T { +public inline fun java.lang.Iterable.first() : T { if (this is AbstractList) { return this.get(0) } @@ -50,7 +50,7 @@ inline fun java.lang.Iterable.first() : T { * @includeFunction ../../test/CollectionTest.kt last */ // TODO: Specify type of the exception -fun java.lang.Iterable.last() : T { +public fun java.lang.Iterable.last() : T { if (this is List) { return this.get(this.size() - 1); } @@ -72,7 +72,7 @@ fun java.lang.Iterable.last() : T { * If collection implements [[java.util.AbstractCollection]] an overridden implementation of the contains * method will be used. */ -fun java.lang.Iterable.contains(item : T) : Boolean { +public fun java.lang.Iterable.contains(item : T) : Boolean { if (this is java.util.AbstractCollection) { return this.contains(item); } @@ -89,9 +89,9 @@ fun java.lang.Iterable.contains(item : T) : Boolean { /** * Convert collection of arbitrary elements to collection of tuples of the index and the element */ -fun java.lang.Iterable.withIndices() : java.lang.Iterable<#(Int, T)> { +public fun java.lang.Iterable.withIndices() : java.lang.Iterable<#(Int, T)> { return object : java.lang.Iterable<#(Int, T)> { - override fun iterator(): java.util.Iterator<#(Int, T)> { + public override fun iterator(): java.util.Iterator<#(Int, T)> { // TODO explicit typecast as a workaround for KT-1457, should be removed when it is fixed return NumberedIterator(this@withIndices.iterator().sure()) as java.util.Iterator<#(Int, T)> } @@ -101,7 +101,7 @@ fun java.lang.Iterable.withIndices() : java.lang.Iterable<#(Int, T)> { private class NumberedIterator(private val sourceIterator : java.util.Iterator) : java.util.Iterator<#(Int, TT)> { private var nextIndex = 0 - override fun remove() { + public override fun remove() { try { sourceIterator.remove() nextIndex--; @@ -110,11 +110,11 @@ private class NumberedIterator(private val sourceIterator : java.util.Iterat } } - override fun hasNext(): Boolean { + public override fun hasNext(): Boolean { return sourceIterator.hasNext(); } - override fun next(): #(Int, TT) { + public override fun next(): #(Int, TT) { val result = #(nextIndex, sourceIterator.next()) nextIndex++ return result diff --git a/libraries/stdlib/src/kotlin/Ordering.kt b/libraries/stdlib/src/kotlin/Ordering.kt index 137e8e6d581..eec34219129 100644 --- a/libraries/stdlib/src/kotlin/Ordering.kt +++ b/libraries/stdlib/src/kotlin/Ordering.kt @@ -25,7 +25,7 @@ inline fun compareBy(a: T?, b: T?, vararg functions: Function1): In * they are compared via [[#equals()]] and if they are not the same then * the [[#hashCode()]] method is used as the difference */ -inline fun compareValues(a: T?, b: T?): Int { +public inline fun compareValues(a: T?, b: T?): Int { if (a == null) return - 1 if (b == null) return 1 if (a is Comparable) { @@ -44,23 +44,23 @@ inline fun compareValues(a: T?, b: T?): Int { } /** - * Creates a comparator using the sequence of functions used to calcualte a value to compare on + * Creates a comparator using the sequence of functions used to calculate a value to compare on */ -inline fun comparator(vararg functions: Function1): Comparator { +public inline fun comparator(vararg functions: Function1): Comparator { return FunctionComparator(functions) } private class FunctionComparator(val functions: Array>): Comparator { - fun toString(): String { + public fun toString(): String { return "FunctionComparator${functions.toList()}" } - override fun compare(o1: T?, o2: T?): Int { + public override fun compare(o1: T?, o2: T?): Int { return compareBy(o1, o2, *functions) } - override fun equals(obj: Any?): Boolean { + public override fun equals(obj: Any?): Boolean { return this == obj } } \ No newline at end of file diff --git a/libraries/stdlib/src/kotlin/Preconditions.kt b/libraries/stdlib/src/kotlin/Preconditions.kt index a287a8ddc2b..832244e16ad 100644 --- a/libraries/stdlib/src/kotlin/Preconditions.kt +++ b/libraries/stdlib/src/kotlin/Preconditions.kt @@ -9,7 +9,7 @@ object Assertions { * Throws an [[AssertionError]] if the `value` is false and runtime assertions have been * enabled on the JVM using the `-ea` JVM option. */ -inline fun assert(value: Boolean): Unit { +public inline fun assert(value: Boolean): Unit { if(Assertions._ENABLED) { if(!value) { throw AssertionError(); @@ -21,7 +21,7 @@ inline fun assert(value: Boolean): Unit { * Throws an [[AssertionError]] with specified `message` if the `value` is false * and runtime assertions have been enabled on the JVM using the `-ea` JVM option. */ -inline fun assert(value: Boolean, message: Any) { +public inline fun assert(value: Boolean, message: Any) { if(Assertions._ENABLED) { if(!value) { throw AssertionError(message); @@ -33,7 +33,7 @@ inline fun assert(value: Boolean, message: Any) { * Throws an [[AssertionError]] with specified `message` if the `value` is false * and runtime assertions have been enabled on the JVM using the `-ea` JVM option. */ -inline fun assert(value: Boolean, lazyMessage: () -> String) { +public inline fun assert(value: Boolean, lazyMessage: () -> String) { if(Assertions._ENABLED) { if(!value) { val message = lazyMessage() @@ -45,7 +45,7 @@ inline fun assert(value: Boolean, lazyMessage: () -> String) { /** * Throws an [[IllegalArgumentException]] if the `value` is false. */ -inline fun require(value: Boolean): Unit { +public inline fun require(value: Boolean): Unit { if(!value) { throw IllegalArgumentException(); } @@ -54,7 +54,7 @@ inline fun require(value: Boolean): Unit { /** * Throws an [[IllegalArgumentException]] with specified `message` if the `value` is false. */ -inline fun require(value: Boolean, message: Any): Unit { +public inline fun require(value: Boolean, message: Any): Unit { if(!value) { throw IllegalArgumentException(message.toString()); } @@ -63,7 +63,7 @@ inline fun require(value: Boolean, message: Any): Unit { /** * Throws an [[IllegalArgumentException]] with specified `message` if the `value` is false. */ -inline fun require(value: Boolean, lazyMessage: () -> String): Unit { +public inline fun require(value: Boolean, lazyMessage: () -> String): Unit { if(!value) { val message = lazyMessage() throw IllegalArgumentException(message.toString()); @@ -73,7 +73,7 @@ inline fun require(value: Boolean, lazyMessage: () -> String): Unit { /** * Throws an [[IllegalStateException]] if the `value` is false. */ -inline fun check(value: Boolean): Unit { +public inline fun check(value: Boolean): Unit { if(!value) { throw IllegalStateException(); } @@ -82,7 +82,7 @@ inline fun check(value: Boolean): Unit { /** * Throws an [[IllegalStateException]] with specified `message` if the `value` is false. */ -inline fun check(value: Boolean, message: Any): Unit { +public inline fun check(value: Boolean, message: Any): Unit { if(!value) { throw IllegalStateException(message.toString()); } @@ -93,7 +93,7 @@ inline fun check(value: Boolean, message: Any): Unit { /** * Throws an [[IllegalStateException]] with specified `message` if the `value` is false. */ -inline fun check(value: Boolean, lazyMessage: () -> String): Unit { +public inline fun check(value: Boolean, lazyMessage: () -> String): Unit { if(!value) { val message = lazyMessage() throw IllegalStateException(message.toString()); diff --git a/libraries/stdlib/src/kotlin/Standard.kt b/libraries/stdlib/src/kotlin/Standard.kt index 22915330b50..266766d554c 100644 --- a/libraries/stdlib/src/kotlin/Standard.kt +++ b/libraries/stdlib/src/kotlin/Standard.kt @@ -10,21 +10,21 @@ import java.util.TreeSet /** Helper to make jet.Iterator usable in for */ -inline fun Iterator.iterator() = this +public inline fun Iterator.iterator() : Iterator = this /** Helper to make java.util.Iterator usable in for */ -inline fun java.util.Iterator.iterator() = this +public inline fun java.util.Iterator.iterator() : java.util.Iterator = this /** Helper to make java.util.Enumeration usable in for */ -fun java.util.Enumeration.iterator(): Iterator = object: Iterator { - override val hasNext: Boolean +public fun java.util.Enumeration.iterator(): Iterator = object: Iterator { + override val hasNext: Boolean get() = hasMoreElements() - override fun next() = nextElement().sure() + public override fun next() : T = nextElement().sure() } /* @@ -34,7 +34,7 @@ fun java.util.Enumeration.iterator(): Iterator = object: Iterat /** Add iterated elements to given container */ -fun > Iterator.to(container: U) : U { +public fun > Iterator.to(container: U) : U { while(hasNext) container.add(next()) return container @@ -43,29 +43,29 @@ fun > Iterator.to(container: U) : U { /** Add iterated elements to java.util.ArrayList */ -inline fun Iterator.toArrayList() = to(ArrayList()) +public inline fun Iterator.toArrayList() : ArrayList = to(ArrayList()) /** Add iterated elements to java.util.LinkedList */ -inline fun Iterator.toLinkedList() = to(LinkedList()) +public inline fun Iterator.toLinkedList() : LinkedList = to(LinkedList()) /** Add iterated elements to java.util.HashSet */ -inline fun Iterator.toHashSet() = to(HashSet()) +public inline fun Iterator.toHashSet() : HashSet = to(HashSet()) /** Add iterated elements to java.util.LinkedHashSet */ -inline fun Iterator.toLinkedHashSet() = to(LinkedHashSet()) +public inline fun Iterator.toLinkedHashSet() : LinkedHashSet = to(LinkedHashSet()) /** Add iterated elements to java.util.TreeSet */ -inline fun Iterator.toTreeSet() = to(TreeSet()) +public inline fun Iterator.toTreeSet() : TreeSet = to(TreeSet()) /** Run function f */ -inline fun run(f: () -> T) = f() +public inline fun run(f: () -> T) : T = f() diff --git a/libraries/stdlib/src/kotlin/Strings.kt b/libraries/stdlib/src/kotlin/Strings.kt index 2e678dc9d0f..ac37bd5be84 100644 --- a/libraries/stdlib/src/kotlin/Strings.kt +++ b/libraries/stdlib/src/kotlin/Strings.kt @@ -4,30 +4,30 @@ import java.io.StringReader import java.util.List import java.util.ArrayList -inline fun String.lastIndexOf(str: String) = (this as java.lang.String).lastIndexOf(str) +public inline fun String.lastIndexOf(str: String) : Int = (this as java.lang.String).lastIndexOf(str) -inline fun String.lastIndexOf(ch: Char) = (this as java.lang.String).lastIndexOf(ch.toString()) +public inline fun String.lastIndexOf(ch: Char) : Int = (this as java.lang.String).lastIndexOf(ch.toString()) -inline fun String.equalsIgnoreCase(anotherString: String) = (this as java.lang.String).equalsIgnoreCase(anotherString) +public inline fun String.equalsIgnoreCase(anotherString: String) : Boolean = (this as java.lang.String).equalsIgnoreCase(anotherString) -inline fun String.indexOf(str : String) = (this as java.lang.String).indexOf(str) +public inline fun String.indexOf(str : String) : Int = (this as java.lang.String).indexOf(str) -inline fun String.indexOf(str : String, fromIndex : Int) = (this as java.lang.String).indexOf(str, fromIndex) +public inline fun String.indexOf(str : String, fromIndex : Int) : Int = (this as java.lang.String).indexOf(str, fromIndex) -inline fun String.replace(oldChar: Char, newChar : Char) = (this as java.lang.String).replace(oldChar, newChar).sure() +public inline fun String.replace(oldChar: Char, newChar : Char) : String = (this as java.lang.String).replace(oldChar, newChar).sure() -inline fun String.replaceAll(regex: String, replacement : String) = (this as java.lang.String).replaceAll(regex, replacement).sure() +public inline fun String.replaceAll(regex: String, replacement : String) : String = (this as java.lang.String).replaceAll(regex, replacement).sure() -inline fun String.trim() = (this as java.lang.String).trim().sure() +public inline fun String.trim() : String = (this as java.lang.String).trim().sure() /** Returns the string with leading and trailing text matching the given string removed */ -inline fun String.trim(text: String) = trimLeading(text).trimTrailing(text) +public inline fun String.trim(text: String) : String = trimLeading(text).trimTrailing(text) /** Returns the string with the prefix and postfix text trimmed */ -inline fun String.trim(prefix: String, postfix: String) = trimLeading(prefix).trimTrailing(postfix) +public inline fun String.trim(prefix: String, postfix: String) : String = trimLeading(prefix).trimTrailing(postfix) /** Returns the string with the leading prefix of this string removed */ -inline fun String.trimLeading(prefix: String): String { +public inline fun String.trimLeading(prefix: String): String { var answer = this if (answer.startsWith(prefix)) { answer = answer.substring(prefix.length()) @@ -36,7 +36,7 @@ inline fun String.trimLeading(prefix: String): String { } /** Returns the string with the trailing postfix of this string removed */ -inline fun String.trimTrailing(postfix: String): String { +public inline fun String.trimTrailing(postfix: String): String { var answer = this if (answer.endsWith(postfix)) { answer = answer.substring(0, length() - postfix.length()) @@ -44,33 +44,33 @@ inline fun String.trimTrailing(postfix: String): String { return answer } -inline fun String.toUpperCase() = (this as java.lang.String).toUpperCase().sure() +public inline fun String.toUpperCase() : String = (this as java.lang.String).toUpperCase().sure() -inline fun String.toLowerCase() = (this as java.lang.String).toLowerCase().sure() +public inline fun String.toLowerCase() : String = (this as java.lang.String).toLowerCase().sure() -inline fun String.length() = (this as java.lang.String).length() +public inline fun String.length() : Int = (this as java.lang.String).length() -inline fun String.getBytes() = (this as java.lang.String).getBytes().sure() +public inline fun String.getBytes() : ByteArray = (this as java.lang.String).getBytes().sure() -inline fun String.toCharArray() = (this as java.lang.String).toCharArray().sure() +public inline fun String.toCharArray() : CharArray = (this as java.lang.String).toCharArray().sure() -inline fun String.toCharList(): List = toCharArray().toList() +public inline fun String.toCharList(): List = toCharArray().toList() -inline fun String.format(format : String, vararg args : Any?) = java.lang.String.format(format, args).sure() +public inline fun String.format(format : String, vararg args : Any?) : String = java.lang.String.format(format, args).sure() -inline fun String.split(regex : String) = (this as java.lang.String).split(regex) +public inline fun String.split(regex : String) : Array? = (this as java.lang.String).split(regex) -inline fun String.substring(beginIndex : Int) = (this as java.lang.String).substring(beginIndex).sure() +public inline fun String.substring(beginIndex : Int) : String = (this as java.lang.String).substring(beginIndex).sure() -inline fun String.substring(beginIndex : Int, endIndex : Int) = (this as java.lang.String).substring(beginIndex, endIndex).sure() +public inline fun String.substring(beginIndex : Int, endIndex : Int) : String = (this as java.lang.String).substring(beginIndex, endIndex).sure() -inline fun String.startsWith(prefix: String) = (this as java.lang.String).startsWith(prefix) +public inline fun String.startsWith(prefix: String) : Boolean = (this as java.lang.String).startsWith(prefix) -inline fun String.startsWith(prefix: String, toffset: Int) = (this as java.lang.String).startsWith(prefix, toffset) +public inline fun String.startsWith(prefix: String, toffset: Int) : Boolean = (this as java.lang.String).startsWith(prefix, toffset) -inline fun String.contains(seq: CharSequence) : Boolean = (this as java.lang.String).contains(seq) +public inline fun String.contains(seq: CharSequence) : Boolean = (this as java.lang.String).contains(seq) -inline fun String.endsWith(suffix: String) : Boolean = (this as java.lang.String).endsWith(suffix) +public inline fun String.endsWith(suffix: String) : Boolean = (this as java.lang.String).endsWith(suffix) inline val String.size : Int get() = length() @@ -80,135 +80,135 @@ get() = StringReader(this) // "constructors" for String -inline fun String(bytes : ByteArray, offset : Int, length : Int, charsetName : String) = java.lang.String(bytes, offset, length, charsetName) as String +public inline fun String(bytes : ByteArray, offset : Int, length : Int, charsetName : String) : String = java.lang.String(bytes, offset, length, charsetName) as String -inline fun String(bytes : ByteArray, offset : Int, length : Int, charset : java.nio.charset.Charset) = java.lang.String(bytes, offset, length, charset) as String +public inline fun String(bytes : ByteArray, offset : Int, length : Int, charset : java.nio.charset.Charset) : String = java.lang.String(bytes, offset, length, charset) as String -inline fun String(bytes : ByteArray, charsetName : String?) = java.lang.String(bytes, charsetName) as String +public inline fun String(bytes : ByteArray, charsetName : String?) : String = java.lang.String(bytes, charsetName) as String -inline fun String(bytes : ByteArray, charset : java.nio.charset.Charset) = java.lang.String(bytes, charset) as String +public inline fun String(bytes : ByteArray, charset : java.nio.charset.Charset) : String = java.lang.String(bytes, charset) as String -inline fun String(bytes : ByteArray, i : Int, i1 : Int) = java.lang.String(bytes, i, i1) as String +public inline fun String(bytes : ByteArray, i : Int, i1 : Int) : String = java.lang.String(bytes, i, i1) as String -inline fun String(bytes : ByteArray) = java.lang.String(bytes) as String +public inline fun String(bytes : ByteArray) : String = java.lang.String(bytes) as String -inline fun String(chars : CharArray) = java.lang.String(chars) as String +public inline fun String(chars : CharArray) : String = java.lang.String(chars) as String -inline fun String(stringBuffer : java.lang.StringBuffer) = java.lang.String(stringBuffer) as String +public inline fun String(stringBuffer : java.lang.StringBuffer) : String = java.lang.String(stringBuffer) as String -inline fun String(stringBuilder : java.lang.StringBuilder) = java.lang.String(stringBuilder) as String +public inline fun String(stringBuilder : java.lang.StringBuilder) : String = java.lang.String(stringBuilder) as String /** Returns true if the string is not null and not empty */ -inline fun String?.notEmpty() : Boolean = this != null && this.length() > 0 +public inline fun String?.notEmpty() : Boolean = this != null && this.length() > 0 -inline fun String.toByteArray(encoding: String?=null):ByteArray { +public inline fun String.toByteArray(encoding: String?=null):ByteArray { if(encoding==null) { return (this as java.lang.String).getBytes().sure() } else { return (this as java.lang.String).getBytes(encoding).sure() } } -inline fun String.toByteArray(encoding: java.nio.charset.Charset):ByteArray = (this as java.lang.String).getBytes(encoding).sure() +public inline fun String.toByteArray(encoding: java.nio.charset.Charset):ByteArray = (this as java.lang.String).getBytes(encoding).sure() -inline fun String.toBoolean() = java.lang.Boolean.parseBoolean(this).sure() -inline fun String.toShort() = java.lang.Short.parseShort(this).sure() -inline fun String.toInt() = java.lang.Integer.parseInt(this).sure() -inline fun String.toLong() = java.lang.Long.parseLong(this).sure() -inline fun String.toFloat() = java.lang.Float.parseFloat(this).sure() -inline fun String.toDouble() = java.lang.Double.parseDouble(this).sure() +public inline fun String.toBoolean() : Boolean = java.lang.Boolean.parseBoolean(this).sure() +public inline fun String.toShort() : Short = java.lang.Short.parseShort(this).sure() +public inline fun String.toInt() : Int = java.lang.Integer.parseInt(this).sure() +public inline fun String.toLong() : Long = java.lang.Long.parseLong(this).sure() +public inline fun String.toFloat() : Float = java.lang.Float.parseFloat(this).sure() +public inline fun String.toDouble() : Double = java.lang.Double.parseDouble(this).sure() /** * Converts the string into a regular expression [[Pattern]] optionally * with the specified flags from [[Pattern]] or'd together * so that strings can be split or matched on. */ -inline fun String.toRegex(flags: Int=0): java.util.regex.Pattern { +public inline fun String.toRegex(flags: Int=0): java.util.regex.Pattern { return java.util.regex.Pattern.compile(this, flags).sure() } /** Iterator for characters of given CharSequence */ -inline fun CharSequence.iterator() : CharIterator = object: jet.CharIterator() { - private var index = 0 +public inline fun CharSequence.iterator() : CharIterator = object: jet.CharIterator() { + private var index = 0 - public override fun nextChar(): Char = get(index++) + public override fun nextChar(): Char = get(index++) - public override val hasNext: Boolean - get() = index < length + public override val hasNext: Boolean + get() = index < length } -inline fun String.replaceFirst(regex : String, replacement : String) = (this as java.lang.String).replaceFirst(regex, replacement).sure() +public inline fun String.replaceFirst(regex : String, replacement : String) : String = (this as java.lang.String).replaceFirst(regex, replacement).sure() -inline fun String.charAt(index : Int) = (this as java.lang.String).charAt(index).sure() +public inline fun String.charAt(index : Int) : Char = (this as java.lang.String).charAt(index).sure() -inline fun String.split(regex : String, limit : Int) = (this as java.lang.String).split(regex, limit).sure() +public inline fun String.split(regex : String, limit : Int) : Array = (this as java.lang.String).split(regex, limit).sure() -inline fun String.codePointAt(index : Int) = (this as java.lang.String).codePointAt(index).sure() +public inline fun String.codePointAt(index : Int) : Int = (this as java.lang.String).codePointAt(index).sure() -inline fun String.codePointBefore(index : Int) = (this as java.lang.String).codePointBefore(index).sure() +public inline fun String.codePointBefore(index : Int) : Int = (this as java.lang.String).codePointBefore(index).sure() -inline fun String.codePointCount(beginIndex : Int, endIndex : Int) = (this as java.lang.String).codePointCount(beginIndex, endIndex) +public inline fun String.codePointCount(beginIndex : Int, endIndex : Int) : Int = (this as java.lang.String).codePointCount(beginIndex, endIndex) -inline fun String.compareToIgnoreCase(str : String) = (this as java.lang.String).compareToIgnoreCase(str).sure() +public inline fun String.compareToIgnoreCase(str : String) : Int = (this as java.lang.String).compareToIgnoreCase(str).sure() -inline fun String.concat(str : String) = (this as java.lang.String).concat(str).sure() +public inline fun String.concat(str : String) : String = (this as java.lang.String).concat(str).sure() -inline fun String.contentEquals(cs : CharSequence) = (this as java.lang.String).contentEquals(cs).sure() +public inline fun String.contentEquals(cs : CharSequence) : Boolean = (this as java.lang.String).contentEquals(cs).sure() -inline fun String.contentEquals(sb : StringBuffer) = (this as java.lang.String).contentEquals(sb).sure() +public inline fun String.contentEquals(sb : StringBuffer) : Boolean = (this as java.lang.String).contentEquals(sb).sure() -inline fun String.getBytes(charset : java.nio.charset.Charset) = (this as java.lang.String).getBytes(charset).sure() +public inline fun String.getBytes(charset : java.nio.charset.Charset) : ByteArray = (this as java.lang.String).getBytes(charset).sure() -inline fun String.getBytes(charsetName : String) = (this as java.lang.String).getBytes(charsetName).sure() +public inline fun String.getBytes(charsetName : String) : ByteArray = (this as java.lang.String).getBytes(charsetName).sure() -inline fun String.getChars(srcBegin : Int, srcEnd : Int, dst : CharArray, dstBegin : Int) = (this as java.lang.String).getChars(srcBegin, srcEnd, dst, dstBegin).sure() +public inline fun String.getChars(srcBegin : Int, srcEnd : Int, dst : CharArray, dstBegin : Int) : Tuple0 = (this as java.lang.String).getChars(srcBegin, srcEnd, dst, dstBegin).sure() -inline fun String.indexOf(ch : Char) = (this as java.lang.String).indexOf(ch.toString()).sure() +public inline fun String.indexOf(ch : Char) : Int = (this as java.lang.String).indexOf(ch.toString()).sure() -inline fun String.indexOf(ch : Char, fromIndex : Int) = (this as java.lang.String).indexOf(ch.toString(), fromIndex).sure() +public inline fun String.indexOf(ch : Char, fromIndex : Int) : Int = (this as java.lang.String).indexOf(ch.toString(), fromIndex).sure() -inline fun String.intern() = (this as java.lang.String).intern().sure() +public inline fun String.intern() : String = (this as java.lang.String).intern().sure() -inline fun String.isEmpty() = (this as java.lang.String).isEmpty().sure() +public inline fun String.isEmpty() : Boolean = (this as java.lang.String).isEmpty().sure() -inline fun String.lastIndexOf(ch : Char, fromIndex : Int) = (this as java.lang.String).lastIndexOf(ch.toString(), fromIndex).sure() +public inline fun String.lastIndexOf(ch : Char, fromIndex : Int) : Int = (this as java.lang.String).lastIndexOf(ch.toString(), fromIndex).sure() -inline fun String.lastIndexOf(str : String, fromIndex : Int) = (this as java.lang.String).lastIndexOf(str, fromIndex).sure() +public inline fun String.lastIndexOf(str : String, fromIndex : Int) : Int = (this as java.lang.String).lastIndexOf(str, fromIndex).sure() -inline fun String.matches(regex : String) = (this as java.lang.String).matches(regex).sure() +public inline fun String.matches(regex : String) : Boolean = (this as java.lang.String).matches(regex).sure() -inline fun String.offsetByCodePoints(index : Int, codePointOffset : Int) = (this as java.lang.String).offsetByCodePoints(index, codePointOffset).sure() +public inline fun String.offsetByCodePoints(index : Int, codePointOffset : Int) : Int = (this as java.lang.String).offsetByCodePoints(index, codePointOffset).sure() -inline fun String.regionMatches(ignoreCase : Boolean, toffset : Int, other : String, ooffset : Int, len : Int) = (this as java.lang.String).regionMatches(ignoreCase, toffset, other, ooffset, len).sure() +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).sure() -inline fun String.regionMatches(toffset : Int, other : String, ooffset : Int, len : Int) = (this as java.lang.String).regionMatches(toffset, other, ooffset, len).sure() +public inline fun String.regionMatches(toffset : Int, other : String, ooffset : Int, len : Int) : Boolean = (this as java.lang.String).regionMatches(toffset, other, ooffset, len).sure() -inline fun String.replace(target : CharSequence, replacement : CharSequence) = (this as java.lang.String).replace(target, replacement).sure() +public inline fun String.replace(target : CharSequence, replacement : CharSequence) : String = (this as java.lang.String).replace(target, replacement).sure() -inline fun String.subSequence(beginIndex : Int, endIndex : Int) = (this as java.lang.String).subSequence(beginIndex, endIndex).sure() +public inline fun String.subSequence(beginIndex : Int, endIndex : Int) : CharSequence = (this as java.lang.String).subSequence(beginIndex, endIndex).sure() -inline fun String.toLowerCase(locale : java.util.Locale) = (this as java.lang.String).toLowerCase(locale).sure() +public inline fun String.toLowerCase(locale : java.util.Locale) : String = (this as java.lang.String).toLowerCase(locale).sure() -inline fun String.toUpperCase(locale : java.util.Locale) = (this as java.lang.String).toUpperCase(locale).sure() +public inline fun String.toUpperCase(locale : java.util.Locale) : String = (this as java.lang.String).toUpperCase(locale).sure() /** Returns the string if it is not null or the empty string if its null */ -inline fun String?.orEmpty(): String = this ?: "" +public inline fun String?.orEmpty(): String = this ?: "" // "Extension functions" for CharSequence -inline fun CharSequence.length() = (this as java.lang.CharSequence).length() +public inline fun CharSequence.length() : Int = (this as java.lang.CharSequence).length() inline val CharSequence.size : Int get() = length() -inline fun CharSequence.charAt(index : Int) = (this as java.lang.CharSequence).charAt(index) +public inline fun CharSequence.charAt(index : Int) : Char = (this as java.lang.CharSequence).charAt(index) -inline fun CharSequence.get(index : Int) = charAt(index) +public inline fun CharSequence.get(index : Int) : Char = charAt(index) -inline fun CharSequence.subSequence(start : Int, end : Int) = (this as java.lang.CharSequence).subSequence(start, end) +public inline fun CharSequence.subSequence(start : Int, end : Int) : CharSequence? = (this as java.lang.CharSequence).subSequence(start, end) -inline fun CharSequence.get(start : Int, end : Int) = subSequence(start, end) +public inline fun CharSequence.get(start : Int, end : Int) : CharSequence? = subSequence(start, end) -inline fun CharSequence.toString() = (this as java.lang.CharSequence).toString() \ No newline at end of file +public inline fun CharSequence.toString() : String? = (this as java.lang.CharSequence).toString() \ No newline at end of file diff --git a/libraries/stdlib/src/kotlin/concurrent/FunctionalList.kt b/libraries/stdlib/src/kotlin/concurrent/FunctionalList.kt index 3d58b7dc1d1..8d105274018 100644 --- a/libraries/stdlib/src/kotlin/concurrent/FunctionalList.kt +++ b/libraries/stdlib/src/kotlin/concurrent/FunctionalList.kt @@ -7,9 +7,9 @@ abstract class FunctionalList(public val size: Int) { val empty : Boolean get() = size == 0 - fun add(element: T) : FunctionalList = FunctionalList.Standard(element, this) + public fun add(element: T) : FunctionalList = FunctionalList.Standard(element, this) - fun reversed() : FunctionalList { + public fun reversed() : FunctionalList { if(empty) return this @@ -23,10 +23,10 @@ abstract class FunctionalList(public val size: Int) { return new } - fun iterator() : Iterator = object: Iterator { + public fun iterator() : Iterator = object: Iterator { var cur = this@FunctionalList - override fun next(): T { + public override fun next(): T { if(cur.empty) throw java.util.NoSuchElementException() @@ -49,9 +49,9 @@ abstract class FunctionalList(public val size: Int) { class Standard(override val head: T, override val tail: FunctionalList) : FunctionalList(tail.size+1) - fun emptyList() = Empty() + public fun emptyList() : FunctionalList = Empty() - fun of(element: T) : FunctionalList = FunctionalList.Standard(element,emptyList()) + public fun of(element: T) : FunctionalList = FunctionalList.Standard(element,emptyList()) } } diff --git a/libraries/stdlib/src/kotlin/concurrent/FunctionalQueue.kt b/libraries/stdlib/src/kotlin/concurrent/FunctionalQueue.kt index 10c3eaf3b03..4301685e718 100644 --- a/libraries/stdlib/src/kotlin/concurrent/FunctionalQueue.kt +++ b/libraries/stdlib/src/kotlin/concurrent/FunctionalQueue.kt @@ -13,11 +13,11 @@ class FunctionalQueue ( val empty : Boolean get() = size == 0 - fun add(element: T) = FunctionalQueue(input add element, output) + public fun add(element: T) : FunctionalQueue = FunctionalQueue(input add element, output) - fun addFirst(element: T) = FunctionalQueue(input, output add element) + public fun addFirst(element: T) : FunctionalQueue = FunctionalQueue(input, output add element) - fun removeFirst() : #(T,FunctionalQueue) = + public fun removeFirst() : #(T,FunctionalQueue) = if(output.empty) { if(input.empty) throw java.util.NoSuchElementException() diff --git a/libraries/stdlib/src/kotlin/concurrent/Locks.kt b/libraries/stdlib/src/kotlin/concurrent/Locks.kt index 39d4609ea84..dbfc0789060 100644 --- a/libraries/stdlib/src/kotlin/concurrent/Locks.kt +++ b/libraries/stdlib/src/kotlin/concurrent/Locks.kt @@ -9,7 +9,7 @@ import java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock Executes given calculation under lock Returns result of the calculation */ -inline fun Lock.withLock(action: ()->T) : T { +public inline fun Lock.withLock(action: ()->T) : T { lock() try { return action() @@ -23,7 +23,7 @@ inline fun Lock.withLock(action: ()->T) : T { Executes given calculation under read lock Returns result of the calculation */ -inline fun ReentrantReadWriteLock.read(action: ()->T) : T { +public inline fun ReentrantReadWriteLock.read(action: ()->T) : T { val rl = readLock().sure() rl.lock() try { @@ -40,7 +40,7 @@ The method does upgrade from read to write lock if needed If such write has been initiated by checking some condition, the condition must be rechecked inside the action to avoid possible races Returns result of the calculation */ -inline fun ReentrantReadWriteLock.write(action: ()->T) : T { +public inline fun ReentrantReadWriteLock.write(action: ()->T) : T { val rl = readLock().sure() val readCount = if (getWriteHoldCount() == 0) getReadHoldCount() else 0 diff --git a/libraries/stdlib/src/kotlin/concurrent/Thread.kt b/libraries/stdlib/src/kotlin/concurrent/Thread.kt index c775ddb42f7..3468e300a7c 100644 --- a/libraries/stdlib/src/kotlin/concurrent/Thread.kt +++ b/libraries/stdlib/src/kotlin/concurrent/Thread.kt @@ -24,9 +24,9 @@ inline var Thread.contextClassLoader : ClassLoader? get() = getContextClassLoader() set(loader: ClassLoader?) { setContextClassLoader(loader) } -fun thread(start: Boolean = true, daemon: Boolean = false, contextClassLoader: ClassLoader? = null, name: String? = null, priority: Int = -1, block: ()->Unit) : Thread { +public fun thread(start: Boolean = true, daemon: Boolean = false, contextClassLoader: ClassLoader? = null, name: String? = null, priority: Int = -1, block: ()->Unit) : Thread { val thread = object: Thread() { - override fun run() { + public override fun run() { block() } } @@ -43,9 +43,9 @@ fun thread(start: Boolean = true, daemon: Boolean = false, contextClassLoader: C return thread } -inline fun Executor.execute(action: ()->Unit) { +public inline fun Executor.execute(action: ()->Unit) { execute(object: Runnable{ - override fun run() { + public override fun run() { action() } }) diff --git a/libraries/stdlib/src/kotlin/concurrent/Timer.kt b/libraries/stdlib/src/kotlin/concurrent/Timer.kt index d3ad1b68fc8..6df1e340b9d 100644 --- a/libraries/stdlib/src/kotlin/concurrent/Timer.kt +++ b/libraries/stdlib/src/kotlin/concurrent/Timer.kt @@ -4,68 +4,68 @@ import java.util.Timer import java.util.TimerTask import java.util.Date -fun Timer.schedule(delay: Long, action: TimerTask.()->Unit) : TimerTask { +public fun Timer.schedule(delay: Long, action: TimerTask.()->Unit) : TimerTask { val task = createTask(action) schedule(task, delay) return task } -fun Timer.schedule(time: Date, action: TimerTask.()->Unit) : TimerTask { +public fun Timer.schedule(time: Date, action: TimerTask.()->Unit) : TimerTask { val task = createTask(action) schedule(task, time) return task } -fun Timer.schedule(delay: Long, period: Long, action: TimerTask.()->Unit) : TimerTask { +public fun Timer.schedule(delay: Long, period: Long, action: TimerTask.()->Unit) : TimerTask { val task = createTask(action) schedule(task, delay, period) return task } -fun Timer.schedule(time: Date, period: Long, action: TimerTask.()->Unit) : TimerTask { +public fun Timer.schedule(time: Date, period: Long, action: TimerTask.()->Unit) : TimerTask { val task = createTask(action) schedule(task, time, period) return task } -fun Timer.scheduleAtFixedRate(delay: Long, period: Long, action: TimerTask.()->Unit) : TimerTask { +public fun Timer.scheduleAtFixedRate(delay: Long, period: Long, action: TimerTask.()->Unit) : TimerTask { val task = createTask(action) scheduleAtFixedRate(task, delay, period) return task } -fun Timer.scheduleAtFixedRate(time: Date, period: Long, action: TimerTask.()->Unit) : TimerTask { +public fun Timer.scheduleAtFixedRate(time: Date, period: Long, action: TimerTask.()->Unit) : TimerTask { val task = createTask(action) scheduleAtFixedRate(task, time, period) return task } -fun timer(name: String? = null, daemon: Boolean = false, initialDelay: Long = 0.toLong(), period: Long, action: TimerTask.()->Unit) : Timer { +public fun timer(name: String? = null, daemon: Boolean = false, initialDelay: Long = 0.toLong(), period: Long, action: TimerTask.()->Unit) : Timer { val timer = if(name == null) Timer(daemon) else Timer(name, daemon) timer.schedule(initialDelay, period, action) return timer } -fun timer(name: String? = null, daemon: Boolean = false, startAt: Date, period: Long, action: TimerTask.()->Unit) : Timer { +public fun timer(name: String? = null, daemon: Boolean = false, startAt: Date, period: Long, action: TimerTask.()->Unit) : Timer { val timer = if(name == null) Timer(daemon) else Timer(name, daemon) timer.schedule(startAt, period, action) return timer } -fun fixedRateTimer(name: String? = null, daemon: Boolean = false, initialDelay: Long = 0.toLong(), period: Long, action: TimerTask.()->Unit) : Timer { +public fun fixedRateTimer(name: String? = null, daemon: Boolean = false, initialDelay: Long = 0.toLong(), period: Long, action: TimerTask.()->Unit) : Timer { val timer = if(name == null) Timer(daemon) else Timer(name, daemon) timer.scheduleAtFixedRate(initialDelay, period, action) return timer } -fun fixedRateTimer(name: String? = null, daemon: Boolean = false, startAt: Date, period : Long, action: TimerTask.()->Unit) : Timer { +public fun fixedRateTimer(name: String? = null, daemon: Boolean = false, startAt: Date, period : Long, action: TimerTask.()->Unit) : Timer { val timer = if(name == null) Timer(daemon) else Timer(name, daemon) timer.scheduleAtFixedRate(startAt, period, action) return timer } private fun createTask(action: TimerTask.()->Unit) : TimerTask = object: TimerTask() { - override fun run() { + public override fun run() { action() } } \ No newline at end of file diff --git a/libraries/stdlib/src/kotlin/dom/Dom.kt b/libraries/stdlib/src/kotlin/dom/Dom.kt index 2c969ac960c..57d9c617e37 100644 --- a/libraries/stdlib/src/kotlin/dom/Dom.kt +++ b/libraries/stdlib/src/kotlin/dom/Dom.kt @@ -96,7 +96,7 @@ set(value) { // Helper methods /** Returns true if the element has the given CSS class style in its 'class' attribute */ -fun Element.hasClass(cssClass: String): Boolean { +public fun Element.hasClass(cssClass: String): Boolean { val c = this.classes return if (c != null) c.matches("""(^|.*\s+)$cssClass($|\s+.*)""") @@ -104,7 +104,7 @@ fun Element.hasClass(cssClass: String): Boolean { } /** Adds the given CSS class to this element's 'class' attribute */ -fun Element.addClass(cssClass: String): Boolean { +public fun Element.addClass(cssClass: String): Boolean { val classSet = this.classSet val answer = classSet.add(cssClass) if (answer) { @@ -114,7 +114,7 @@ fun Element.addClass(cssClass: String): Boolean { } /** Removes the given CSS class to this element's 'class' attribute */ -fun Element.removeClass(cssClass: String): Boolean { +public fun Element.removeClass(cssClass: String): Boolean { val classSet = this.classSet val answer = classSet.remove(cssClass) if (answer) { @@ -125,7 +125,7 @@ fun Element.removeClass(cssClass: String): Boolean { /** TODO this approach generates compiler errors... -fun Element.addClass(varargs cssClasses: Array): Boolean { +public fun Element.addClass(varargs cssClasses: Array): Boolean { val set = this.classSet var answer = false for (cs in cssClasses) { @@ -139,7 +139,7 @@ fun Element.addClass(varargs cssClasses: Array): Boolean { return answer } -fun Element.removeClass(varargs cssClasses: Array): Boolean { +public fun Element.removeClass(varargs cssClasses: Array): Boolean { val set = this.classSet var answer = false for (cs in cssClasses) { @@ -155,7 +155,7 @@ fun Element.removeClass(varargs cssClasses: Array): Boolean { */ /** Searches for elements using the element name, an element ID (if prefixed with dot) or element class (if prefixed with #) */ -fun Document?.get(selector: String): List { +public fun Document?.get(selector: String): List { val root = this?.getDocumentElement() return if (root != null) { if (selector == "*") { @@ -179,7 +179,7 @@ fun Document?.get(selector: String): List { } /** Searches for elements using the element name, an element ID (if prefixed with dot) or element class (if prefixed with #) */ -fun Element.get(selector: String): List { +public fun Element.get(selector: String): List { return if (selector == "*") { elements } else if (selector.startsWith(".")) { @@ -197,11 +197,11 @@ fun Element.get(selector: String): List { } /** Returns an [[Iterator]] over the next siblings of this node */ -fun Node.nextSiblings() : Iterator = NextSiblingIterator(this) +public fun Node.nextSiblings() : Iterator = NextSiblingIterator(this) class NextSiblingIterator(var node: Node) : AbstractIterator() { - override fun computeNext(): Node? { + public override fun computeNext(): Node? { val next = node.getNextSibling() if (next != null) { node = next @@ -213,11 +213,11 @@ class NextSiblingIterator(var node: Node) : AbstractIterator() { } } /** Returns an [[Iterator]] over the next siblings of this node */ -fun Node.previousSiblings() : Iterator = PreviousSiblingIterator(this) +public fun Node.previousSiblings() : Iterator = PreviousSiblingIterator(this) class PreviousSiblingIterator(var node: Node) : AbstractIterator() { - override fun computeNext(): Node? { + public override fun computeNext(): Node? { val next = node.getPreviousSibling() if (next != null) { node = next @@ -230,24 +230,24 @@ class PreviousSiblingIterator(var node: Node) : AbstractIterator() { } /** Returns true if this node is a Text node or a CDATA node */ -fun Node.isText(): Boolean { +public fun Node.isText(): Boolean { val nodeType = getNodeType() return nodeType == Node.TEXT_NODE || nodeType == Node.CDATA_SECTION_NODE } /** Returns an [[Iterator]] of all the next [[Element]] siblings */ -fun Node.nextElements(): Iterator = nextSiblings().filterIsInstance(javaClass()) +public fun Node.nextElements(): Iterator = nextSiblings().filterIsInstance(javaClass()) /** Returns an [[Iterator]] of all the previous [[Element]] siblings */ -fun Node.previousElements(): Iterator = previousSiblings().filterIsInstance(javaClass()) +public fun Node.previousElements(): Iterator = previousSiblings().filterIsInstance(javaClass()) /** Returns the attribute value or empty string if its not present */ -inline fun Element.attribute(name: String): String { +public inline fun Element.attribute(name: String): String { return this.getAttribute(name) ?: "" } /** Returns the children of the element as a list */ -inline fun Element?.children(): List { +public inline fun Element?.children(): List { return this?.getChildNodes().toList() } @@ -261,22 +261,22 @@ get() = this?.getElementsByTagName("*").toElementList() /** Returns all the child elements given the local element name */ -inline fun Element?.elements(localName: String?): List { +public inline fun Element?.elements(localName: String?): List { return this?.getElementsByTagName(localName).toElementList() } /** Returns all the elements given the local element name */ -inline fun Document?.elements(localName: String?): List { +public inline fun Document?.elements(localName: String?): List { return this?.getElementsByTagName(localName).toElementList() } /** Returns all the child elements given the namespace URI and local element name */ -inline fun Element?.elements(namespaceUri: String?, localName: String?): List { +public inline fun Element?.elements(namespaceUri: String?, localName: String?): List { return this?.getElementsByTagNameNS(namespaceUri, localName).toElementList() } /** Returns all the elements given the namespace URI and local element name */ -inline fun Document?.elements(namespaceUri: String?, localName: String?): List { +public inline fun Document?.elements(namespaceUri: String?, localName: String?): List { return this?.getElementsByTagNameNS(namespaceUri, localName).toElementList() } @@ -300,7 +300,7 @@ val NodeList?.last : Node? get() = this.tail -inline fun NodeList?.toList(): List { +public inline fun NodeList?.toList(): List { return if (this == null) { Collections.EMPTY_LIST as List } @@ -309,7 +309,7 @@ inline fun NodeList?.toList(): List { } } -inline fun NodeList?.toElementList(): List { +public inline fun NodeList?.toElementList(): List { return if (this == null) { Collections.EMPTY_LIST as List } @@ -319,7 +319,7 @@ inline fun NodeList?.toElementList(): List { } /** Converts the node list to an XML String */ -fun NodeList?.toXmlString(xmlDeclaration: Boolean = false): String { +public fun NodeList?.toXmlString(xmlDeclaration: Boolean = false): String { return if (this == null) "" else { nodesToXmlString(this.toList(), xmlDeclaration) @@ -327,7 +327,7 @@ fun NodeList?.toXmlString(xmlDeclaration: Boolean = false): String { } class NodeListAsList(val nodeList: NodeList): AbstractList() { - override fun get(index: Int): Node { + public override fun get(index: Int): Node { val node = nodeList.item(index) if (node == null) { throw IndexOutOfBoundsException("NodeList does not contain a node at index: " + index) @@ -336,11 +336,11 @@ class NodeListAsList(val nodeList: NodeList): AbstractList() { } } - override fun size(): Int = nodeList.getLength() + public override fun size(): Int = nodeList.getLength() } class ElementListAsList(val nodeList: NodeList): AbstractList() { - override fun get(index: Int): Element { + public override fun get(index: Int): Element { val node = nodeList.item(index) if (node is Element) { return node @@ -353,23 +353,23 @@ class ElementListAsList(val nodeList: NodeList): AbstractList() { } } - override fun size(): Int = nodeList.getLength() + public override fun size(): Int = nodeList.getLength() } // Syntax sugar -inline fun Node.plus(child: Node?): Node { +public inline fun Node.plus(child: Node?): Node { if (child != null) { this.appendChild(child) } return this } -inline fun Element.plus(text: String?): Element = this.addText(text) +public inline fun Element.plus(text: String?): Element = this.addText(text) -inline fun Element.plusAssign(text: String?): Element = this.addText(text) +public inline fun Element.plusAssign(text: String?): Element = this.addText(text) // Builder @@ -377,7 +377,7 @@ inline fun Element.plusAssign(text: String?): Element = this.addText(text) /** * Creates a new element which can be configured via a function */ -fun Document.createElement(name: String, init: Element.()-> Unit): Element { +public fun Document.createElement(name: String, init: Element.()-> Unit): Element { val elem = this.createElement(name).sure() elem.init() return elem @@ -386,14 +386,14 @@ fun Document.createElement(name: String, init: Element.()-> Unit): Element { /** * Creates a new element to an element which has an owner Document which can be configured via a function */ -fun Element.createElement(name: String, doc: Document? = null, init: Element.()-> Unit): Element { +public fun Element.createElement(name: String, doc: Document? = null, init: Element.()-> Unit): Element { val elem = ownerDocument(doc).createElement(name).sure() elem.init() return elem } /** Returns the owner document of the element or uses the provided document */ -fun Node.ownerDocument(doc: Document? = null): Document { +public fun Node.ownerDocument(doc: Document? = null): Document { val answer = if (this is Document) this as Document else if (doc == null) this.getOwnerDocument() else doc @@ -408,7 +408,7 @@ fun Node.ownerDocument(doc: Document? = null): Document { /** Adds a newly created element which can be configured via a function */ -fun Document.addElement(name: String, init: Element.()-> Unit): Element { +public fun Document.addElement(name: String, init: Element.()-> Unit): Element { val child = createElement(name, init) this.appendChild(child) return child @@ -417,7 +417,7 @@ fun Document.addElement(name: String, init: Element.()-> Unit): Element { /** Adds a newly created element to an element which has an owner Document which can be configured via a function */ -fun Element.addElement(name: String, doc: Document? = null, init: Element.()-> Unit): Element { +public fun Element.addElement(name: String, doc: Document? = null, init: Element.()-> Unit): Element { val child = createElement(name, doc, init) this.appendChild(child) return child @@ -426,7 +426,7 @@ fun Element.addElement(name: String, doc: Document? = null, init: Element.()-> U /** Adds a newly created text node to an element which either already has an owner Document or one must be provided as a parameter */ -fun Element.addText(text: String?, doc: Document? = null): Element { +public fun Element.addText(text: String?, doc: Document? = null): Element { if (text != null) { val child = ownerDocument(doc).createTextNode(text) this.appendChild(child) diff --git a/libraries/stdlib/src/kotlin/dom/DomJVM.kt b/libraries/stdlib/src/kotlin/dom/DomJVM.kt index 49a45b579c0..8719102fa69 100644 --- a/libraries/stdlib/src/kotlin/dom/DomJVM.kt +++ b/libraries/stdlib/src/kotlin/dom/DomJVM.kt @@ -20,17 +20,17 @@ import java.util.Collection import java.io.Writer /** Creates a new document with the given document builder*/ -fun createDocument(builder: DocumentBuilder): Document { +public fun createDocument(builder: DocumentBuilder): Document { return builder.newDocument().sure() } /** Creates a new document with an optional DocumentBuilderFactory */ -fun createDocument(builderFactory: DocumentBuilderFactory = DocumentBuilderFactory.newInstance().sure()): Document { +public fun createDocument(builderFactory: DocumentBuilderFactory = DocumentBuilderFactory.newInstance().sure()): Document { return createDocument(builderFactory.newDocumentBuilder().sure()) } /** Creates a new TrAX transformer */ -fun createTransformer(source: Source? = null, factory: TransformerFactory = TransformerFactory.newInstance().sure()): Transformer { +public fun createTransformer(source: Source? = null, factory: TransformerFactory = TransformerFactory.newInstance().sure()): Transformer { val transformer = if (source != null) { factory.newTransformer(source) } else { @@ -40,21 +40,21 @@ fun createTransformer(source: Source? = null, factory: TransformerFactory = Tran } /** Converts the node to an XML String */ -fun Node.toXmlString(xmlDeclaration: Boolean = false): String { +public fun Node.toXmlString(xmlDeclaration: Boolean = false): String { val writer = StringWriter() writeXmlString(writer, xmlDeclaration) return writer.toString().sure() } /** Converts the node to an XML String and writes it to the given [[Writer]] */ -fun Node.writeXmlString(writer: Writer, xmlDeclaration: Boolean): Unit { +public fun Node.writeXmlString(writer: Writer, xmlDeclaration: Boolean): Unit { val transformer = createTransformer() transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, if (xmlDeclaration) "no" else "yes") transformer.transform(DOMSource(this), StreamResult(writer)) } /** Converts the collection of nodes to an XML String */ -fun nodesToXmlString(nodes: Iterable, xmlDeclaration: Boolean = false): String { +public fun nodesToXmlString(nodes: Iterable, xmlDeclaration: Boolean = false): String { // TODO this should work... // return this.map{it.toXmlString()}.join("") val builder = StringBuilder() diff --git a/libraries/stdlib/src/kotlin/io/JIO.kt b/libraries/stdlib/src/kotlin/io/JIO.kt index b58e1088f61..64e03fcd449 100644 --- a/libraries/stdlib/src/kotlin/io/JIO.kt +++ b/libraries/stdlib/src/kotlin/io/JIO.kt @@ -17,134 +17,134 @@ public val defaultCharset: Charset = Charset.forName("UTF-8").sure() /** Prints the given message to [[System.out]] */ -inline fun print(message : Any?) { +public inline fun print(message : Any?) { System.out?.print(message) } /** Prints the given message to [[System.out]] */ -inline fun print(message : Int) { +public inline fun print(message : Int) { System.out?.print(message) } /** Prints the given message to [[System.out]] */ -inline fun print(message : Long) { +public inline fun print(message : Long) { System.out?.print(message) } /** Prints the given message to [[System.out]] */ -inline fun print(message : Byte) { +public inline fun print(message : Byte) { System.out?.print(message) } /** Prints the given message to [[System.out]] */ -inline fun print(message : Short) { +public inline fun print(message : Short) { System.out?.print(message) } /** Prints the given message to [[System.out]] */ -inline fun print(message : Char) { +public inline fun print(message : Char) { System.out?.print(message) } /** Prints the given message to [[System.out]] */ -inline fun print(message : Boolean) { +public inline fun print(message : Boolean) { System.out?.print(message) } /** Prints the given message to [[System.out]] */ -inline fun print(message : Float) { +public inline fun print(message : Float) { System.out?.print(message) } /** Prints the given message to [[System.out]] */ -inline fun print(message : Double) { +public inline fun print(message : Double) { System.out?.print(message) } /** Prints the given message to [[System.out]] */ -inline fun print(message : CharArray) { +public inline fun print(message : CharArray) { System.out?.print(message) } /** Prints the given message and newline to [[System.out]] */ -inline fun println(message : Any?) { +public inline fun println(message : Any?) { System.out?.println(message) } /** Prints the given message and newline to [[System.out]] */ -inline fun println(message : Int) { +public inline fun println(message : Int) { System.out?.println(message) } /** Prints the given message and newline to [[System.out]] */ -inline fun println(message : Long) { +public inline fun println(message : Long) { System.out?.println(message) } /** Prints the given message and newline to [[System.out]] */ -inline fun println(message : Byte) { +public inline fun println(message : Byte) { System.out?.println(message) } /** Prints the given message and newline to [[System.out]] */ -inline fun println(message : Short) { +public inline fun println(message : Short) { System.out?.println(message) } /** Prints the given message and newline to [[System.out]] */ -inline fun println(message : Char) { +public inline fun println(message : Char) { System.out?.println(message) } /** Prints the given message and newline to [[System.out]] */ -inline fun println(message : Boolean) { +public inline fun println(message : Boolean) { System.out?.println(message) } /** Prints the given message and newline to [[System.out]] */ -inline fun println(message : Float) { +public inline fun println(message : Float) { System.out?.println(message) } /** Prints the given message and newline to [[System.out]] */ -inline fun println(message : Double) { +public inline fun println(message : Double) { System.out?.println(message) } /** Prints the given message and newline to [[System.out]] */ -inline fun println(message : CharArray) { +public inline fun println(message : CharArray) { System.out?.println(message) } /** Prints a newline t[[System.out]] */ -inline fun println() { +public inline fun println() { System.out?.println() } private val stdin : BufferedReader = BufferedReader(InputStreamReader(object : InputStream() { - override fun read() : Int { + public override fun read() : Int { return System.`in`?.read() ?: -1 } - override fun reset() { + public override fun reset() { System.`in`?.reset() } - override fun read(b: ByteArray?): Int { + public override fun read(b: ByteArray?): Int { return System.`in`?.read(b) ?: -1 } - override fun close() { + public override fun close() { System.`in`?.close() } - override fun mark(readlimit: Int) { + public override fun mark(readlimit: Int) { System.`in`?.mark(readlimit) } - override fun skip(n: Long): Long { + public override fun skip(n: Long): Long { return System.`in`?.skip(n) ?: -1.toLong() } - override fun available(): Int { + public override fun available(): Int { return System.`in`?.available() ?: 0 } - override fun markSupported(): Boolean { + public override fun markSupported(): Boolean { return System.`in`?.markSupported() ?: false } - override fun read(b: ByteArray?, off: Int, len: Int): Int { + public override fun read(b: ByteArray?, off: Int, len: Int): Int { return System.`in`?.read(b, off, len) ?: -1 } })) /** Reads a line of input from [[System.in]] */ -inline fun readLine() : String? = stdin.readLine() +public inline fun readLine() : String? = stdin.readLine() /** Uses the given resource then closes it down correctly whether an exception is thrown or not */ -inline fun T.use(block: (T)-> R) : R { +public inline fun T.use(block: (T)-> R) : R { var closed = false try { return block(this) @@ -170,47 +170,47 @@ inline fun T.use(block: (T)-> R) : R { } /** Returns an [Iterator] of bytes over an input stream */ -fun InputStream.iterator() : ByteIterator = +public fun InputStream.iterator() : ByteIterator = object: ByteIterator() { override val hasNext : Boolean get() = available() > 0 - override fun nextByte() = read().toByte() + public override fun nextByte() : Byte = read().toByte() } /** Creates a buffered input stream */ -inline fun InputStream.buffered(bufferSize: Int = defaultBufferSize) - = if (this is BufferedInputStream) - this - else - BufferedInputStream(this, bufferSize) +public inline fun InputStream.buffered(bufferSize: Int = defaultBufferSize) : InputStream += if (this is BufferedInputStream) + this +else + BufferedInputStream(this, bufferSize) -inline fun InputStream.reader(encoding: Charset = defaultCharset) : InputStreamReader = InputStreamReader(this, encoding) +public inline fun InputStream.reader(encoding: Charset = defaultCharset) : InputStreamReader = InputStreamReader(this, encoding) -inline fun InputStream.reader(encoding: String) = InputStreamReader(this, encoding) +public inline fun InputStream.reader(encoding: String) : InputStreamReader = InputStreamReader(this, encoding) -inline fun InputStream.reader(encoding: CharsetDecoder) = InputStreamReader(this, encoding) +public inline fun InputStream.reader(encoding: CharsetDecoder) : InputStreamReader = InputStreamReader(this, encoding) -inline fun OutputStream.buffered(bufferSize: Int = defaultBufferSize) : BufferedOutputStream - = if (this is BufferedOutputStream) this else BufferedOutputStream(this, bufferSize) +public inline fun OutputStream.buffered(bufferSize: Int = defaultBufferSize) : BufferedOutputStream += if (this is BufferedOutputStream) this else BufferedOutputStream(this, bufferSize) -inline fun OutputStream.writer(encoding: Charset = defaultCharset) : OutputStreamWriter = OutputStreamWriter(this, encoding) +public inline fun OutputStream.writer(encoding: Charset = defaultCharset) : OutputStreamWriter = OutputStreamWriter(this, encoding) -inline fun OutputStream.writer(encoding: String) = OutputStreamWriter(this, encoding) +public inline fun OutputStream.writer(encoding: String) : OutputStreamWriter = OutputStreamWriter(this, encoding) -inline fun OutputStream.writer(encoding: CharsetEncoder) = OutputStreamWriter(this, encoding) +public inline fun OutputStream.writer(encoding: CharsetEncoder) : OutputStreamWriter = OutputStreamWriter(this, encoding) -inline fun Reader.buffered(bufferSize: Int = defaultBufferSize): BufferedReader - = if(this is BufferedReader) this else BufferedReader(this, bufferSize) +public inline fun Reader.buffered(bufferSize: Int = defaultBufferSize): BufferedReader += if(this is BufferedReader) this else BufferedReader(this, bufferSize) -inline fun Writer.buffered(bufferSize: Int = defaultBufferSize): BufferedWriter - = if(this is BufferedWriter) this else BufferedWriter(this, bufferSize) +public inline fun Writer.buffered(bufferSize: Int = defaultBufferSize): BufferedWriter += if(this is BufferedWriter) this else BufferedWriter(this, bufferSize) -inline fun Reader.forEachLine(block: (String) -> Unit): Unit { +public inline fun Reader.forEachLine(block: (String) -> Unit): Unit { this.use{ val iter = buffered().lineIterator() while (iter.hasNext) { @@ -220,7 +220,7 @@ inline fun Reader.forEachLine(block: (String) -> Unit): Unit { } } -inline fun Reader.useLines(block: (Iterator) -> T): T = this.buffered().use{block(it.lineIterator())} +public inline fun Reader.useLines(block: (Iterator) -> T): T = this.buffered().use{block(it.lineIterator())} /** * Returns an iterator over each line. @@ -230,7 +230,7 @@ inline fun Reader.useLines(block: (Iterator) -> T): T = this.buffere *
* We suggest you try the method useLines() instead which closes the stream when the processing is complete. */ -inline fun BufferedReader.lineIterator() : Iterator = LineIterator(this) +public inline fun BufferedReader.lineIterator() : Iterator = LineIterator(this) class LineIterator(val reader: BufferedReader) : Iterator { private var nextValue: String? = null @@ -245,7 +245,7 @@ class LineIterator(val reader: BufferedReader) : Iterator { return nextValue != null } - override fun next(): String { + public override fun next(): String { if (!hasNext) { throw NoSuchElementException() } @@ -260,7 +260,7 @@ class LineIterator(val reader: BufferedReader) : Iterator { /** * Recursively process this file and all children with the given block */ -fun File.recurse(block: (File) -> Unit): Unit { +public fun File.recurse(block: (File) -> Unit): Unit { block(this) if (this.isDirectory()) { for (child in this.listFiles()) { @@ -312,14 +312,14 @@ get() { /** * Returns true if the given file is in the same directory or a descendant directory */ -fun File.isDescendant(file: File): Boolean { +public fun File.isDescendant(file: File): Boolean { return file.directory.canonicalPath.startsWith(this.directory.canonicalPath) } /** * Returns the relative path of the given descendant of this file if its a descendant */ -fun File.relativePath(descendant: File): String { +public fun File.relativePath(descendant: File): String { val prefix = this.directory.canonicalPath val answer = descendant.canonicalPath return if (answer.startsWith(prefix)) { @@ -334,14 +334,14 @@ fun File.relativePath(descendant: File): String { * * This method is not recommended on huge files. */ -fun File.readBytes(): ByteArray { +public fun File.readBytes(): ByteArray { return FileInputStream(this).use{ it.readBytes(this.length().toInt()) } } /** * Writes the bytes as the contents of the file */ -fun File.writeBytes(data: ByteArray): Unit { +public fun File.writeBytes(data: ByteArray): Unit { return FileOutputStream(this).use{ it.write(data) } } /** @@ -351,7 +351,7 @@ fun File.writeBytes(data: ByteArray): Unit { * * This method is not recommended on huge files. */ -fun File.readText(encoding:String? = null) = readBytes().toString(encoding) +public fun File.readText(encoding:String? = null) : String = readBytes().toString(encoding) /** * Reads the entire content of the file as a String using the @@ -359,26 +359,26 @@ fun File.readText(encoding:String? = null) = readBytes().toString(encoding) * * This method is not recommended on huge files. */ -fun File.readText(encoding:Charset) = readBytes().toString(encoding) +public fun File.readText(encoding:Charset) : String = readBytes().toString(encoding) /** * Writes the text as the contents of the file using the optional * character encoding. The default platform encoding is used if the character * encoding is not specified or null. */ -fun File.writeText(text: String, encoding:String?=null): Unit { writeBytes(text.toByteArray(encoding)) } +public fun File.writeText(text: String, encoding:String?=null): Unit { writeBytes(text.toByteArray(encoding)) } /** * Writes the text as the contents of the file using the optional * character encoding. The default platform encoding is used if the character * encoding is not specified or null. */ -fun File.writeText(text: String, encoding:Charset): Unit { writeBytes(text.toByteArray(encoding)) } +public fun File.writeText(text: String, encoding:Charset): Unit { writeBytes(text.toByteArray(encoding)) } /** * Copies this file to the given output file, returning the number of bytes copied */ -fun File.copyTo(file: File, bufferSize: Int = defaultBufferSize): Long { +public fun File.copyTo(file: File, bufferSize: Int = defaultBufferSize): Long { file.directory.mkdirs() val input = FileInputStream(this) return input.use{ @@ -394,7 +394,7 @@ fun File.copyTo(file: File, bufferSize: Int = defaultBufferSize): Long { * * **Note** it is the callers responsibility to close this resource */ -fun InputStream.readBytes(estimatedSize: Int = defaultBufferSize): ByteArray { +public fun InputStream.readBytes(estimatedSize: Int = defaultBufferSize): ByteArray { val buffer = ByteArrayOutputStream(estimatedSize) this.copyTo(buffer) return buffer.toByteArray().sure() @@ -405,7 +405,7 @@ fun InputStream.readBytes(estimatedSize: Int = defaultBufferSize): ByteArray { * * **Note** it is the callers responsibility to close this resource */ -fun Reader.readText(): String { +public fun Reader.readText(): String { val buffer = StringWriter() copyTo(buffer) return buffer.toString().sure() @@ -416,7 +416,7 @@ fun Reader.readText(): String { * * **Note** it is the callers responsibility to close both of these resources */ -fun InputStream.copyTo(out: OutputStream, bufferSize: Int = defaultBufferSize): Long { +public fun InputStream.copyTo(out: OutputStream, bufferSize: Int = defaultBufferSize): Long { var bytesCopied: Long = 0 val buffer = ByteArray(bufferSize) var bytes = read(buffer) @@ -433,7 +433,7 @@ fun InputStream.copyTo(out: OutputStream, bufferSize: Int = defaultBufferSize): * * **Note** it is the callers responsibility to close both of these resources */ -fun Reader.copyTo(out: Writer, bufferSize: Int = defaultBufferSize): Long { +public fun Reader.copyTo(out: Writer, bufferSize: Int = defaultBufferSize): Long { var charsCopied: Long = 0 val buffer = CharArray(bufferSize) var chars = read(buffer) @@ -450,19 +450,19 @@ fun Reader.copyTo(out: Writer, bufferSize: Int = defaultBufferSize): Long { * * This method is not recommended on huge files. */ -fun URL.readText(encoding: String? = null): String = readBytes().toString(encoding) +public fun URL.readText(encoding: String? = null): String = readBytes().toString(encoding) /** * Reads the entire content of the URL as a String with the specified character encoding. * * This method is not recommended on huge files. */ -fun URL.readText(encoding: Charset): String = readBytes().toString(encoding) +public fun URL.readText(encoding: Charset): String = readBytes().toString(encoding) /** * Reads the entire content of the URL as bytes * * This method is not recommended on huge files. */ -fun URL.readBytes(): ByteArray = this.openStream().sure().use{ it.readBytes() } +public fun URL.readBytes(): ByteArray = this.openStream().sure().use{ it.readBytes() } diff --git a/libraries/stdlib/src/kotlin/math/JMath.kt b/libraries/stdlib/src/kotlin/math/JMath.kt index 40aeb16336f..5c33928ca90 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 -fun BigInteger.plus(other: BigInteger) = this.add(other).sure() +public fun BigInteger.plus(other: BigInteger) : BigInteger = this.add(other).sure() -fun BigInteger.minus(other: BigInteger) = this.subtract(other).sure() +public fun BigInteger.minus(other: BigInteger) : BigInteger = this.subtract(other).sure() -fun BigInteger.times(other: BigInteger) = this.multiply(other).sure() +public fun BigInteger.times(other: BigInteger) : BigInteger = this.multiply(other).sure() -fun BigInteger.div(other: BigInteger) = this.divide(other).sure() +public fun BigInteger.div(other: BigInteger) : BigInteger = this.divide(other).sure() -fun BigInteger.minus() = this.negate().sure() +public fun BigInteger.minus() : BigInteger = this.negate().sure() -fun BigDecimal.plus(other: BigDecimal) = this.add(other).sure() +public fun BigDecimal.plus(other: BigDecimal) : BigDecimal = this.add(other).sure() -fun BigDecimal.minus(other: BigDecimal) = this.subtract(other).sure() +public fun BigDecimal.minus(other: BigDecimal) : BigDecimal = this.subtract(other).sure() -fun BigDecimal.times(other: BigDecimal) = this.multiply(other).sure() +public fun BigDecimal.times(other: BigDecimal) : BigDecimal = this.multiply(other).sure() -fun BigDecimal.div(other: BigDecimal) = this.divide(other).sure() +public fun BigDecimal.div(other: BigDecimal) : BigDecimal = this.divide(other).sure() -fun BigDecimal.mod(other: BigDecimal) = this.remainder(other).sure() +public fun BigDecimal.mod(other: BigDecimal) : BigDecimal = this.remainder(other).sure() -fun BigDecimal.minus() = this.negate().sure() \ No newline at end of file +public fun BigDecimal.minus() : BigDecimal = this.negate().sure() \ 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 301e41930a8..4492b195405 100644 --- a/libraries/stdlib/src/kotlin/modules/ModuleBuilder.kt +++ b/libraries/stdlib/src/kotlin/modules/ModuleBuilder.kt @@ -3,20 +3,20 @@ package kotlin.modules import java.util.* import jet.modules.* -fun module(name: String, callback: ModuleBuilder.() -> Unit) { +public fun module(name: String, callback: ModuleBuilder.() -> Unit) { val builder = ModuleBuilder(name) builder.callback() AllModules.modules.sure().get()?.add(builder) } class SourcesBuilder(val parent: ModuleBuilder) { - fun plusAssign(pattern: String) { + public fun plusAssign(pattern: String) { parent.addSourceFiles(pattern) } } class ClasspathBuilder(val parent: ModuleBuilder) { - fun plusAssign(name: String) { + public fun plusAssign(name: String) { parent.addClasspathEntry(name) } } @@ -32,16 +32,16 @@ open class ModuleBuilder(val name: String): Module { val classpath: ClasspathBuilder get() = ClasspathBuilder(this) - fun addSourceFiles(pattern: String) { + public fun addSourceFiles(pattern: String) { sourceFiles0.add(pattern) } - fun addClasspathEntry(name: String) { + public fun addClasspathEntry(name: String) { classpathRoots0.add(name) } - override fun getSourceFiles(): List? = sourceFiles0 - override fun getClasspathRoots(): List? = classpathRoots0 - override fun getModuleName(): String? = name + public override fun getSourceFiles(): List? = sourceFiles0 + public override fun getClasspathRoots(): List? = classpathRoots0 + public override fun getModuleName(): String? = name } diff --git a/libraries/stdlib/src/kotlin/nullable/Nullables.kt b/libraries/stdlib/src/kotlin/nullable/Nullables.kt index c6a871e5ae2..00f1d159f5d 100644 --- a/libraries/stdlib/src/kotlin/nullable/Nullables.kt +++ b/libraries/stdlib/src/kotlin/nullable/Nullables.kt @@ -3,40 +3,40 @@ package kotlin.nullable import java.util.* /** Returns true if the element is not null and matches the given predicate */ -inline fun T?.any(predicate: (T)-> Boolean): Boolean { +public inline fun T?.any(predicate: (T)-> Boolean): Boolean { return this != null && predicate(this) } /** Returns true if the element is not null and matches the given predicate */ -inline fun T?.all(predicate: (T)-> Boolean): Boolean { +public inline fun T?.all(predicate: (T)-> Boolean): Boolean { return this != null && predicate(this) } /** Returns the 1 if the element is not null else 0 */ -inline fun T?.count(predicate: (T)-> Boolean): Int { +public inline fun T?.count(predicate: (T)-> Boolean): Int { return if (this != null) 1 else 0 } /** Returns the first item which matches the predicate if this element is not null else null */ -inline fun T?.find(predicate: (T)-> Boolean): T? { +public inline fun T?.find(predicate: (T)-> Boolean): T? { return if (this != null && predicate(this)) this else null } /** Returns a new List containing all elements in this collection which match the given predicate */ -inline fun T?.filter(predicate: (T)-> Boolean): T? = find(predicate) +public inline fun T?.filter(predicate: (T)-> Boolean): T? = find(predicate) /** Filters all elements in this collection which match the given predicate into the given result collection */ -inline fun > T?.filterTo(result: C, predicate: (T)-> Boolean): C { +public inline fun > T?.filterTo(result: C, predicate: (T)-> Boolean): C { if (this != null && predicate(this)) result.add(this) return result } /** Returns a List containing all the non null elements in this collection */ -inline fun T?.filterNotNull(): Collection = filterNotNullTo(java.util.ArrayList()) +public inline fun T?.filterNotNull(): Collection = filterNotNullTo(java.util.ArrayList()) /** Filters all the null elements in this collection winto the given result collection */ -inline fun > T?.filterNotNullTo(result: C): C { +public inline fun > T?.filterNotNullTo(result: C): C { if (this != null) { result.add(this) } @@ -44,10 +44,10 @@ inline fun > T?.filterNotNullTo(result: C): C { } /** Returns a new collection containing all elements in this collection which do not match the given predicate */ -inline fun T?.filterNot(predicate: (T)-> Boolean): Collection = filterNotTo(ArrayList(), predicate) +public inline fun T?.filterNot(predicate: (T)-> Boolean): Collection = filterNotTo(ArrayList(), predicate) /** Returns a new collection containing all elements in this collection which do not match the given predicate */ -inline fun > T?.filterNotTo(result: C, predicate: (T)-> Boolean): C { +public inline fun > T?.filterNotTo(result: C, predicate: (T)-> Boolean): C { if (this != null && !predicate(this)) { result.add(this) } @@ -58,7 +58,7 @@ inline fun > T?.filterNotTo(result: C, predicate: (T)-> B * Returns the result of transforming each item in the collection to a one or more values which * are concatenated together into a single collection */ -inline fun T?.flatMap(transform: (T)-> Collection): Collection { +public inline fun T?.flatMap(transform: (T)-> Collection): Collection { return flatMapTo(ArrayList(), transform) } @@ -66,7 +66,7 @@ inline fun T?.flatMap(transform: (T)-> Collection): Collection { * Returns the result of transforming each item in the collection to a one or more values which * are concatenated together into a single collection */ -inline fun T?.flatMapTo(result: Collection, transform: (T)-> Collection): Collection { +public inline fun T?.flatMapTo(result: Collection, transform: (T)-> Collection): Collection { if (this != null) { val coll = transform(this) if (coll != null) { @@ -79,7 +79,7 @@ inline fun T?.flatMapTo(result: Collection, transform: (T)-> Collectio } /** Performs the given operation on each element inside the collection */ -inline fun T?.forEach(operation: (element: T) -> Unit) { +public inline fun T?.forEach(operation: (element: T) -> Unit) { if (this != null) { operation(this) } @@ -91,7 +91,7 @@ inline fun T?.forEach(operation: (element: T) -> Unit) { * For example to sum together all numeric values in a collection of numbers it would be * {code}val total = numbers.fold(0){(a, b) -> a + b}{code} */ -inline fun T?.fold(initial: T, operation: (it: T, it2: T) -> T): T { +public inline fun T?.fold(initial: T, operation: (it: T, it2: T) -> T): T { return if (this != null) { operation(initial, this) } else { @@ -102,7 +102,7 @@ inline fun T?.fold(initial: T, operation: (it: T, it2: T) -> T): T { /** * Folds all the values from right to left with the initial value to perform the operation on sequential pairs of values */ -inline fun T?.foldRight(initial: T, operation: (it: T, it2: T) -> T): T { +public inline fun T?.foldRight(initial: T, operation: (it: T, it2: T) -> T): T { // maximum size is 1 so it makes no difference :) return fold(initial, operation) } @@ -111,7 +111,7 @@ inline fun T?.foldRight(initial: T, operation: (it: T, it2: T) -> T): T { * Iterates through the collection performing the transformation on each element and using the result * as the key in a map to group elements by the result */ -inline fun T?.groupBy(result: Map> = HashMap>(), toKey: (T)-> K): Map> { +public inline fun T?.groupBy(result: Map> = HashMap>(), toKey: (T)-> K): Map> { if (this != null) { val key = toKey(this) val list = result.getOrPut(key){ ArrayList() } @@ -122,7 +122,7 @@ inline fun T?.groupBy(result: Map> = HashMap>(), to /** Creates a String from the nullable or item with the given prefix and postfix if supplied */ -inline fun T?.join(separator: String, prefix: String = "", postfix: String = ""): String { +public inline fun T?.join(separator: String, prefix: String = "", postfix: String = ""): String { val buffer = StringBuilder(prefix) var first = true if (this != null) { @@ -134,7 +134,7 @@ inline fun T?.join(separator: String, prefix: String = "", postfix: String = /** Returns the nullable result of transforming this with the given transformation function */ -inline fun T?.map(transform : (T) -> R) : R? { +public inline fun T?.map(transform : (T) -> R) : R? { return if (this != null) { transform(this) } else { @@ -143,7 +143,7 @@ inline fun T?.map(transform : (T) -> R) : R? { } /** Transforms each element of this collection with the given function then adds the results to the given collection */ -inline fun > T?.mapTo(result: C, transform : (T) -> R) : C { +public inline fun > T?.mapTo(result: C, transform : (T) -> R) : C { if (this != null) { result.add(transform(this)) } @@ -151,31 +151,31 @@ inline fun > T?.mapTo(result: C, transform : (T) -> R) } /** Returns itself since it can't be reversed as it can contain at most one item */ -inline fun T?.reverse(): T? { +public inline fun T?.reverse(): T? { return this } /** Copies the collection into the given collection */ -inline fun > T?.to(result: C): C { +public inline fun > T?.to(result: C): C { if (this != null) result.add(this) return result } /** Converts the collection into a LinkedList */ -inline fun T?.toLinkedList(): LinkedList = this.to(LinkedList()) +public inline fun T?.toLinkedList(): LinkedList = this.to(LinkedList()) /** Converts the collection into a List */ -inline fun T?.toList(): List = this.to(ArrayList()) +public inline fun T?.toList(): List = this.to(ArrayList()) /** Converts the collection into a Set */ -inline fun T?.toSet(): Set = this.to(HashSet()) +public inline fun T?.toSet(): Set = this.to(HashSet()) /** Converts the collection into a SortedSet */ -inline fun T?.toSortedSet(): SortedSet = this.to(TreeSet()) +public inline fun T?.toSortedSet(): SortedSet = this.to(TreeSet()) /** TODO figure out necessary variance/generics ninja stuff... :) -inline fun T?.toSortedList(transform: fun(T) : java.lang.Comparable<*>) : List { +public inline fun T?.toSortedList(transform: fun(T) : java.lang.Comparable<*>) : List { val answer = this.toList() answer.sort(transform) return answer diff --git a/libraries/stdlib/src/kotlin/properties/Properties.kt b/libraries/stdlib/src/kotlin/properties/Properties.kt index 12f253d9ef2..afd65027ac3 100644 --- a/libraries/stdlib/src/kotlin/properties/Properties.kt +++ b/libraries/stdlib/src/kotlin/properties/Properties.kt @@ -10,11 +10,11 @@ import java.util.ArrayList public class ChangeEvent(val source: Any, val name: String, val oldValue: Any?, val newValue: Any?) { var propogationId: Any? = null - fun toString() = "ChangeEvent($name, $oldValue, $newValue)" + public fun toString() : String = "ChangeEvent($name, $oldValue, $newValue)" } public trait ChangeListener { - fun onPropertyChange(event: ChangeEvent): Unit + public fun onPropertyChange(event: ChangeEvent): Unit } /** @@ -27,14 +27,14 @@ public abstract class ChangeSupport { private var nameListeners: Map>? = null - fun addChangeListener(listener: ChangeListener) { + public fun addChangeListener(listener: ChangeListener) { if (allListeners == null) { allListeners = ArrayList() } allListeners?.add(listener) } - fun addChangeListener(name: String, listener: ChangeListener) { + public fun addChangeListener(name: String, listener: ChangeListener) { if (nameListeners == null) { nameListeners = HashMap>() } @@ -68,12 +68,12 @@ public abstract class ChangeSupport { } } - fun onPropertyChange(fn: (ChangeEvent) -> Unit) { + public fun onPropertyChange(fn: (ChangeEvent) -> Unit) { // TODO //addChangeListener(DelegateChangeListener(fn)) } - fun onPropertyChange(name: String, fn: (ChangeEvent) -> Unit) { + public fun onPropertyChange(name: String, fn: (ChangeEvent) -> Unit) { // TODO //addChangeListener(name, DelegateChangeListener(fn)) } @@ -89,7 +89,7 @@ see http://youtrack.jetbrains.com/issue/KT-1362 protected fun createChangeListener(fn: (ChangeEvent) -> Unit): ChangeListener { return ChangeListener { - override fun onPropertyChange(event: ChangeEvent): Unit { + public override fun onPropertyChange(event: ChangeEvent): Unit { fn(event) } } @@ -99,7 +99,7 @@ see http://youtrack.jetbrains.com/issue/KT-1362 class DelegateChangeListener(val f: (ChangeEvent) -> Unit) : ChangeListener { - override fun onPropertyChange(event: ChangeEvent): Unit { + public override fun onPropertyChange(event: ChangeEvent): Unit { f(event) } } diff --git a/libraries/stdlib/src/kotlin/template/Templates.kt b/libraries/stdlib/src/kotlin/template/Templates.kt index 4d55394e46c..d81171176d6 100644 --- a/libraries/stdlib/src/kotlin/template/Templates.kt +++ b/libraries/stdlib/src/kotlin/template/Templates.kt @@ -15,7 +15,7 @@ class StringTemplate(val values : Array) { /** * Converts the template into a String */ - fun toString() : String { + public fun toString() : String { val out = StringBuilder() forEach{ out.append(it) } return out.toString() ?: "" @@ -24,7 +24,7 @@ class StringTemplate(val values : Array) { /** * Performs the given function on each value in the collection */ - fun forEach(fn : (Any?) -> Unit) : Unit { + public fun forEach(fn : (Any?) -> Unit) : Unit { for (v in values) { fn(v) } @@ -38,7 +38,7 @@ class StringTemplate(val values : Array) { * * See [[HtmlFormatter] and [[LocaleFormatter] respectively. */ -fun StringTemplate.toString(formatter : Formatter) : String { +public fun StringTemplate.toString(formatter : Formatter) : String { val buffer = StringBuilder() append(buffer, formatter) return buffer.toString() ?: "" @@ -48,7 +48,7 @@ fun StringTemplate.toString(formatter : Formatter) : String { * Appends the text representation of this string template to the given output * using the supplied formatter */ -fun StringTemplate.append(out : Appendable, formatter : Formatter) : Unit { +public fun StringTemplate.append(out : Appendable, formatter : Formatter) : Unit { var constantText = true this.forEach { if (constantText) { @@ -71,33 +71,33 @@ fun StringTemplate.append(out : Appendable, formatter : Formatter) : Unit { * Converts this string template to internationalised text using the supplied * [[LocaleFormatter]] */ -fun StringTemplate.toLocale(formatter : LocaleFormatter = LocaleFormatter()) : String = toString(formatter) +public fun StringTemplate.toLocale(formatter : LocaleFormatter = LocaleFormatter()) : String = toString(formatter) /** * Converts this string template to HTML text */ -fun StringTemplate.toHtml(formatter : HtmlFormatter = HtmlFormatter()) : String = toString(formatter) +public fun StringTemplate.toHtml(formatter : HtmlFormatter = HtmlFormatter()) : String = toString(formatter) /** * Represents a formatter and encoder of values in a [[StringTemplate]] which understands * how to format values for a particular [[Locale]] such as with the [[LocaleFormatter]] or * to escape particular characters in different output formats such as [[HtmlFormatter] */ -trait Formatter { - fun format(buffer : Appendable, val value : Any?) : Unit +public trait Formatter { + public fun format(buffer : Appendable, val value : Any?) : Unit } /** * Formats strings with no special encoding other than allowing the null text to be * configured */ -open class ToStringFormatter : Formatter { +public open class ToStringFormatter : Formatter { var nullString : String = "null" - open fun toString() = "ToStringFormatter" + public open fun toString() : String = "ToStringFormatter" - override fun format(out : Appendable, value : Any?) { + public override fun format(out : Appendable, value : Any?) { if (value == null) { format(out, nullString) } else if (value is StringTemplate) { @@ -111,25 +111,25 @@ open class ToStringFormatter : Formatter { * Formats the given string allowing derived classes to override this method * to escape strings with special characters such as for HTML */ - open fun format(out : Appendable, text : String) : Unit { + public open fun format(out : Appendable, text : String) : Unit { out.append(text) } } -protected val defaultLocale : Locale = Locale.getDefault().sure() +public val defaultLocale : Locale = Locale.getDefault().sure() /** * Formats values using a given [[Locale]] for internationalisation */ -open class LocaleFormatter(val locale : Locale = defaultLocale) : ToStringFormatter() { +public open class LocaleFormatter(val locale : Locale = defaultLocale) : ToStringFormatter() { - override fun toString() = "LocaleFormatter{$locale}" + public override fun toString() : String = "LocaleFormatter{$locale}" public var numberFormat : NumberFormat = NumberFormat.getInstance(locale).sure() public var dateFormat : DateFormat = DateFormat.getDateTimeInstance(DateFormat.DEFAULT, DateFormat.DEFAULT, locale).sure() - override fun format(out : Appendable, value : Any?) { + public override fun format(out : Appendable, value : Any?) { if (value is Number) { format(out, format(value)) } else if (value is Date) { @@ -139,11 +139,11 @@ open class LocaleFormatter(val locale : Locale = defaultLocale) : ToStringFormat } } - fun format(number : Number) : String { + public fun format(number : Number) : String { return numberFormat.format(number) ?: "" } - fun format(date : Date) : String { + public fun format(date : Date) : String { return dateFormat.format(date) ?: "" } } @@ -151,11 +151,11 @@ open class LocaleFormatter(val locale : Locale = defaultLocale) : ToStringFormat /** * Formats values for HTML encoding, escaping special characters in HTML. */ -class HtmlFormatter(locale : Locale = defaultLocale) : LocaleFormatter(locale) { +public class HtmlFormatter(locale : Locale = defaultLocale) : LocaleFormatter(locale) { - override fun toString() = "HtmlFormatter{$locale}" + public override fun toString() : String = "HtmlFormatter{$locale}" - override fun format(out : Appendable, value : Any?) { + public override fun format(out : Appendable, value : Any?) { if (value is Node) { out.append(value.toXmlString()) } else { @@ -163,7 +163,7 @@ class HtmlFormatter(locale : Locale = defaultLocale) : LocaleFormatter(locale) { } } - override fun format(buffer : Appendable, text : String) : Unit { + public override fun format(buffer : Appendable, text : String) : Unit { for (c in text) { if (c == '<') buffer.append("<") else if (c == '>') buffer.append(">") diff --git a/libraries/stdlib/src/kotlin/test/Test.kt b/libraries/stdlib/src/kotlin/test/Test.kt index df03b48b3b6..5183ac193c4 100644 --- a/libraries/stdlib/src/kotlin/test/Test.kt +++ b/libraries/stdlib/src/kotlin/test/Test.kt @@ -31,65 +31,65 @@ public var asserter: Asserter } /** Asserts that the given block returns true */ -inline fun assertTrue(message: String, block: ()-> Boolean) { +public inline fun assertTrue(message: String, block: ()-> Boolean) { val actual = block() asserter.assertTrue(message, actual) } /** Asserts that the given block returns true */ -inline fun assertTrue(block: ()-> Boolean) = assertTrue(block.toString(), block) +public inline fun assertTrue(block: ()-> Boolean) : Unit = assertTrue(block.toString(), block) /** Asserts that the given block returns false */ -inline fun assertNot(message: String, block: ()-> Boolean) { +public inline fun assertNot(message: String, block: ()-> Boolean) { assertTrue(message){ !block() } } /** Asserts that the given block returns true */ -inline fun assertNot(block: ()-> Boolean) = assertNot(block.toString(), block) +public inline fun assertNot(block: ()-> Boolean) : Unit = assertNot(block.toString(), block) /** Asserts that the expression is true with an optional message */ -inline fun assertTrue(actual: Boolean, message: String = "") { +public inline fun assertTrue(actual: Boolean, message: String = "") { return assertEquals(true, actual, message) } /** Asserts that the expression is false with an optional message */ -inline fun assertFalse(actual: Boolean, message: String = "") { +public inline fun assertFalse(actual: Boolean, message: String = "") { return assertEquals(false, actual, message) } /** Asserts that the expected value is equal to the actual value, with an optional message */ -inline fun assertEquals(expected: Any?, actual: Any?, message: String = "") { +public inline fun assertEquals(expected: Any?, actual: Any?, message: String = "") { asserter.assertEquals(message, expected, actual) } /** Asserts that the expression is not null, with an optional message */ -inline fun assertNotNull(actual: Any?, message: String = "") { +public inline fun assertNotNull(actual: Any?, message: String = "") { asserter.assertNotNull(message, actual) } /** Asserts that the expression is null, with an optional message */ -inline fun assertNull(actual: Any?, message: String = "") { +public inline fun assertNull(actual: Any?, message: String = "") { asserter.assertNull(message, actual) } /** Marks a test as having failed if this point in the execution path is reached, with an optional message */ -inline fun fail(message: String = "") { +public inline fun fail(message: String = "") { asserter.fail(message) } /** Asserts that given function block returns the given expected value */ -inline fun expect(expected: T, block: ()-> T) { +public inline fun expect(expected: T, block: ()-> T) { expect(expected, block.toString(), block) } /** Asserts that given function block returns the given expected value and use the given message if it fails */ -inline fun expect(expected: T, message: String, block: ()-> T) { +public inline fun expect(expected: T, message: String, block: ()-> T) { val actual = block() assertEquals(expected, actual, message) } /** Asserts that given function block fails by throwing an exception */ -fun fails(block: ()-> Unit): Throwable? { +public fun fails(block: ()-> Unit): Throwable? { try { block() asserter.fail("Expected an exception to be thrown") @@ -101,7 +101,7 @@ fun fails(block: ()-> Unit): Throwable? { } /** Asserts that a block fails with a specific exception being thrown */ -fun failsWith(block: ()-> Unit) { +public fun failsWith(block: ()-> Unit) { try { block() asserter.fail("Expected an exception to be thrown") @@ -115,7 +115,7 @@ fun failsWith(block: ()-> Unit) { * Comments out a block of test code until it is implemented while keeping a link to the code * to implement in your unit test output */ -inline fun todo(block: ()-> Any) { +public inline fun todo(block: ()-> Any) { println("TODO at " + (Exception() as java.lang.Throwable).getStackTrace()?.get(1) + " for " + block) } @@ -123,15 +123,15 @@ inline fun todo(block: ()-> Any) { * A plugin for performing assertions which can reuse JUnit or TestNG */ trait Asserter { - fun assertTrue(message: String, actual: Boolean): Unit + public fun assertTrue(message: String, actual: Boolean): Unit - fun assertEquals(message: String, expected: Any?, actual: Any?): Unit + public fun assertEquals(message: String, expected: Any?, actual: Any?): Unit - fun assertNotNull(message: String, actual: Any?): Unit + public fun assertNotNull(message: String, actual: Any?): Unit - fun assertNull(message: String, actual: Any?): Unit + public fun assertNull(message: String, actual: Any?): Unit - fun fail(message: String): Unit + public fun fail(message: String): Unit } /** @@ -139,30 +139,30 @@ trait Asserter { */ class DefaultAsserter() : Asserter { - override fun assertTrue(message : String, actual : Boolean) { + public override fun assertTrue(message : String, actual : Boolean) { if (!actual) { fail(message) } } - override fun assertEquals(message : String, expected : Any?, actual : Any?) { + public override fun assertEquals(message : String, expected : Any?, actual : Any?) { if (expected != actual) { fail("$message. Expected <$expected> actual <$actual>") } } - override fun assertNotNull(message : String, actual : Any?) { + public override fun assertNotNull(message : String, actual : Any?) { if (actual == null) { fail(message) } } - override fun assertNull(message : String, actual : Any?) { + public override fun assertNull(message : String, actual : Any?) { if (actual != null) { fail(message) } } - override fun fail(message : String) { + public override fun fail(message : String) { // TODO work around compiler bug as it should never try call the private constructor throw AssertionError(message as Object) } diff --git a/libraries/stdlib/src/kotlin/util/System.kt b/libraries/stdlib/src/kotlin/util/System.kt index af27fe41cd1..d2f9dfc5a10 100644 --- a/libraries/stdlib/src/kotlin/util/System.kt +++ b/libraries/stdlib/src/kotlin/util/System.kt @@ -3,7 +3,7 @@ package kotlin.util /** Executes current block and returns elapsed time in milliseconds */ -fun measureTimeMillis(block: () -> Unit) : Long { +public fun measureTimeMillis(block: () -> Unit) : Long { val start = System.currentTimeMillis() block() return System.currentTimeMillis() - start @@ -12,7 +12,7 @@ fun measureTimeMillis(block: () -> Unit) : Long { /** Executes current block and returns elapsed time in nanoseconds */ -fun measureTimeNano(block: () -> Unit) : Long { +public fun measureTimeNano(block: () -> Unit) : Long { val start = System.nanoTime() block() return System.nanoTime() - start diff --git a/libraries/stdlib/test/Test.kt b/libraries/stdlib/test/Test.kt index 14913d41086..cb74e35f5d9 100644 --- a/libraries/stdlib/test/Test.kt +++ b/libraries/stdlib/test/Test.kt @@ -10,7 +10,7 @@ import org.junit.* import org.junit.runner.* import org.junit.runner.notification.* -protected class TestBuilt(name: String, val builder: TestBuilder, val test: TestBuilt.() -> Unit) : TestCase(name) { +class TestBuilt(name: String, val builder: TestBuilder, val test: TestBuilt.() -> Unit) : TestCase(name) { private var myState: T? = null var state : T