Rename inline class -> @JvmInline value class in stdlib and compiler
This commit is contained in:
@@ -11,7 +11,8 @@ import org.jetbrains.kotlin.fir.PrivateForInline
|
||||
* [Map] which allows store null values
|
||||
*/
|
||||
@OptIn(PrivateForInline::class)
|
||||
internal inline class NullableMap<KEY, VALUE>(private val map: MutableMap<KEY, Any> = HashMap()) {
|
||||
@JvmInline
|
||||
internal value class NullableMap<KEY, VALUE>(private val map: MutableMap<KEY, Any> = HashMap()) {
|
||||
|
||||
/**
|
||||
* Get value if it is present in map
|
||||
|
||||
+2
-1
@@ -5,7 +5,8 @@
|
||||
|
||||
package org.jetbrains.kotlin.backend.common.serialization.encodings
|
||||
|
||||
inline class BinaryCoordinates(private val decoded: BinaryLattice) {
|
||||
@JvmInline
|
||||
value class BinaryCoordinates(private val decoded: BinaryLattice) {
|
||||
private fun diff(): Int = decoded.second
|
||||
|
||||
val startOffset: Int get() = decoded.first
|
||||
|
||||
+16
-8
@@ -17,7 +17,8 @@ import org.jetbrains.kotlin.serialization.deserialization.descriptorVisibility
|
||||
import org.jetbrains.kotlin.serialization.deserialization.memberKind
|
||||
import org.jetbrains.kotlin.types.Variance
|
||||
|
||||
inline class ClassFlags(val flags: Long) {
|
||||
@JvmInline
|
||||
value class ClassFlags(val flags: Long) {
|
||||
|
||||
val modality: Modality get() = ProtoEnumFlags.modality(IrFlags.MODALITY.get(flags.toInt()))
|
||||
val visibility: DescriptorVisibility get() = ProtoEnumFlags.descriptorVisibility(IrFlags.VISIBILITY.get(flags.toInt()))
|
||||
@@ -50,7 +51,8 @@ inline class ClassFlags(val flags: Long) {
|
||||
}
|
||||
}
|
||||
|
||||
inline class FunctionFlags(val flags: Long) {
|
||||
@JvmInline
|
||||
value class FunctionFlags(val flags: Long) {
|
||||
|
||||
val modality: Modality get() = ProtoEnumFlags.modality(IrFlags.MODALITY.get(flags.toInt()))
|
||||
val visibility: DescriptorVisibility get() = ProtoEnumFlags.descriptorVisibility(IrFlags.VISIBILITY.get(flags.toInt()))
|
||||
@@ -100,7 +102,8 @@ inline class FunctionFlags(val flags: Long) {
|
||||
}
|
||||
}
|
||||
|
||||
inline class PropertyFlags(val flags: Long) {
|
||||
@JvmInline
|
||||
value class PropertyFlags(val flags: Long) {
|
||||
|
||||
val modality: Modality get() = ProtoEnumFlags.modality(IrFlags.MODALITY.get(flags.toInt()))
|
||||
val visibility: DescriptorVisibility get() = ProtoEnumFlags.descriptorVisibility(IrFlags.VISIBILITY.get(flags.toInt()))
|
||||
@@ -138,7 +141,8 @@ inline class PropertyFlags(val flags: Long) {
|
||||
}
|
||||
}
|
||||
|
||||
inline class ValueParameterFlags(val flags: Long) {
|
||||
@JvmInline
|
||||
value class ValueParameterFlags(val flags: Long) {
|
||||
|
||||
val isCrossInline: Boolean get() = IrFlags.IS_CROSSINLINE.get(flags.toInt())
|
||||
val isNoInline: Boolean get() = IrFlags.IS_NOINLINE.get(flags.toInt())
|
||||
@@ -163,7 +167,8 @@ inline class ValueParameterFlags(val flags: Long) {
|
||||
}
|
||||
}
|
||||
|
||||
inline class TypeAliasFlags(val flags: Long) {
|
||||
@JvmInline
|
||||
value class TypeAliasFlags(val flags: Long) {
|
||||
|
||||
val visibility: DescriptorVisibility get() = ProtoEnumFlags.descriptorVisibility(IrFlags.VISIBILITY.get(flags.toInt()))
|
||||
val isActual: Boolean get() = IrFlags.IS_ACTUAL.get(flags.toInt())
|
||||
@@ -180,7 +185,8 @@ inline class TypeAliasFlags(val flags: Long) {
|
||||
}
|
||||
}
|
||||
|
||||
inline class TypeParameterFlags(val flags: Long) {
|
||||
@JvmInline
|
||||
value class TypeParameterFlags(val flags: Long) {
|
||||
|
||||
val variance: Variance get() = ProtoEnumFlags.variance(IrFlags.VARIANCE.get(flags.toInt()))
|
||||
val isReified: Boolean get() = IrFlags.IS_REIFIED.get(flags.toInt())
|
||||
@@ -197,7 +203,8 @@ inline class TypeParameterFlags(val flags: Long) {
|
||||
}
|
||||
}
|
||||
|
||||
inline class FieldFlags(val flags: Long) {
|
||||
@JvmInline
|
||||
value class FieldFlags(val flags: Long) {
|
||||
|
||||
val visibility: DescriptorVisibility get() = ProtoEnumFlags.descriptorVisibility(IrFlags.VISIBILITY.get(flags.toInt()))
|
||||
val isFinal: Boolean get() = IrFlags.IS_FINAL.get(flags.toInt())
|
||||
@@ -216,7 +223,8 @@ inline class FieldFlags(val flags: Long) {
|
||||
}
|
||||
}
|
||||
|
||||
inline class LocalVariableFlags(val flags: Long) {
|
||||
@JvmInline
|
||||
value class LocalVariableFlags(val flags: Long) {
|
||||
|
||||
val isVar: Boolean get() = IrFlags.IS_LOCAL_VAR.get(flags.toInt())
|
||||
val isConst: Boolean get() = IrFlags.IS_LOCAL_CONST.get(flags.toInt())
|
||||
|
||||
+2
-1
@@ -11,7 +11,8 @@ package org.jetbrains.kotlin.backend.common.serialization.encodings
|
||||
* j = j1.j2.j3.j4
|
||||
* ij -> i1.j1.i2.j2.i3.j3.i4.j4
|
||||
*/
|
||||
inline class BinaryLattice(private val code: Long) {
|
||||
@JvmInline
|
||||
value class BinaryLattice(private val code: Long) {
|
||||
|
||||
val first: Int get() = decodeInt(code)
|
||||
val second: Int get() = decodeInt(code ushr 1)
|
||||
|
||||
+2
-1
@@ -5,7 +5,8 @@
|
||||
|
||||
package org.jetbrains.kotlin.backend.common.serialization.encodings
|
||||
|
||||
inline class BinaryNameAndType(private val decoded: BinaryLattice) {
|
||||
@JvmInline
|
||||
value class BinaryNameAndType(private val decoded: BinaryLattice) {
|
||||
val nameIndex: Int get() = decoded.first
|
||||
val typeIndex: Int get() = decoded.second
|
||||
|
||||
|
||||
+2
-1
@@ -5,7 +5,8 @@
|
||||
|
||||
package org.jetbrains.kotlin.backend.common.serialization.encodings
|
||||
|
||||
inline class BinarySymbolData(val code: Long) {
|
||||
@JvmInline
|
||||
value class BinarySymbolData(val code: Long) {
|
||||
enum class SymbolKind {
|
||||
FUNCTION_SYMBOL,
|
||||
CONSTRUCTOR_SYMBOL,
|
||||
|
||||
+2
-1
@@ -7,7 +7,8 @@ package org.jetbrains.kotlin.backend.common.serialization.encodings
|
||||
|
||||
import org.jetbrains.kotlin.types.Variance
|
||||
|
||||
inline class BinaryTypeProjection(val code: Long) {
|
||||
@JvmInline
|
||||
value class BinaryTypeProjection(val code: Long) {
|
||||
|
||||
private fun varianceId(): Int = (code and 0x3L).toInt() - 1
|
||||
|
||||
|
||||
@@ -7,4 +7,7 @@ This mode is not recommended for production use,
|
||||
as no stability/compatibility guarantees are given on
|
||||
compiler or generated code. Use it at your own risk!
|
||||
|
||||
OK
|
||||
compiler/testData/cli/jvm/inlineClass.kt:1:1: warning: inline classes are deprecated in favor of value classes
|
||||
inline class Foo(val x: Int)
|
||||
^
|
||||
OK
|
||||
|
||||
@@ -7,7 +7,7 @@ This mode is not recommended for production use,
|
||||
as no stability/compatibility guarantees are given on
|
||||
compiler or generated code. Use it at your own risk!
|
||||
|
||||
compiler/testData/cli/jvm/inlineClass.kt:1:1: error: the feature "inline classes" is disabled
|
||||
compiler/testData/cli/jvm/inlineClass.kt:1:1: warning: inline classes are deprecated in favor of value classes
|
||||
inline class Foo(val x: Int)
|
||||
^
|
||||
COMPILATION_ERROR
|
||||
OK
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
-- Common --
|
||||
Exit code: OK
|
||||
Output:
|
||||
compiler/testData/multiplatform/inlineClasses/common.kt:3:8: warning: the feature "inline classes" is experimental
|
||||
compiler/testData/multiplatform/inlineClasses/common.kt:3:8: warning: inline classes are deprecated in favor of value classes
|
||||
expect inline class Foo1(val x: Int)
|
||||
^
|
||||
compiler/testData/multiplatform/inlineClasses/common.kt:4:8: warning: the feature "inline classes" is experimental
|
||||
compiler/testData/multiplatform/inlineClasses/common.kt:4:8: warning: inline classes are deprecated in favor of value classes
|
||||
expect inline class Foo2(val y: String)
|
||||
^
|
||||
|
||||
|
||||
@@ -131,7 +131,8 @@ enum class TableTimeUnit(val postfixText: String, val nsMultiplier: Double, val
|
||||
}
|
||||
}
|
||||
|
||||
inline class TableTimeUnitConversion(val value: Double) {
|
||||
@JvmInline
|
||||
value class TableTimeUnitConversion(val value: Double) {
|
||||
infix fun to(dest: TableTimeUnit): Double {
|
||||
return value * dest.nsMultiplier
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user