[Generator] Do not use explicit final modifier in Native primitive classes

'final' is the default modality, safe to omit
This commit is contained in:
Ilya Gorbunov
2023-08-29 05:02:35 +02:00
committed by Space Team
parent 8ae21c0e1b
commit 78ef58f59d
3 changed files with 6 additions and 12 deletions
@@ -16,10 +16,6 @@ class NativePrimitivesGenerator(writer: PrintWriter) : BasePrimitivesGenerator(w
import("kotlin.native.internal.*") import("kotlin.native.internal.*")
} }
override fun ClassBuilder.modifyGeneratedClass(thisKind: PrimitiveType) {
this.isFinal = true
}
override fun CompanionObjectBuilder.modifyGeneratedCompanionObject(thisKind: PrimitiveType) { override fun CompanionObjectBuilder.modifyGeneratedCompanionObject(thisKind: PrimitiveType) {
if (thisKind !in PrimitiveType.floatingPoint) { if (thisKind !in PrimitiveType.floatingPoint) {
annotations += "CanBePrecreated" annotations += "CanBePrecreated"
@@ -133,7 +133,6 @@ internal class FileBuilder(private val builtBy: String) : PrimitiveBuilder {
} }
internal class ClassBuilder : AnnotatedAndDocumented(), PrimitiveBuilder { internal class ClassBuilder : AnnotatedAndDocumented(), PrimitiveBuilder {
var isFinal: Boolean = false
var name: String = "" var name: String = ""
private var primaryConstructor: PrimaryConstructorBuilder = PrimaryConstructorBuilder() private var primaryConstructor: PrimaryConstructorBuilder = PrimaryConstructorBuilder()
private var secondaryConstructor: SecondaryConstructorBuilder? = null private var secondaryConstructor: SecondaryConstructorBuilder? = null
@@ -175,7 +174,6 @@ internal class ClassBuilder : AnnotatedAndDocumented(), PrimitiveBuilder {
this.printDocumentationAndAnnotations() this.printDocumentationAndAnnotations()
append("public ") append("public ")
if (isFinal) append("final ")
appendLine("class $name ${primaryConstructor.build()}: ${superTypes.joinToString()} {") appendLine("class $name ${primaryConstructor.build()}: ${superTypes.joinToString()} {")
secondaryConstructor?.let { secondaryConstructor?.let {
@@ -13,7 +13,7 @@ package kotlin
import kotlin.native.internal.* import kotlin.native.internal.*
/** Represents a 8-bit signed integer. */ /** Represents a 8-bit signed integer. */
public final class Byte private constructor() : Number(), Comparable<Byte> { public class Byte private constructor() : Number(), Comparable<Byte> {
@CanBePrecreated @CanBePrecreated
companion object { companion object {
/** /**
@@ -446,7 +446,7 @@ public final class Byte private constructor() : Number(), Comparable<Byte> {
} }
/** Represents a 16-bit signed integer. */ /** Represents a 16-bit signed integer. */
public final class Short private constructor() : Number(), Comparable<Short> { public class Short private constructor() : Number(), Comparable<Short> {
@CanBePrecreated @CanBePrecreated
companion object { companion object {
/** /**
@@ -877,7 +877,7 @@ public final class Short private constructor() : Number(), Comparable<Short> {
} }
/** Represents a 32-bit signed integer. */ /** Represents a 32-bit signed integer. */
public final class Int private constructor() : Number(), Comparable<Int> { public class Int private constructor() : Number(), Comparable<Int> {
@CanBePrecreated @CanBePrecreated
companion object { companion object {
/** /**
@@ -1361,7 +1361,7 @@ public final class Int private constructor() : Number(), Comparable<Int> {
} }
/** Represents a 64-bit signed integer. */ /** Represents a 64-bit signed integer. */
public final class Long private constructor() : Number(), Comparable<Long> { public class Long private constructor() : Number(), Comparable<Long> {
@CanBePrecreated @CanBePrecreated
companion object { companion object {
/** /**
@@ -1848,7 +1848,7 @@ public final class Long private constructor() : Number(), Comparable<Long> {
} }
/** Represents a single-precision 32-bit IEEE 754 floating point number. */ /** Represents a single-precision 32-bit IEEE 754 floating point number. */
public final class Float private constructor() : Number(), Comparable<Float> { public class Float private constructor() : Number(), Comparable<Float> {
companion object { companion object {
/** /**
* A constant holding the smallest *positive* nonzero value of Float. * A constant holding the smallest *positive* nonzero value of Float.
@@ -2259,7 +2259,7 @@ public final class Float private constructor() : Number(), Comparable<Float> {
} }
/** Represents a double-precision 64-bit IEEE 754 floating point number. */ /** Represents a double-precision 64-bit IEEE 754 floating point number. */
public final class Double private constructor() : Number(), Comparable<Double> { public class Double private constructor() : Number(), Comparable<Double> {
companion object { companion object {
/** /**
* A constant holding the smallest *positive* nonzero value of Double. * A constant holding the smallest *positive* nonzero value of Double.