Intrinsic default objects implementation
This commit is contained in:
@@ -22,6 +22,8 @@ package kotlin
|
||||
* information on enum classes.
|
||||
*/
|
||||
public abstract class Enum<E : Enum<E>>(name: String, ordinal: Int): Comparable<E> {
|
||||
class object {}
|
||||
|
||||
/**
|
||||
* Returns the name of this enum constant, exactly as declared in its enum declaration.
|
||||
*/
|
||||
|
||||
@@ -61,6 +61,8 @@ public abstract class Number {
|
||||
* values of this type are represented as values of the primitive type `double`.
|
||||
*/
|
||||
public class Double private () : Number, Comparable<Double> {
|
||||
class object : FloatingPointConstants<Double> {}
|
||||
|
||||
public override fun compareTo(other: Double): Int
|
||||
public fun compareTo(other: Float): Int
|
||||
public fun compareTo(other: Long) : Int
|
||||
@@ -135,6 +137,8 @@ public class Double private () : Number, Comparable<Double> {
|
||||
* values of this type are represented as values of the primitive type `float`.
|
||||
*/
|
||||
public class Float private () : Number, Comparable<Float> {
|
||||
class object : FloatingPointConstants<Float> {}
|
||||
|
||||
public fun compareTo(other: Double): Int
|
||||
public override fun compareTo(other: Float): Int
|
||||
public fun compareTo(other: Long) : Int
|
||||
@@ -210,6 +214,8 @@ public class Float private () : Number, Comparable<Float> {
|
||||
* as values of the primitive type `long`.
|
||||
*/
|
||||
public class Long private () : Number, Comparable<Long> {
|
||||
class object {}
|
||||
|
||||
public fun compareTo(other: Double): Int
|
||||
public fun compareTo(other: Float) : Int
|
||||
public override fun compareTo(other: Long): Int
|
||||
@@ -293,6 +299,8 @@ public class Long private () : Number, Comparable<Long> {
|
||||
* as values of the primitive type `int`.
|
||||
*/
|
||||
public class Int private () : Number, Comparable<Int> {
|
||||
class object {}
|
||||
|
||||
public fun compareTo(other: Double): Int
|
||||
public fun compareTo(other: Float) : Int
|
||||
public fun compareTo(other: Long) : Int
|
||||
@@ -376,6 +384,8 @@ public class Int private () : Number, Comparable<Int> {
|
||||
* as values of the primitive type `short`.
|
||||
*/
|
||||
public class Short private () : Number, Comparable<Short> {
|
||||
class object {}
|
||||
|
||||
public fun compareTo(other: Double): Int
|
||||
public fun compareTo(other: Float) : Int
|
||||
public fun compareTo(other: Long) : Int
|
||||
@@ -451,6 +461,8 @@ public class Short private () : Number, Comparable<Short> {
|
||||
* as values of the primitive type `byte`.
|
||||
*/
|
||||
public class Byte private () : Number, Comparable<Byte> {
|
||||
class object {}
|
||||
|
||||
public fun compareTo(other: Double): Int
|
||||
public fun compareTo(other: Float) : Int
|
||||
public fun compareTo(other: Long) : Int
|
||||
|
||||
@@ -21,6 +21,8 @@ package kotlin
|
||||
* implemented as instances of this class.
|
||||
*/
|
||||
public class String : Comparable<String>, CharSequence {
|
||||
class object {}
|
||||
|
||||
/**
|
||||
* Returns a string obtained by concatenating this string with the string representation of the given [other] object.
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright 2010-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package kotlin
|
||||
|
||||
public trait FloatingPointConstants<T> {
|
||||
public val POSITIVE_INFINITY: T
|
||||
public val NEGATIVE_INFINITY: T
|
||||
public val NaN: T
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright 2010-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package kotlin.jvm.internal
|
||||
|
||||
private object DoubleDefaultObject : FloatingPointConstants<Double> {
|
||||
override val POSITIVE_INFINITY : Double = java.lang.Double.POSITIVE_INFINITY
|
||||
override val NEGATIVE_INFINITY : Double = java.lang.Double.NEGATIVE_INFINITY
|
||||
override val NaN : Double = java.lang.Double.NaN
|
||||
}
|
||||
|
||||
private object FloatDefaultObject : FloatingPointConstants<Float> {
|
||||
override val POSITIVE_INFINITY : Float = java.lang.Float.POSITIVE_INFINITY
|
||||
override val NEGATIVE_INFINITY : Float = java.lang.Float.NEGATIVE_INFINITY
|
||||
override val NaN : Float = java.lang.Float.NaN
|
||||
}
|
||||
|
||||
private object IntDefaultObject {}
|
||||
private object LongDefaultObject {}
|
||||
private object ShortDefaultObject {}
|
||||
private object ByteDefaultObject {}
|
||||
|
||||
private object StringDefaultObject {}
|
||||
private object EnumDefaultObject {}
|
||||
Reference in New Issue
Block a user