From 4a0b78f7b4afcd689e76f0c6cca76e6d8ad528ff Mon Sep 17 00:00:00 2001 From: Nikolay Igotti Date: Fri, 11 Nov 2016 17:35:37 +0300 Subject: [PATCH] Make builtin classes final. (#53) --- runtime/src/main/kotlin/kotlin/Array.kt | 2 +- runtime/src/main/kotlin/kotlin/Boolean.kt | 2 +- runtime/src/main/kotlin/kotlin/Char.kt | 2 +- runtime/src/main/kotlin/kotlin/Nothing.kt | 2 +- runtime/src/main/kotlin/kotlin/Primitives.kt | 12 ++++++------ runtime/src/main/kotlin/kotlin/String.kt | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/runtime/src/main/kotlin/kotlin/Array.kt b/runtime/src/main/kotlin/kotlin/Array.kt index 113d191d870..2cdce34e0d0 100644 --- a/runtime/src/main/kotlin/kotlin/Array.kt +++ b/runtime/src/main/kotlin/kotlin/Array.kt @@ -2,7 +2,7 @@ package kotlin // TODO: remove that, as RTTI shall be per instantiation. @ExportTypeInfo("theArrayTypeInfo") -class Array : Cloneable { +public final class Array : Cloneable { // Constructors are handled with compiler magic. public constructor(@Suppress("UNUSED_PARAMETER") size: Int) {} diff --git a/runtime/src/main/kotlin/kotlin/Boolean.kt b/runtime/src/main/kotlin/kotlin/Boolean.kt index b7768404738..61e30e8915b 100644 --- a/runtime/src/main/kotlin/kotlin/Boolean.kt +++ b/runtime/src/main/kotlin/kotlin/Boolean.kt @@ -4,7 +4,7 @@ package kotlin * Represents a value which is either `true` or `false`. On the JVM, non-nullable values of this type are * represented as values of the primitive type `boolean`. */ -public class Boolean : Comparable { +public final class Boolean : Comparable { /** * Returns the inverse of this boolean. */ diff --git a/runtime/src/main/kotlin/kotlin/Char.kt b/runtime/src/main/kotlin/kotlin/Char.kt index a5452977654..4a7affd4f6b 100644 --- a/runtime/src/main/kotlin/kotlin/Char.kt +++ b/runtime/src/main/kotlin/kotlin/Char.kt @@ -4,7 +4,7 @@ package kotlin * Represents a 16-bit Unicode character. * On the JVM, non-nullable values of this type are represented as values of the primitive type `char`. */ -public class Char : Comparable { +public final class Char : Comparable { /** * Compares this value with the specified value for order. diff --git a/runtime/src/main/kotlin/kotlin/Nothing.kt b/runtime/src/main/kotlin/kotlin/Nothing.kt index 92a1ab872d1..bcba68c33aa 100644 --- a/runtime/src/main/kotlin/kotlin/Nothing.kt +++ b/runtime/src/main/kotlin/kotlin/Nothing.kt @@ -4,4 +4,4 @@ package kotlin * Nothing has no instances. You can use Nothing to represent "a value that never exists": for example, * if a function has the return type of Nothing, it means that it never returns (always throws an exception). */ -public class Nothing private constructor() {} +public final class Nothing private constructor() {} diff --git a/runtime/src/main/kotlin/kotlin/Primitives.kt b/runtime/src/main/kotlin/kotlin/Primitives.kt index f6b75e34dc8..9bbad80bff1 100644 --- a/runtime/src/main/kotlin/kotlin/Primitives.kt +++ b/runtime/src/main/kotlin/kotlin/Primitives.kt @@ -4,7 +4,7 @@ package kotlin * Represents a 8-bit signed integer. * On the JVM, non-nullable values of this type are represented as values of the primitive type `byte`. */ -public class Byte : Number(), Comparable { +public final class Byte : Number(), Comparable { companion object { /** * A constant holding the minimum value an instance of Byte can have. @@ -201,7 +201,7 @@ public class Byte : Number(), Comparable { * Represents a 16-bit signed integer. * On the JVM, non-nullable values of this type are represented as values of the primitive type `short`. */ -public class Short : Number(), Comparable { +public final class Short : Number(), Comparable { companion object { /** * A constant holding the minimum value an instance of Short can have. @@ -398,7 +398,7 @@ public class Short : Number(), Comparable { * Represents a 32-bit signed integer. * On the JVM, non-nullable values of this type are represented as values of the primitive type `int`. */ -public class Int : Number(), Comparable { +public final class Int : Number(), Comparable { companion object { /** * A constant holding the minimum value an instance of Int can have. @@ -617,7 +617,7 @@ public class Int : Number(), Comparable { * Represents a 64-bit signed integer. * On the JVM, non-nullable values of this type are represented as values of the primitive type `long`. */ -public class Long : Number(), Comparable { +public final class Long : Number(), Comparable { companion object { /** * A constant holding the minimum value an instance of Long can have. @@ -836,7 +836,7 @@ public class Long : Number(), Comparable { * Represents a single-precision 32-bit IEEE 754 floating point number. * On the JVM, non-nullable values of this type are represented as values of the primitive type `float`. */ -public class Float : Number(), Comparable { +public final class Float : Number(), Comparable { companion object { /** * A constant holding the smallest *positive* nonzero value of Float. @@ -1040,7 +1040,7 @@ public class Float : Number(), Comparable { * Represents a double-precision 64-bit IEEE 754 floating point number. * On the JVM, non-nullable values of this type are represented as values of the primitive type `double`. */ -public class Double : Number(), Comparable { +public final class Double : Number(), Comparable { companion object { /** * A constant holding the smallest *positive* nonzero value of Double. diff --git a/runtime/src/main/kotlin/kotlin/String.kt b/runtime/src/main/kotlin/kotlin/String.kt index 75708cc9957..7ac864ab547 100644 --- a/runtime/src/main/kotlin/kotlin/String.kt +++ b/runtime/src/main/kotlin/kotlin/String.kt @@ -4,7 +4,7 @@ package kotlin external fun fromUtf8Array(array: ByteArray) : String @ExportTypeInfo("theStringTypeInfo") -class String : Comparable, CharSequence { +public final class String : Comparable, CharSequence { @SymbolName("Kotlin_String_hashCode") external public override fun hashCode(): Int