From 7fa81d6cc76d419382cec654c1d4dd36d43e8e7e Mon Sep 17 00:00:00 2001 From: Clemente Date: Sat, 2 Dec 2023 00:07:55 +0100 Subject: [PATCH 01/32] Adapter singleton and instance adapter discoverability for RealmInstant --- .../kotlin/io/realm/kotlin/Configuration.kt | 2 + .../io/realm/kotlin/RealmConfiguration.kt | 17 +- .../kotlin/internal/ConfigurationImpl.kt | 4 +- .../io/realm/kotlin/internal/Converters.kt | 27 +++ .../kotlin/internal/InternalConfiguration.kt | 2 + .../kotlin/internal/RealmConfigurationImpl.kt | 7 +- .../io/realm/kotlin/types/RealmTypeAdapter.kt | 14 ++ .../kotlin/types/annotations/TypeAdapter.kt | 28 +++ .../kotlin/mongodb/sync/SyncConfiguration.kt | 3 +- .../compiler/AccessorModifierIrGeneration.kt | 149 ++++++++++-- .../io/realm/kotlin/compiler/Identifiers.kt | 4 + .../io/realm/kotlin/compiler/IrUtils.kt | 130 ++++++---- .../compiler/GenerationExtensionTest.kt | 6 +- .../01_AFTER.ValidateIrBeforeLowering.ir | 222 +++++++++++++++++- .../src/test/resources/sample/input/Sample.kt | 21 ++ .../adapters/UsingInstancedAdapter.kt | 40 ++++ .../adapters/UsingSingletonAdapter.kt | 40 ++++ .../kotlin/test/common/TypeAdapterTests.kt | 105 +++++++++ 18 files changed, 748 insertions(+), 73 deletions(-) create mode 100644 packages/library-base/src/commonMain/kotlin/io/realm/kotlin/types/RealmTypeAdapter.kt create mode 100644 packages/library-base/src/commonMain/kotlin/io/realm/kotlin/types/annotations/TypeAdapter.kt create mode 100644 packages/test-base/src/commonMain/kotlin/io/realm/kotlin/entities/adapters/UsingInstancedAdapter.kt create mode 100644 packages/test-base/src/commonMain/kotlin/io/realm/kotlin/entities/adapters/UsingSingletonAdapter.kt create mode 100644 packages/test-base/src/commonTest/kotlin/io/realm/kotlin/test/common/TypeAdapterTests.kt diff --git a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/Configuration.kt b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/Configuration.kt index daf8e6a42f..81e4c5cdb3 100644 --- a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/Configuration.kt +++ b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/Configuration.kt @@ -25,6 +25,7 @@ import io.realm.kotlin.log.LogLevel import io.realm.kotlin.log.RealmLog import io.realm.kotlin.log.RealmLogger import io.realm.kotlin.types.BaseRealmObject +import io.realm.kotlin.types.RealmTypeAdapter import kotlinx.coroutines.CoroutineDispatcher import kotlin.reflect.KClass @@ -238,6 +239,7 @@ public interface Configuration { protected var initialDataCallback: InitialDataCallback? = null protected var inMemory: Boolean = false protected var initialRealmFileConfiguration: InitialRealmFileConfiguration? = null + protected var typeAdapters: List> = listOf() /** * Sets the filename of the realm file. diff --git a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/RealmConfiguration.kt b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/RealmConfiguration.kt index 4b46f62364..45dfb479ef 100644 --- a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/RealmConfiguration.kt +++ b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/RealmConfiguration.kt @@ -24,6 +24,7 @@ import io.realm.kotlin.log.RealmLog import io.realm.kotlin.log.RealmLogger import io.realm.kotlin.migration.AutomaticSchemaMigration import io.realm.kotlin.migration.RealmMigration +import io.realm.kotlin.types.RealmTypeAdapter import io.realm.kotlin.types.TypedRealmObject import kotlin.reflect.KClass @@ -89,6 +90,19 @@ public interface RealmConfiguration : Configuration { public fun directory(directoryPath: String): Builder = apply { this.directory = directoryPath } + // TODO misplaced, move around + public class TypeAdapterBuilder { + internal val adapters: MutableList> = mutableListOf() + public fun add(adapter: RealmTypeAdapter<*,*>) { + adapters.add(adapter) + } + } + + public fun typeAdapters(block: TypeAdapterBuilder.()->Unit): Builder = + apply { + this.typeAdapters = TypeAdapterBuilder().apply(block).adapters + } + /** * Setting this will change the behavior of how migration exceptions are handled. Instead of * throwing an exception the on-disc Realm will be cleared and recreated with the new Realm @@ -192,7 +206,8 @@ public interface RealmConfiguration : Configuration { initialDataCallback, inMemory, initialRealmFileConfiguration, - realmLogger + realmLogger, + typeAdapters, ) } } diff --git a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/ConfigurationImpl.kt b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/ConfigurationImpl.kt index 1c5fae2b73..e46c610152 100644 --- a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/ConfigurationImpl.kt +++ b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/ConfigurationImpl.kt @@ -45,6 +45,7 @@ import io.realm.kotlin.internal.util.CoroutineDispatcherFactory import io.realm.kotlin.migration.AutomaticSchemaMigration import io.realm.kotlin.migration.RealmMigration import io.realm.kotlin.types.BaseRealmObject +import io.realm.kotlin.types.RealmTypeAdapter import kotlin.reflect.KClass // TODO Public due to being accessed from `library-sync` @@ -67,7 +68,8 @@ public open class ConfigurationImpl( override val isFlexibleSyncConfiguration: Boolean, inMemory: Boolean, initialRealmFileConfiguration: InitialRealmFileConfiguration?, - logger: ContextLogger + logger: ContextLogger, + override val adapters: List>, ) : InternalConfiguration { override val path: String diff --git a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/Converters.kt b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/Converters.kt index 7100685660..cb53bdd78e 100644 --- a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/Converters.kt +++ b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/Converters.kt @@ -36,6 +36,7 @@ import io.realm.kotlin.types.ObjectId import io.realm.kotlin.types.RealmAny import io.realm.kotlin.types.RealmInstant import io.realm.kotlin.types.RealmObject +import io.realm.kotlin.types.RealmTypeAdapter import io.realm.kotlin.types.RealmUUID import io.realm.kotlin.types.geo.GeoBox import io.realm.kotlin.types.geo.GeoCircle @@ -259,6 +260,32 @@ internal object IntConverter : CoreIntConverter, CompositeConverter() public inline fun intToLong(value: Int?): Long? = value?.toLong() public inline fun longToInt(value: Long?): Int? = value?.toInt() +public inline fun toRealm( + obj: RealmObjectReference, + converterClass: KClass>, + userValue: Any, +): Any { + val adapter = obj.owner.owner + .configuration + .adapters + .first { it::class == converterClass } as RealmTypeAdapter + + return adapter.toRealm(userValue) +} + +public inline fun fromRealm( + obj: RealmObjectReference, + converterClass: KClass>, + realmValue: Any, +): Any { + val adapter = obj.owner.owner + .configuration + .adapters + .first { it::class == converterClass } as RealmTypeAdapter + + return adapter.fromRealm(realmValue) +} + internal object RealmInstantConverter : PassThroughPublicConverter() { override inline fun fromRealmValue(realmValue: RealmValue): RealmInstant? = if (realmValue.isNull()) null else realmValueToRealmInstant(realmValue) diff --git a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/InternalConfiguration.kt b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/InternalConfiguration.kt index 34c29c49bc..8ea0e771a9 100644 --- a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/InternalConfiguration.kt +++ b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/InternalConfiguration.kt @@ -21,6 +21,7 @@ import io.realm.kotlin.internal.interop.RealmConfigurationPointer import io.realm.kotlin.internal.interop.SchemaMode import io.realm.kotlin.internal.util.CoroutineDispatcherFactory import io.realm.kotlin.types.BaseRealmObject +import io.realm.kotlin.types.RealmTypeAdapter import kotlin.reflect.KClass /** @@ -36,6 +37,7 @@ public interface InternalConfiguration : Configuration { public val writeDispatcherFactory: CoroutineDispatcherFactory public val schemaMode: SchemaMode public val logger: ContextLogger + public val adapters: List> // Temporary work-around for https://github.com/realm/realm-kotlin/issues/724 public val isFlexibleSyncConfiguration: Boolean diff --git a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmConfigurationImpl.kt b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmConfigurationImpl.kt index 8b0e620e2d..9dfe7468d0 100644 --- a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmConfigurationImpl.kt +++ b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmConfigurationImpl.kt @@ -25,6 +25,7 @@ import io.realm.kotlin.internal.interop.SchemaMode import io.realm.kotlin.internal.util.CoroutineDispatcherFactory import io.realm.kotlin.migration.RealmMigration import io.realm.kotlin.types.BaseRealmObject +import io.realm.kotlin.types.RealmTypeAdapter import kotlin.reflect.KClass public const val REALM_FILE_EXTENSION: String = ".realm" @@ -47,7 +48,8 @@ internal class RealmConfigurationImpl( initialDataCallback: InitialDataCallback?, inMemory: Boolean, override val initialRealmFileConfiguration: InitialRealmFileConfiguration?, - logger: ContextLogger + logger: ContextLogger, + adapters: List> ) : ConfigurationImpl( directory, name, @@ -69,6 +71,7 @@ internal class RealmConfigurationImpl( false, inMemory, initialRealmFileConfiguration, - logger + logger, + adapters, ), RealmConfiguration diff --git a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/types/RealmTypeAdapter.kt b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/types/RealmTypeAdapter.kt new file mode 100644 index 0000000000..f3136c6f0c --- /dev/null +++ b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/types/RealmTypeAdapter.kt @@ -0,0 +1,14 @@ +package io.realm.kotlin.types + +/** + * TODO + * + * @param R realm type. + * @param U user type. + */ +public interface RealmTypeAdapter { // where P is a supported realm type + + public fun fromRealm(realmValue: R): U + + public fun toRealm(value: U): R +} diff --git a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/types/annotations/TypeAdapter.kt b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/types/annotations/TypeAdapter.kt new file mode 100644 index 0000000000..ff38cd015a --- /dev/null +++ b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/types/annotations/TypeAdapter.kt @@ -0,0 +1,28 @@ +/* + * Copyright 2022 Realm Inc. + * + * 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 io.realm.kotlin.types.annotations + +import io.realm.kotlin.types.RealmTypeAdapter +import kotlin.reflect.KClass + +@Retention(AnnotationRetention.SOURCE) +@Target(AnnotationTarget.PROPERTY, AnnotationTarget.CLASS) +@MustBeDocumented +/** + * TODO + */ +public annotation class TypeAdapter(val adapter: KClass>) diff --git a/packages/library-sync/src/commonMain/kotlin/io/realm/kotlin/mongodb/sync/SyncConfiguration.kt b/packages/library-sync/src/commonMain/kotlin/io/realm/kotlin/mongodb/sync/SyncConfiguration.kt index 675fbf08a2..9566dae375 100644 --- a/packages/library-sync/src/commonMain/kotlin/io/realm/kotlin/mongodb/sync/SyncConfiguration.kt +++ b/packages/library-sync/src/commonMain/kotlin/io/realm/kotlin/mongodb/sync/SyncConfiguration.kt @@ -572,7 +572,8 @@ public interface SyncConfiguration : Configuration { partitionValue == null, inMemory, initialRealmFileConfiguration, - realmLogger + realmLogger, + typeAdapters, ) return SyncConfigurationImpl( diff --git a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/AccessorModifierIrGeneration.kt b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/AccessorModifierIrGeneration.kt index ddf3f025f8..b39205a36f 100644 --- a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/AccessorModifierIrGeneration.kt +++ b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/AccessorModifierIrGeneration.kt @@ -34,6 +34,7 @@ import io.realm.kotlin.compiler.ClassIds.REALM_OBJECT_INTERFACE import io.realm.kotlin.compiler.ClassIds.REALM_SET import io.realm.kotlin.compiler.ClassIds.REALM_UUID import io.realm.kotlin.compiler.ClassIds.TRANSIENT_ANNOTATION +import io.realm.kotlin.compiler.ClassIds.TYPE_ADAPTER_ANNOTATION import io.realm.kotlin.compiler.Names.OBJECT_REFERENCE import io.realm.kotlin.compiler.Names.REALM_ACCESSOR_HELPER_GET_BOOLEAN import io.realm.kotlin.compiler.Names.REALM_ACCESSOR_HELPER_GET_BYTE_ARRAY @@ -58,9 +59,13 @@ import io.realm.kotlin.compiler.Names.REALM_OBJECT_HELPER_SET_LIST import io.realm.kotlin.compiler.Names.REALM_OBJECT_HELPER_SET_OBJECT import io.realm.kotlin.compiler.Names.REALM_OBJECT_HELPER_SET_SET import io.realm.kotlin.compiler.Names.REALM_SYNTHETIC_PROPERTY_PREFIX +import io.realm.kotlin.compiler.Names.REALM_TYPE_ADAPTER_FROM_REALM +import io.realm.kotlin.compiler.Names.REALM_TYPE_ADAPTER_TO_REALM import org.jetbrains.kotlin.backend.common.extensions.IrPluginContext +import org.jetbrains.kotlin.descriptors.ClassKind import org.jetbrains.kotlin.ir.IrStatement import org.jetbrains.kotlin.ir.builders.IrBlockBuilder +import org.jetbrains.kotlin.ir.builders.IrBuilderWithScope import org.jetbrains.kotlin.ir.builders.Scope import org.jetbrains.kotlin.ir.builders.irBlockBody import org.jetbrains.kotlin.ir.builders.irCall @@ -68,6 +73,7 @@ import org.jetbrains.kotlin.ir.builders.irGet import org.jetbrains.kotlin.ir.builders.irGetObject import org.jetbrains.kotlin.ir.builders.irIfNull import org.jetbrains.kotlin.ir.builders.irLetS +import org.jetbrains.kotlin.ir.builders.irNull import org.jetbrains.kotlin.ir.builders.irReturn import org.jetbrains.kotlin.ir.builders.irString import org.jetbrains.kotlin.ir.declarations.IrClass @@ -78,12 +84,17 @@ import org.jetbrains.kotlin.ir.declarations.IrValueParameter import org.jetbrains.kotlin.ir.descriptors.toIrBasedDescriptor import org.jetbrains.kotlin.ir.descriptors.toIrBasedKotlinType import org.jetbrains.kotlin.ir.expressions.IrCall +import org.jetbrains.kotlin.ir.expressions.IrClassReference import org.jetbrains.kotlin.ir.expressions.IrDeclarationReference +import org.jetbrains.kotlin.ir.expressions.IrFunctionAccessExpression +import org.jetbrains.kotlin.ir.expressions.IrGetValue import org.jetbrains.kotlin.ir.expressions.IrStatementOrigin import org.jetbrains.kotlin.ir.expressions.impl.IrSetFieldImpl +import org.jetbrains.kotlin.ir.interpreter.getAnnotation import org.jetbrains.kotlin.ir.types.IrSimpleType import org.jetbrains.kotlin.ir.types.IrType import org.jetbrains.kotlin.ir.types.IrTypeArgument +import org.jetbrains.kotlin.ir.types.getClass import org.jetbrains.kotlin.ir.types.impl.IrAbstractSimpleType import org.jetbrains.kotlin.ir.types.isBoolean import org.jetbrains.kotlin.ir.types.isByte @@ -112,6 +123,7 @@ import org.jetbrains.kotlin.types.KotlinType import org.jetbrains.kotlin.types.StarProjectionImpl import org.jetbrains.kotlin.types.isNullable import org.jetbrains.kotlin.types.typeUtil.supertypes +import java.lang.IllegalStateException import kotlin.collections.set /** @@ -209,6 +221,12 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { private val objectIdToRealmObjectId: IrSimpleFunction = pluginContext.referenceFunctions(CallableId(FqName("io.realm.kotlin.internal"), Name.identifier("objectIdToRealmObjectId"))).first().owner + private val providedAdapterFromRealm: IrSimpleFunction = + pluginContext.referenceFunctions(CallableId(FqName("io.realm.kotlin.internal"), Name.identifier("fromRealm"))).first().owner + + private val providedAdapterToRealm: IrSimpleFunction = + pluginContext.referenceFunctions(CallableId(FqName("io.realm.kotlin.internal"), Name.identifier("toRealm"))).first().owner + private lateinit var objectReferenceProperty: IrProperty private lateinit var objectReferenceType: IrType @@ -373,7 +391,11 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { fromRealmValue = longToByte, toPublic = null, setFunction = setValue, - fromPublic = byteToLong, + fromPublic = {_, value -> + irCall(callee = byteToLong).apply { + putValueArgument(0, value) + } + }, toRealmValue = null ) } @@ -391,7 +413,12 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { fromRealmValue = longToChar, toPublic = null, setFunction = setValue, - fromPublic = charToLong, +// fromPublic = charToLong, + fromPublic = { _, value -> + irCall(callee = charToLong).apply { + putValueArgument(0, value) + } + }, toRealmValue = null ) } @@ -409,7 +436,12 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { fromRealmValue = longToShort, toPublic = null, setFunction = setValue, - fromPublic = shortToLong, +// fromPublic = shortToLong, + fromPublic = { _, value -> + irCall(callee = shortToLong).apply { + putValueArgument(0, value) + } + }, toRealmValue = null ) } @@ -427,7 +459,12 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { fromRealmValue = longToInt, toPublic = null, setFunction = setValue, - fromPublic = intToLong, +// fromPublic = intToLong, + fromPublic = { _, value -> + irCall(callee = intToLong).apply { + putValueArgument(0, value) + } + }, toRealmValue = null ) } @@ -696,6 +733,80 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { toRealmValue = null ) } + declaration.hasAnnotation(TYPE_ADAPTER_ANNOTATION) -> { + logDebug("Object property named ${declaration.name} is an adapted type.") + + // TODO check nullability + + // 1. Extract what is the actual schema property + // TODO extract the type from the annotation, by now hardcoded one + val schemaProperty = SchemaProperty( + propertyType = PropertyType.RLM_PROPERTY_TYPE_TIMESTAMP, + declaration = declaration, + collectionType = CollectionType.NONE + ) + fields[name] = schemaProperty + // 2. Modify the accessor to use the type adapter. The type adapter might or + // not be provided (singleton vs class) + + val adapterClassReference = declaration.getAnnotation(TYPE_ADAPTER_ANNOTATION.asSingleFqName()).getValueArgument(0)!! as IrClassReference + val adapterClass: IrClass = adapterClassReference.classType.getClass()!! + + // check kind (object / class) + when (adapterClass.kind) { + ClassKind.CLASS -> { + modifyAccessor( + property = schemaProperty, + getFunction = getInstant, + fromRealmValue = null, + toPublic = {objReference, realmValue -> + irCall(callee = providedAdapterFromRealm).apply { + // pass the class from the annotation + putValueArgument(0, objReference) + putValueArgument(1, adapterClassReference) + putValueArgument(2, realmValue) + } + }, + setFunction = setValue, + fromPublic = { objReference, publicValue -> + irCall(callee = providedAdapterToRealm).apply { + // pass the class from the annotation + putValueArgument(0, objReference) + putValueArgument(1, adapterClassReference) + putValueArgument(2, publicValue) + } + }, + toRealmValue = null + ) + } + ClassKind.OBJECT -> { + val fromRealm = adapterClass.lookupFunction(REALM_TYPE_ADAPTER_FROM_REALM) + val toRealm = adapterClass.lookupFunction(REALM_TYPE_ADAPTER_TO_REALM) + + modifyAccessor( + property = schemaProperty, + getFunction = getInstant, + fromRealmValue = null, + toPublic = { _, realmValue -> + irCall(callee = fromRealm).apply { + putValueArgument(0, realmValue) + dispatchReceiver = irGetObject(adapterClass.symbol) + } + }, + setFunction = setValue, + fromPublic = { _, publicValue -> + irCall(callee = toRealm).apply { + putValueArgument(0, publicValue) + dispatchReceiver = irGetObject(adapterClass.symbol) + } + }, + toRealmValue = null + ) + } + else -> throw IllegalStateException("Unsupported type") + } + } + else -> { logError("Realm does not support persisting properties of this type. Mark the field with `@Ignore` to suppress this error.", declaration.locationOf()) } @@ -778,9 +889,9 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { property: SchemaProperty, getFunction: IrSimpleFunction, fromRealmValue: IrSimpleFunction? = null, - toPublic: IrSimpleFunction? = null, + toPublic: (IrBuilderWithScope.(IrGetValue, IrFunctionAccessExpression)->IrDeclarationReference)? = null, setFunction: IrSimpleFunction? = null, - fromPublic: IrSimpleFunction? = null, + fromPublic: (IrBuilderWithScope.(IrGetValue, IrGetValue)->IrDeclarationReference)? = null, toRealmValue: IrSimpleFunction? = null, collectionType: CollectionType = CollectionType.NONE ) { @@ -853,11 +964,11 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { putValueArgument(0, managedObjectGetValueCall) } } ?: managedObjectGetValueCall - val publicValue = toPublic?.let { - irCall(callee = toPublic).apply { - putValueArgument(0, storageValue) - } - } ?: storageValue + val publicValue = toPublic?.invoke( + this, + irGet(objectReferenceType, valueSymbol), + storageValue + ) ?: storageValue irIfNull( type = getter.returnType, subject = irGet(objectReferenceType, valueSymbol), @@ -908,11 +1019,12 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { nameHint = "objectReference", irType = objectReferenceType, ) { valueSymbol -> - val storageValue: IrDeclarationReference = fromPublic?.let { - irCall(callee = it).apply { - putValueArgument(0, irGet(setter.valueParameters.first())) - } - } ?: irGet(setter.valueParameters.first()) + val storageValue = + fromPublic?.invoke( + this, + irGet(objectReferenceType, valueSymbol), + irGet(setter.valueParameters.first()) + ) ?: irGet(setter.valueParameters.first()) val realmValue: IrDeclarationReference = toRealmValue?.let { irCall(callee = it).apply { if (typeArgumentsCount > 0) { @@ -924,9 +1036,8 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { val cinteropCall = irCall( callee = setFunction, origin = IrStatementOrigin.GET_PROPERTY - ).also { - it.dispatchReceiver = irGetObject(realmObjectHelper.symbol) - }.apply { + ).apply { + dispatchReceiver = irGetObject(realmObjectHelper.symbol) if (typeArgumentsCount > 0) { putTypeArgument(0, type) } diff --git a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/Identifiers.kt b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/Identifiers.kt index ce6afd3774..e4df3d9104 100644 --- a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/Identifiers.kt +++ b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/Identifiers.kt @@ -69,6 +69,9 @@ internal object Names { val REALM_OBJECT_HELPER_SET_OBJECT = Name.identifier("setObject") val REALM_OBJECT_HELPER_SET_EMBEDDED_REALM_OBJECT = Name.identifier("setEmbeddedRealmObject") + val REALM_TYPE_ADAPTER_FROM_REALM = Name.identifier("fromRealm") + val REALM_TYPE_ADAPTER_TO_REALM = Name.identifier("toRealm") + // C-interop methods val REALM_OBJECT_HELPER_GET_LIST = Name.identifier("getList") val REALM_OBJECT_HELPER_SET_LIST = Name.identifier("setList") @@ -146,6 +149,7 @@ object ClassIds { val PERSISTED_NAME_ANNOTATION = ClassId(FqNames.PACKAGE_ANNOTATIONS, Name.identifier("PersistedName")) val TRANSIENT_ANNOTATION = ClassId(FqName("kotlin.jvm"), Name.identifier("Transient")) val MODEL_OBJECT_ANNOTATION = ClassId(FqName("io.realm.kotlin.internal.platform"), Name.identifier("ModelObject")) + val TYPE_ADAPTER_ANNOTATION = ClassId(FqNames.PACKAGE_ANNOTATIONS, Name.identifier("TypeAdapter")) val PROPERTY_INFO_CREATE = CallableId(FqName("io.realm.kotlin.internal.schema"), Name.identifier("createPropertyInfo")) val CLASS_KIND_TYPE = ClassId(FqName("io.realm.kotlin.schema"), Name.identifier("RealmClassKind")) diff --git a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/IrUtils.kt b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/IrUtils.kt index 01953e72c7..3eb1ae88de 100644 --- a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/IrUtils.kt +++ b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/IrUtils.kt @@ -26,6 +26,7 @@ import io.realm.kotlin.compiler.FqNames.PACKAGE_TYPES import io.realm.kotlin.compiler.Names.ASYMMETRIC_REALM_OBJECT import io.realm.kotlin.compiler.Names.EMBEDDED_REALM_OBJECT import io.realm.kotlin.compiler.Names.REALM_OBJECT +import io.realm.kotlin.compiler.ClassIds.TYPE_ADAPTER_ANNOTATION import org.jetbrains.kotlin.backend.common.extensions.IrPluginContext import org.jetbrains.kotlin.backend.common.lower.DeclarationIrBuilder import org.jetbrains.kotlin.cli.common.messages.CompilerMessageLocationWithRange @@ -87,6 +88,7 @@ import org.jetbrains.kotlin.ir.expressions.impl.IrVarargImpl import org.jetbrains.kotlin.ir.expressions.impl.IrWhenImpl import org.jetbrains.kotlin.ir.interpreter.getAnnotation import org.jetbrains.kotlin.ir.symbols.IrClassSymbol +import org.jetbrains.kotlin.ir.symbols.IrClassifierSymbol import org.jetbrains.kotlin.ir.symbols.IrConstructorSymbol import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol import org.jetbrains.kotlin.ir.symbols.IrSymbol @@ -121,6 +123,7 @@ import org.jetbrains.kotlin.resolve.DescriptorUtils import org.jetbrains.kotlin.types.KotlinType import java.lang.reflect.Field import java.util.function.Predicate +import kotlin.reflect.KClass // Somehow addSetter was removed from the IrProperty in https://github.com/JetBrains/kotlin/commit/d1dc938a5d7331ba43fcbb8ce53c3e17ef76a22a#diff-2726c3747ace0a1c93ad82365cf3ff18L114 // Remove this extension when this will be re-introduced? see https://kotlinlang.slack.com/archives/C7L3JB43G/p1600888883006300 @@ -138,7 +141,7 @@ inline fun IrProperty.addSetter(builder: IrFunctionBuilder.() -> Unit = {}): IrS fun IrPluginContext.blockBody( symbol: IrSymbol, - block: IrBlockBodyBuilder.() -> Unit + block: IrBlockBodyBuilder.() -> Unit, ): IrBlockBody = DeclarationIrBuilder(this, symbol).irBlockBody { block() } @@ -148,9 +151,11 @@ val ClassDescriptor.isRealmObjectCompanion val realmObjectInterfaceFqNames = setOf(REALM_OBJECT_INTERFACE) val realmEmbeddedObjectInterfaceFqNames = setOf(EMBEDDED_OBJECT_INTERFACE) val realmAsymmetricObjectInterfaceFqNames = setOf(ASYMMETRIC_OBJECT_INTERFACE) -val anyRealmObjectInterfacesFqNames = realmObjectInterfaceFqNames + realmEmbeddedObjectInterfaceFqNames + realmAsymmetricObjectInterfaceFqNames +val anyRealmObjectInterfacesFqNames = + realmObjectInterfaceFqNames + realmEmbeddedObjectInterfaceFqNames + realmAsymmetricObjectInterfaceFqNames -fun IrType.classIdOrFail(): ClassId = getClass()?.classId ?: error("Can't get classId of ${render()}") +fun IrType.classIdOrFail(): ClassId = + getClass()?.classId ?: error("Can't get classId of ${render()}") inline fun PsiElement.hasInterface(interfaces: Set): Boolean { var hasRealmObjectAsSuperType = false @@ -166,11 +171,11 @@ inline fun PsiElement.hasInterface(interfaces: Set): Boolean { .split(",") // Split by commas .filter { !( - it.contains("") || - it.contains("") || - it.contains("") || - it.contains("") - ) + it.contains("") || + it.contains("") || + it.contains("") || + it.contains("") + ) }.joinToString(",") // Re-sanitize again hasRealmObjectAsSuperType = elementNodeText.findAnyOf(interfaces) != null } @@ -179,6 +184,7 @@ inline fun PsiElement.hasInterface(interfaces: Set): Boolean { return hasRealmObjectAsSuperType } + inline fun ClassDescriptor.hasInterfacePsi(interfaces: Set): Boolean { // Using PSI to find super types to avoid cyclic reference (see https://github.com/realm/realm-kotlin/issues/339) return this.findPsi()?.hasInterface(interfaces) ?: false @@ -190,17 +196,24 @@ inline fun ClassDescriptor.hasInterfacePsi(interfaces: Set): Boolean { // type. Fortunately that is visible in the PSI as `RealmObject()` (Java, abstract class) vs. // `RealmObject` (Kotlin, interface). val realmObjectPsiNames = setOf("RealmObject", "io.realm.kotlin.types.RealmObject") -val embeddedRealmObjectPsiNames = setOf("EmbeddedRealmObject", "io.realm.kotlin.types.EmbeddedRealmObject") -val asymmetricRealmObjectPsiNames = setOf("AsymmetricRealmObject", "io.realm.kotlin.types.AsymmetricRealmObject") +val embeddedRealmObjectPsiNames = + setOf("EmbeddedRealmObject", "io.realm.kotlin.types.EmbeddedRealmObject") +val asymmetricRealmObjectPsiNames = + setOf("AsymmetricRealmObject", "io.realm.kotlin.types.AsymmetricRealmObject") val realmJavaObjectPsiNames = setOf("io.realm.RealmObject()", "RealmObject()") val ClassDescriptor.isRealmObject: Boolean - get() = this.hasInterfacePsi(realmObjectPsiNames) && !this.hasInterfacePsi(realmJavaObjectPsiNames) + get() = this.hasInterfacePsi(realmObjectPsiNames) && !this.hasInterfacePsi( + realmJavaObjectPsiNames + ) val ClassDescriptor.isEmbeddedRealmObject: Boolean get() = this.hasInterfacePsi(embeddedRealmObjectPsiNames) val ClassDescriptor.isBaseRealmObject: Boolean - get() = this.hasInterfacePsi(realmObjectPsiNames + embeddedRealmObjectPsiNames + asymmetricRealmObjectPsiNames) && !this.hasInterfacePsi(realmJavaObjectPsiNames) + get() = this.hasInterfacePsi(realmObjectPsiNames + embeddedRealmObjectPsiNames + asymmetricRealmObjectPsiNames) && !this.hasInterfacePsi( + realmJavaObjectPsiNames + ) -val realmObjectTypes: Set = setOf(REALM_OBJECT, EMBEDDED_REALM_OBJECT, ASYMMETRIC_REALM_OBJECT) +val realmObjectTypes: Set = + setOf(REALM_OBJECT, EMBEDDED_REALM_OBJECT, ASYMMETRIC_REALM_OBJECT) val realmObjectClassIds = realmObjectTypes.map { name -> ClassId(PACKAGE_TYPES, name) } // This is the K2 equivalent of our PSI hack to determine if a symbol has a RealmObject base class. @@ -210,23 +223,23 @@ val realmObjectClassIds = realmObjectTypes.map { name -> ClassId(PACKAGE_TYPES, @OptIn(SymbolInternals::class) val FirClassSymbol<*>.isBaseRealmObject: Boolean get() = this.classKind == ClassKind.CLASS && - this.fir.superTypeRefs.any { typeRef -> - when (typeRef) { - // In SUPERTYPES stage - is FirUserTypeRef -> { - typeRef.qualifier.last().name in realmObjectTypes && - // Disregard constructor invocations as that means that it is a Realm Java class - !( - typeRef.source?.run { treeStructure.getParent(lighterASTNode) } - ?.tokenType?.let { it == KtStubElementTypes.CONSTRUCTOR_CALLEE } - ?: false - ) + this.fir.superTypeRefs.any { typeRef -> + when (typeRef) { + // In SUPERTYPES stage + is FirUserTypeRef -> { + typeRef.qualifier.last().name in realmObjectTypes && + // Disregard constructor invocations as that means that it is a Realm Java class + !( + typeRef.source?.run { treeStructure.getParent(lighterASTNode) } + ?.tokenType?.let { it == KtStubElementTypes.CONSTRUCTOR_CALLEE } + ?: false + ) + } + // After SUPERTYPES stage + is FirResolvedTypeRef -> typeRef.type.classId in realmObjectClassIds + else -> false } - // After SUPERTYPES stage - is FirResolvedTypeRef -> typeRef.type.classId in realmObjectClassIds - else -> false } - } // JetBrains already have a method `fun IrAnnotationContainer.hasAnnotation(symbol: IrClassSymbol)` // It is unclear exactly what the difference is and how to get a ClassSymbol from a ClassId, @@ -275,7 +288,10 @@ internal fun IrPropertyBuilder.at(startOffset: Int, endOffset: Int) = also { this.endOffset = endOffset } -internal fun IrClass.lookupFunction(name: Name, predicate: Predicate? = null): IrSimpleFunction { +internal fun IrClass.lookupFunction( + name: Name, + predicate: Predicate? = null, +): IrSimpleFunction { return functions.firstOrNull { it.name == name && predicate?.test(it) ?: true } ?: throw AssertionError("Function '$name' not found in class '${this.name}'") } @@ -287,7 +303,7 @@ internal fun IrClass.lookupProperty(name: Name): IrProperty { internal fun IrPluginContext.lookupFunctionInClass( clazz: ClassId, - function: String + function: String, ): IrSimpleFunction { return lookupClassOrThrow(clazz).functions.first { it.name == Name.identifier(function) @@ -301,7 +317,7 @@ internal fun IrPluginContext.lookupClassOrThrow(name: ClassId): IrClass { internal fun IrPluginContext.lookupConstructorInClass( clazz: ClassId, - filter: (ctor: IrConstructorSymbol) -> Boolean = { true } + filter: (ctor: IrConstructorSymbol) -> Boolean = { true }, ): IrConstructorSymbol { return referenceConstructors(clazz).first { filter(it) @@ -309,7 +325,7 @@ internal fun IrPluginContext.lookupConstructorInClass( } internal fun IrClass.lookupCompanionDeclaration( - name: Name + name: Name, ): T { return this.companionObject()?.declarations?.first { it is IrDeclarationWithName && it.name == name @@ -324,12 +340,20 @@ internal fun KotlinType.getKotlinTypeFqNameCompat(printTypeArguments: Boolean): "declarationDescriptor is null for constructor = $constructor with ${constructor.javaClass}" } if (declaration is TypeParameterDescriptor) { - return StringUtil.join(declaration.upperBounds, { type -> type.getKotlinTypeFqNameCompat(printTypeArguments) }, "&") + return StringUtil.join( + declaration.upperBounds, + { type -> type.getKotlinTypeFqNameCompat(printTypeArguments) }, + "&" + ) } val typeArguments = arguments val typeArgumentsAsString = if (printTypeArguments && !typeArguments.isEmpty()) { - val joinedTypeArguments = StringUtil.join(typeArguments, { projection -> projection.type.getKotlinTypeFqNameCompat(false) }, ", ") + val joinedTypeArguments = StringUtil.join( + typeArguments, + { projection -> projection.type.getKotlinTypeFqNameCompat(false) }, + ", " + ) "<$joinedTypeArguments>" } else { @@ -376,26 +400,29 @@ enum class PropertyType { data class CoreType( val propertyType: PropertyType, - val nullable: Boolean + val nullable: Boolean, ) private const val NO_ALIAS = "" + // FIXME use PropertyType instead of "type: String", consider using a common/shared type when implementing public schema // see (https://github.com/realm/realm-kotlin/issues/238) data class SchemaProperty( val propertyType: PropertyType, val declaration: IrProperty, val collectionType: CollectionType = CollectionType.NONE, - val coreGenericTypes: List? = null + val coreGenericTypes: List? = null, ) { val isComputed = propertyType == PropertyType.RLM_PROPERTY_TYPE_LINKING_OBJECTS - val hasPersistedNameAnnotation = declaration.backingField != null && declaration.hasAnnotation(PERSISTED_NAME_ANNOTATION) + val hasPersistedNameAnnotation = + declaration.backingField != null && declaration.hasAnnotation(PERSISTED_NAME_ANNOTATION) val persistedName: String val publicName: String init { val declarationName = declaration.name.identifier - val persistedAnnotationName: String? = if (hasPersistedNameAnnotation) getPersistedName(declaration) else null + val persistedAnnotationName: String? = + if (hasPersistedNameAnnotation) getPersistedName(declaration) else null // We only set the public name if the persisted and public names are different // because core would otherwise detect it as a duplicated name and fail. @@ -420,7 +447,8 @@ data class SchemaProperty( companion object { fun getPersistedName(declaration: IrProperty): String { @Suppress("UNCHECKED_CAST") - return (declaration.getAnnotation(PERSISTED_NAME_ANNOTATION.asSingleFqName()).getValueArgument(0)!! as IrConstImpl).value + return (declaration.getAnnotation(PERSISTED_NAME_ANNOTATION.asSingleFqName()) + .getValueArgument(0)!! as IrConstImpl).value } } } @@ -435,7 +463,7 @@ internal fun buildOf( function: IrSimpleFunctionSymbol, containerType: IrClass, elementType: IrType, - args: List + args: List, ): IrExpression { return IrCallImpl( startOffset = startOffset, endOffset = endOffset, @@ -465,9 +493,14 @@ internal fun buildSetOf( startOffset: Int, endOffset: Int, elementType: IrType, - args: List + args: List, ): IrExpression { - val setOf = context.referenceFunctions(CallableId(FqName("kotlin.collections"), Name.identifier("setOf"))) + val setOf = context.referenceFunctions( + CallableId( + FqName("kotlin.collections"), + Name.identifier("setOf") + ) + ) .first { val parameters = it.owner.valueParameters parameters.size == 1 && parameters.first().isVararg @@ -481,7 +514,7 @@ internal fun buildListOf( startOffset: Int, endOffset: Int, elementType: IrType, - args: List + args: List, ): IrExpression { val listOf = context.referenceFunctions(KOTLIN_COLLECTIONS_LISTOF) .first { @@ -497,7 +530,7 @@ fun IrClass.addValueProperty( superClass: IrClass, propertyName: Name, propertyType: IrType, - initExpression: (startOffset: Int, endOffset: Int) -> IrExpression + initExpression: (startOffset: Int, endOffset: Int) -> IrExpression, ): IrProperty { // PROPERTY name:realmPointer visibility:public modality:OPEN [var] val property = addProperty { @@ -678,7 +711,8 @@ fun getLinkingObjectPropertyName(backingField: IrField): String { fun getSchemaClassName(clazz: IrClass): String { return if (clazz.hasAnnotation(PERSISTED_NAME_ANNOTATION)) { @Suppress("UNCHECKED_CAST") - return (clazz.getAnnotation(PERSISTED_NAME_ANNOTATION.asSingleFqName()).getValueArgument(0)!! as IrConstImpl).value + return (clazz.getAnnotation(PERSISTED_NAME_ANNOTATION.asSingleFqName()) + .getValueArgument(0)!! as IrConstImpl).value } else { clazz.name.identifier } @@ -701,7 +735,11 @@ fun IrDeclaration.locationOf(): CompilerMessageSourceLocation { } /** Wrapper method to overcome API differences from Kotlin 1.7.20-1.8.20 */ -fun IrBuilderWithScope.irGetFieldWrapper(receiver: IrGetValueImpl, field: IrField, type: IrType = field.type): IrExpression = +fun IrBuilderWithScope.irGetFieldWrapper( + receiver: IrGetValueImpl, + field: IrField, + type: IrType = field.type, +): IrExpression = IrGetFieldImpl(startOffset, endOffset, field.symbol, type, receiver) /** diff --git a/packages/plugin-compiler/src/test/kotlin/io/realm/kotlin/compiler/GenerationExtensionTest.kt b/packages/plugin-compiler/src/test/kotlin/io/realm/kotlin/compiler/GenerationExtensionTest.kt index b6f0f9bd15..bf44b0d2c7 100644 --- a/packages/plugin-compiler/src/test/kotlin/io/realm/kotlin/compiler/GenerationExtensionTest.kt +++ b/packages/plugin-compiler/src/test/kotlin/io/realm/kotlin/compiler/GenerationExtensionTest.kt @@ -319,7 +319,11 @@ class GenerationExtensionTest { // @PersistedName annotated fields "persistedNameStringField" to PropertyType.RLM_PROPERTY_TYPE_STRING, "persistedNameChildField" to PropertyType.RLM_PROPERTY_TYPE_OBJECT, - "persistedNameLinkingObjectsField" to PropertyType.RLM_PROPERTY_TYPE_LINKING_OBJECTS + "persistedNameLinkingObjectsField" to PropertyType.RLM_PROPERTY_TYPE_LINKING_OBJECTS, + + // Adapted types + "singletonAdaptedRealmInstant" to PropertyType.RLM_PROPERTY_TYPE_TIMESTAMP, + "instancedAdaptedRealmInstant" to PropertyType.RLM_PROPERTY_TYPE_TIMESTAMP, ) assertEquals(expectedProperties.size, properties.size) properties.map { property -> diff --git a/packages/plugin-compiler/src/test/resources/sample/expected/01_AFTER.ValidateIrBeforeLowering.ir b/packages/plugin-compiler/src/test/resources/sample/expected/01_AFTER.ValidateIrBeforeLowering.ir index 3ca90d16e5..0045cc76b0 100644 --- a/packages/plugin-compiler/src/test/resources/sample/expected/01_AFTER.ValidateIrBeforeLowering.ir +++ b/packages/plugin-compiler/src/test/resources/sample/expected/01_AFTER.ValidateIrBeforeLowering.ir @@ -1,6 +1,6 @@ // --- IR for
after Validate IR before lowering MODULE_FRAGMENT name:
- FILE fqName:sample.input fileName:input/Sample.kt + FILE fqName:sample.input fileName:/Users/clemente.tort/realm-kotlin/packages/plugin-compiler/build/resources/test/sample/input/Sample.kt CLASS CLASS name:Sample modality:OPEN visibility:public superTypes:[io.realm.kotlin.types.RealmObject; io.realm.kotlin.internal.RealmObjectInternal] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:sample.input.Sample CONSTRUCTOR visibility:public <> () returnType:sample.input.Sample [primary] @@ -6422,6 +6422,118 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null reference: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null targetProperty: PROPERTY_REFERENCE 'public final publicNameLinkingObjectsField: io.realm.kotlin.query.RealmResults [delegated,val]' field=null getter='public final fun (): io.realm.kotlin.query.RealmResults declared in sample.input.Sample' setter=null type=kotlin.reflect.KProperty1> origin=PROPERTY_REFERENCE_FOR_DELEGATE + PROPERTY name:singletonAdaptedRealmInstant visibility:public modality:FINAL [var] + annotations: + TypeAdapter(adapter = CLASS_REFERENCE 'CLASS OBJECT name:RealmInstantBsonDateTimeAdapterSingleton modality:FINAL visibility:public superTypes:[io.realm.kotlin.types.RealmTypeAdapter]' type=kotlin.reflect.KClass) + FIELD PROPERTY_BACKING_FIELD name:singletonAdaptedRealmInstant type:org.mongodb.kbson.BsonDateTime visibility:private + EXPRESSION_BODY + CONSTRUCTOR_CALL 'public constructor () declared in org.mongodb.kbson.BsonDateTime' type=org.mongodb.kbson.BsonDateTime origin=null + FUN name: visibility:public modality:FINAL <> ($this:sample.input.Sample) returnType:org.mongodb.kbson.BsonDateTime + correspondingProperty: PROPERTY name:singletonAdaptedRealmInstant visibility:public modality:FINAL [var] + $this: VALUE_PARAMETER name: type:sample.input.Sample + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): org.mongodb.kbson.BsonDateTime declared in sample.input.Sample' + BLOCK type=org.mongodb.kbson.BsonDateTime origin=null + VAR IR_TEMPORARY_VARIABLE name:tmp0_objectReference type:io.realm.kotlin.internal.RealmObjectReference? [val] + CALL 'public open fun (): io.realm.kotlin.internal.RealmObjectReference? declared in sample.input.Sample' type=io.realm.kotlin.internal.RealmObjectReference? origin=GET_PROPERTY + $this: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null + WHEN type=org.mongodb.kbson.BsonDateTime origin=null + BRANCH + if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ + arg0: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null + arg1: CONST Null type=kotlin.Nothing? value=null + then: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:singletonAdaptedRealmInstant type:org.mongodb.kbson.BsonDateTime visibility:private' type=org.mongodb.kbson.BsonDateTime origin=null + receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null + BRANCH + if: CONST Boolean type=kotlin.Boolean value=true + then: CALL 'public open fun fromRealm (realmValue: io.realm.kotlin.types.RealmInstant): org.mongodb.kbson.BsonDateTime declared in sample.input.RealmInstantBsonDateTimeAdapterSingleton' type=org.mongodb.kbson.BsonDateTime origin=null + $this: GET_OBJECT 'CLASS OBJECT name:RealmInstantBsonDateTimeAdapterSingleton modality:FINAL visibility:public superTypes:[io.realm.kotlin.types.RealmTypeAdapter]' type=sample.input.RealmInstantBsonDateTimeAdapterSingleton + realmValue: CALL 'internal final fun getInstant (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.types.RealmInstant? [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.types.RealmInstant? origin=GET_PROPERTY + $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper + obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null + propertyName: CONST String type=kotlin.String value="singletonAdaptedRealmInstant" + FUN name: visibility:public modality:FINAL <> ($this:sample.input.Sample, :org.mongodb.kbson.BsonDateTime) returnType:kotlin.Unit + correspondingProperty: PROPERTY name:singletonAdaptedRealmInstant visibility:public modality:FINAL [var] + $this: VALUE_PARAMETER name: type:sample.input.Sample + VALUE_PARAMETER name: index:0 type:org.mongodb.kbson.BsonDateTime + BLOCK_BODY + BLOCK type=kotlin.Unit origin=null + VAR IR_TEMPORARY_VARIABLE name:tmp0_objectReference type:io.realm.kotlin.internal.RealmObjectReference? [val] + CALL 'public open fun (): io.realm.kotlin.internal.RealmObjectReference? declared in sample.input.Sample' type=io.realm.kotlin.internal.RealmObjectReference? origin=GET_PROPERTY + $this: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null + WHEN type=kotlin.Unit origin=null + BRANCH + if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ + arg0: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null + arg1: CONST Null type=kotlin.Nothing? value=null + then: SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:singletonAdaptedRealmInstant type:org.mongodb.kbson.BsonDateTime visibility:private' type=kotlin.Unit origin=null + receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null + value: GET_VAR ': org.mongodb.kbson.BsonDateTime declared in sample.input.Sample.' type=org.mongodb.kbson.BsonDateTime origin=null + BRANCH + if: CONST Boolean type=kotlin.Boolean value=true + then: CALL 'internal final fun setValue (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, value: kotlin.Any?): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper + obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null + propertyName: CONST String type=kotlin.String value="singletonAdaptedRealmInstant" + value: CALL 'public open fun toRealm (value: org.mongodb.kbson.BsonDateTime): io.realm.kotlin.types.RealmInstant declared in sample.input.RealmInstantBsonDateTimeAdapterSingleton' type=io.realm.kotlin.types.RealmInstant origin=null + $this: GET_OBJECT 'CLASS OBJECT name:RealmInstantBsonDateTimeAdapterSingleton modality:FINAL visibility:public superTypes:[io.realm.kotlin.types.RealmTypeAdapter]' type=sample.input.RealmInstantBsonDateTimeAdapterSingleton + value: GET_VAR ': org.mongodb.kbson.BsonDateTime declared in sample.input.Sample.' type=org.mongodb.kbson.BsonDateTime origin=null + PROPERTY name:instancedAdaptedRealmInstant visibility:public modality:FINAL [var] + annotations: + TypeAdapter(adapter = CLASS_REFERENCE 'CLASS CLASS name:RealmInstantBsonDateTimeAdapterInstanced modality:FINAL visibility:public superTypes:[io.realm.kotlin.types.RealmTypeAdapter]' type=kotlin.reflect.KClass) + FIELD PROPERTY_BACKING_FIELD name:instancedAdaptedRealmInstant type:org.mongodb.kbson.BsonDateTime visibility:private + EXPRESSION_BODY + CONSTRUCTOR_CALL 'public constructor () declared in org.mongodb.kbson.BsonDateTime' type=org.mongodb.kbson.BsonDateTime origin=null + FUN name: visibility:public modality:FINAL <> ($this:sample.input.Sample) returnType:org.mongodb.kbson.BsonDateTime + correspondingProperty: PROPERTY name:instancedAdaptedRealmInstant visibility:public modality:FINAL [var] + $this: VALUE_PARAMETER name: type:sample.input.Sample + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): org.mongodb.kbson.BsonDateTime declared in sample.input.Sample' + BLOCK type=org.mongodb.kbson.BsonDateTime origin=null + VAR IR_TEMPORARY_VARIABLE name:tmp0_objectReference type:io.realm.kotlin.internal.RealmObjectReference? [val] + CALL 'public open fun (): io.realm.kotlin.internal.RealmObjectReference? declared in sample.input.Sample' type=io.realm.kotlin.internal.RealmObjectReference? origin=GET_PROPERTY + $this: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null + WHEN type=org.mongodb.kbson.BsonDateTime origin=null + BRANCH + if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ + arg0: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null + arg1: CONST Null type=kotlin.Nothing? value=null + then: GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:instancedAdaptedRealmInstant type:org.mongodb.kbson.BsonDateTime visibility:private' type=org.mongodb.kbson.BsonDateTime origin=null + receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null + BRANCH + if: CONST Boolean type=kotlin.Boolean value=true + then: CALL 'public final fun fromRealm (converterClass: kotlin.reflect.KClass>, realmValue: kotlin.Any): kotlin.Any [inline] declared in io.realm.kotlin.internal.ConvertersKt' type=kotlin.Any origin=null + converterClass: CONST Null type=kotlin.Nothing? value=null + realmValue: CALL 'internal final fun getInstant (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.types.RealmInstant? [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.types.RealmInstant? origin=GET_PROPERTY + $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper + obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null + propertyName: CONST String type=kotlin.String value="instancedAdaptedRealmInstant" + FUN name: visibility:public modality:FINAL <> ($this:sample.input.Sample, :org.mongodb.kbson.BsonDateTime) returnType:kotlin.Unit + correspondingProperty: PROPERTY name:instancedAdaptedRealmInstant visibility:public modality:FINAL [var] + $this: VALUE_PARAMETER name: type:sample.input.Sample + VALUE_PARAMETER name: index:0 type:org.mongodb.kbson.BsonDateTime + BLOCK_BODY + BLOCK type=kotlin.Unit origin=null + VAR IR_TEMPORARY_VARIABLE name:tmp0_objectReference type:io.realm.kotlin.internal.RealmObjectReference? [val] + CALL 'public open fun (): io.realm.kotlin.internal.RealmObjectReference? declared in sample.input.Sample' type=io.realm.kotlin.internal.RealmObjectReference? origin=GET_PROPERTY + $this: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null + WHEN type=kotlin.Unit origin=null + BRANCH + if: CALL 'public final fun EQEQ (arg0: kotlin.Any?, arg1: kotlin.Any?): kotlin.Boolean declared in kotlin.internal.ir' type=kotlin.Boolean origin=EQEQ + arg0: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null + arg1: CONST Null type=kotlin.Nothing? value=null + then: SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:instancedAdaptedRealmInstant type:org.mongodb.kbson.BsonDateTime visibility:private' type=kotlin.Unit origin=null + receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null + value: GET_VAR ': org.mongodb.kbson.BsonDateTime declared in sample.input.Sample.' type=org.mongodb.kbson.BsonDateTime origin=null + BRANCH + if: CONST Boolean type=kotlin.Boolean value=true + then: CALL 'internal final fun setValue (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, value: kotlin.Any?): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper + obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null + propertyName: CONST String type=kotlin.String value="instancedAdaptedRealmInstant" + value: CALL 'public final fun toRealm (converterClass: kotlin.reflect.KClass>, userValue: kotlin.Any): kotlin.Any [inline] declared in io.realm.kotlin.internal.ConvertersKt' type=kotlin.Any origin=null + converterClass: CONST Null type=kotlin.Nothing? value=null + userValue: GET_VAR ': org.mongodb.kbson.BsonDateTime declared in sample.input.Sample.' type=org.mongodb.kbson.BsonDateTime origin=null FUN name:dumpSchema visibility:public modality:FINAL <> ($this:sample.input.Sample) returnType:kotlin.String $this: VALUE_PARAMETER name: type:sample.input.Sample BLOCK_BODY @@ -6459,7 +6571,7 @@ MODULE_FRAGMENT name:
$this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Companion modality:FINAL visibility:public [companion] superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.interop.ClassInfo.Companion name: CONST String type=kotlin.String value="Sample" primaryKey: CONST String type=kotlin.String value="id" - numProperties: CONST Long type=kotlin.Long value=123 + numProperties: CONST Long type=kotlin.Long value=125 isEmbedded: CONST Boolean type=kotlin.Boolean value=false isAsymmetric: CONST Boolean type=kotlin.Boolean value=false cinteropProperties: CALL 'public final fun listOf (vararg elements: T of kotlin.collections.CollectionsKt.listOf): kotlin.collections.List declared in kotlin.collections.CollectionsKt' type=kotlin.collections.List origin=null @@ -7818,6 +7930,28 @@ MODULE_FRAGMENT name:
isPrimaryKey: CONST Boolean type=kotlin.Boolean value=false isIndexed: CONST Boolean type=kotlin.Boolean value=false isFullTextIndexed: CONST Boolean type=kotlin.Boolean value=false + CALL 'internal final fun createPropertyInfo (name: kotlin.String, publicName: kotlin.String?, type: io.realm.kotlin.internal.interop.PropertyType, collectionType: io.realm.kotlin.internal.interop.CollectionType, linkTarget: kotlin.reflect.KClass?, linkOriginPropertyName: kotlin.String?, isNullable: kotlin.Boolean, isPrimaryKey: kotlin.Boolean, isIndexed: kotlin.Boolean, isFullTextIndexed: kotlin.Boolean): io.realm.kotlin.internal.interop.PropertyInfo declared in io.realm.kotlin.internal.schema.CompilerPluginBridgeUtilsKt' type=io.realm.kotlin.internal.interop.PropertyInfo origin=null + name: CONST String type=kotlin.String value="singletonAdaptedRealmInstant" + publicName: CONST String type=kotlin.String value="" + type: GET_ENUM 'ENUM_ENTRY IR_EXTERNAL_DECLARATION_STUB name:RLM_PROPERTY_TYPE_TIMESTAMP' type=io.realm.kotlin.internal.interop.PropertyType + collectionType: GET_ENUM 'ENUM_ENTRY IR_EXTERNAL_DECLARATION_STUB name:RLM_COLLECTION_TYPE_NONE' type=io.realm.kotlin.internal.interop.CollectionType + linkTarget: CONST Null type=kotlin.reflect.KClass? value=null + linkOriginPropertyName: CONST String type=kotlin.String value="" + isNullable: CONST Boolean type=kotlin.Boolean value=false + isPrimaryKey: CONST Boolean type=kotlin.Boolean value=false + isIndexed: CONST Boolean type=kotlin.Boolean value=false + isFullTextIndexed: CONST Boolean type=kotlin.Boolean value=false + CALL 'internal final fun createPropertyInfo (name: kotlin.String, publicName: kotlin.String?, type: io.realm.kotlin.internal.interop.PropertyType, collectionType: io.realm.kotlin.internal.interop.CollectionType, linkTarget: kotlin.reflect.KClass?, linkOriginPropertyName: kotlin.String?, isNullable: kotlin.Boolean, isPrimaryKey: kotlin.Boolean, isIndexed: kotlin.Boolean, isFullTextIndexed: kotlin.Boolean): io.realm.kotlin.internal.interop.PropertyInfo declared in io.realm.kotlin.internal.schema.CompilerPluginBridgeUtilsKt' type=io.realm.kotlin.internal.interop.PropertyInfo origin=null + name: CONST String type=kotlin.String value="instancedAdaptedRealmInstant" + publicName: CONST String type=kotlin.String value="" + type: GET_ENUM 'ENUM_ENTRY IR_EXTERNAL_DECLARATION_STUB name:RLM_PROPERTY_TYPE_TIMESTAMP' type=io.realm.kotlin.internal.interop.PropertyType + collectionType: GET_ENUM 'ENUM_ENTRY IR_EXTERNAL_DECLARATION_STUB name:RLM_COLLECTION_TYPE_NONE' type=io.realm.kotlin.internal.interop.CollectionType + linkTarget: CONST Null type=kotlin.reflect.KClass? value=null + linkOriginPropertyName: CONST String type=kotlin.String value="" + isNullable: CONST Boolean type=kotlin.Boolean value=false + isPrimaryKey: CONST Boolean type=kotlin.Boolean value=false + isIndexed: CONST Boolean type=kotlin.Boolean value=false + isFullTextIndexed: CONST Boolean type=kotlin.Boolean value=false FUN name:io_realm_kotlin_newInstance visibility:public modality:OPEN <> ($this:sample.input.Sample.Companion) returnType:kotlin.Any overridden: public abstract fun io_realm_kotlin_newInstance (): kotlin.Any declared in io.realm.kotlin.internal.RealmObjectCompanion @@ -8473,6 +8607,16 @@ MODULE_FRAGMENT name:
: kotlin.reflect.KProperty1 first: CONST String type=kotlin.String value="persistedNameLinkingObjectsField" second: PROPERTY_REFERENCE 'public final publicNameLinkingObjectsField: io.realm.kotlin.query.RealmResults [delegated,val]' field=null getter='public final fun (): io.realm.kotlin.query.RealmResults declared in sample.input.Sample' setter=null type=kotlin.reflect.KMutableProperty1 origin=null + CONSTRUCTOR_CALL 'public constructor (first: A of kotlin.Pair, second: B of kotlin.Pair) [primary] declared in kotlin.Pair' type=kotlin.Pair> origin=null + : kotlin.String + : kotlin.reflect.KMutableProperty1 + first: CONST String type=kotlin.String value="singletonAdaptedRealmInstant" + second: PROPERTY_REFERENCE 'public final singletonAdaptedRealmInstant: org.mongodb.kbson.BsonDateTime [var]' field=null getter='public final fun (): org.mongodb.kbson.BsonDateTime declared in sample.input.Sample' setter='public final fun (: org.mongodb.kbson.BsonDateTime): kotlin.Unit declared in sample.input.Sample' type=kotlin.reflect.KMutableProperty1 origin=null + CONSTRUCTOR_CALL 'public constructor (first: A of kotlin.Pair, second: B of kotlin.Pair) [primary] declared in kotlin.Pair' type=kotlin.Pair> origin=null + : kotlin.String + : kotlin.reflect.KMutableProperty1 + first: CONST String type=kotlin.String value="instancedAdaptedRealmInstant" + second: PROPERTY_REFERENCE 'public final instancedAdaptedRealmInstant: org.mongodb.kbson.BsonDateTime [var]' field=null getter='public final fun (): org.mongodb.kbson.BsonDateTime declared in sample.input.Sample' setter='public final fun (: org.mongodb.kbson.BsonDateTime): kotlin.Unit declared in sample.input.Sample' type=kotlin.reflect.KMutableProperty1 origin=null FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:sample.input.Sample.Companion) returnType:kotlin.collections.Map> correspondingProperty: PROPERTY name:io_realm_kotlin_fields visibility:public modality:FINAL [var] overridden: @@ -8560,6 +8704,80 @@ MODULE_FRAGMENT name:
SET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:io_realm_kotlin_objectReference type:io.realm.kotlin.internal.RealmObjectReference? visibility:private' type=kotlin.Unit origin=null receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null value: GET_VAR ': io.realm.kotlin.internal.RealmObjectReference? declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null + CLASS OBJECT name:RealmInstantBsonDateTimeAdapterSingleton modality:FINAL visibility:public superTypes:[io.realm.kotlin.types.RealmTypeAdapter] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:sample.input.RealmInstantBsonDateTimeAdapterSingleton + CONSTRUCTOR visibility:private <> () returnType:sample.input.RealmInstantBsonDateTimeAdapterSingleton [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS OBJECT name:RealmInstantBsonDateTimeAdapterSingleton modality:FINAL visibility:public superTypes:[io.realm.kotlin.types.RealmTypeAdapter]' + FUN name:fromRealm visibility:public modality:OPEN <> ($this:sample.input.RealmInstantBsonDateTimeAdapterSingleton, realmValue:io.realm.kotlin.types.RealmInstant) returnType:org.mongodb.kbson.BsonDateTime + overridden: + public abstract fun fromRealm (realmValue: R of io.realm.kotlin.types.RealmTypeAdapter): U of io.realm.kotlin.types.RealmTypeAdapter declared in io.realm.kotlin.types.RealmTypeAdapter + $this: VALUE_PARAMETER name: type:sample.input.RealmInstantBsonDateTimeAdapterSingleton + VALUE_PARAMETER name:realmValue index:0 type:io.realm.kotlin.types.RealmInstant + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun fromRealm (realmValue: io.realm.kotlin.types.RealmInstant): org.mongodb.kbson.BsonDateTime declared in sample.input.RealmInstantBsonDateTimeAdapterSingleton' + CONSTRUCTOR_CALL 'public constructor (value: kotlin.Long) [primary] declared in org.mongodb.kbson.BsonDateTime' type=org.mongodb.kbson.BsonDateTime origin=null + value: CONST Long type=kotlin.Long value=100 + FUN name:toRealm visibility:public modality:OPEN <> ($this:sample.input.RealmInstantBsonDateTimeAdapterSingleton, value:org.mongodb.kbson.BsonDateTime) returnType:io.realm.kotlin.types.RealmInstant + overridden: + public abstract fun toRealm (value: U of io.realm.kotlin.types.RealmTypeAdapter): R of io.realm.kotlin.types.RealmTypeAdapter declared in io.realm.kotlin.types.RealmTypeAdapter + $this: VALUE_PARAMETER name: type:sample.input.RealmInstantBsonDateTimeAdapterSingleton + VALUE_PARAMETER name:value index:0 type:org.mongodb.kbson.BsonDateTime + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun toRealm (value: org.mongodb.kbson.BsonDateTime): io.realm.kotlin.types.RealmInstant declared in sample.input.RealmInstantBsonDateTimeAdapterSingleton' + CALL 'public final fun now (): io.realm.kotlin.types.RealmInstant declared in io.realm.kotlin.types.RealmInstant.Companion' type=io.realm.kotlin.types.RealmInstant origin=null + $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Companion modality:FINAL visibility:public [companion] superTypes:[kotlin.Any]' type=io.realm.kotlin.types.RealmInstant.Companion + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in io.realm.kotlin.types.RealmTypeAdapter + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int [fake_override] declared in io.realm.kotlin.types.RealmTypeAdapter + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String [fake_override] declared in io.realm.kotlin.types.RealmTypeAdapter + $this: VALUE_PARAMETER name: type:kotlin.Any + CLASS CLASS name:RealmInstantBsonDateTimeAdapterInstanced modality:FINAL visibility:public superTypes:[io.realm.kotlin.types.RealmTypeAdapter] + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:sample.input.RealmInstantBsonDateTimeAdapterInstanced + CONSTRUCTOR visibility:public <> () returnType:sample.input.RealmInstantBsonDateTimeAdapterInstanced [primary] + BLOCK_BODY + DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' + INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:RealmInstantBsonDateTimeAdapterInstanced modality:FINAL visibility:public superTypes:[io.realm.kotlin.types.RealmTypeAdapter]' + FUN name:fromRealm visibility:public modality:OPEN <> ($this:sample.input.RealmInstantBsonDateTimeAdapterInstanced, realmValue:io.realm.kotlin.types.RealmInstant) returnType:org.mongodb.kbson.BsonDateTime + overridden: + public abstract fun fromRealm (realmValue: R of io.realm.kotlin.types.RealmTypeAdapter): U of io.realm.kotlin.types.RealmTypeAdapter declared in io.realm.kotlin.types.RealmTypeAdapter + $this: VALUE_PARAMETER name: type:sample.input.RealmInstantBsonDateTimeAdapterInstanced + VALUE_PARAMETER name:realmValue index:0 type:io.realm.kotlin.types.RealmInstant + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun fromRealm (realmValue: io.realm.kotlin.types.RealmInstant): org.mongodb.kbson.BsonDateTime declared in sample.input.RealmInstantBsonDateTimeAdapterInstanced' + CONSTRUCTOR_CALL 'public constructor (value: kotlin.Long) [primary] declared in org.mongodb.kbson.BsonDateTime' type=org.mongodb.kbson.BsonDateTime origin=null + value: CONST Long type=kotlin.Long value=100 + FUN name:toRealm visibility:public modality:OPEN <> ($this:sample.input.RealmInstantBsonDateTimeAdapterInstanced, value:org.mongodb.kbson.BsonDateTime) returnType:io.realm.kotlin.types.RealmInstant + overridden: + public abstract fun toRealm (value: U of io.realm.kotlin.types.RealmTypeAdapter): R of io.realm.kotlin.types.RealmTypeAdapter declared in io.realm.kotlin.types.RealmTypeAdapter + $this: VALUE_PARAMETER name: type:sample.input.RealmInstantBsonDateTimeAdapterInstanced + VALUE_PARAMETER name:value index:0 type:org.mongodb.kbson.BsonDateTime + BLOCK_BODY + RETURN type=kotlin.Nothing from='public open fun toRealm (value: org.mongodb.kbson.BsonDateTime): io.realm.kotlin.types.RealmInstant declared in sample.input.RealmInstantBsonDateTimeAdapterInstanced' + CALL 'public final fun now (): io.realm.kotlin.types.RealmInstant declared in io.realm.kotlin.types.RealmInstant.Companion' type=io.realm.kotlin.types.RealmInstant origin=null + $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:Companion modality:FINAL visibility:public [companion] superTypes:[kotlin.Any]' type=io.realm.kotlin.types.RealmInstant.Companion + FUN FAKE_OVERRIDE name:equals visibility:public modality:OPEN <> ($this:kotlin.Any, other:kotlin.Any?) returnType:kotlin.Boolean [fake_override,operator] + overridden: + public open fun equals (other: kotlin.Any?): kotlin.Boolean [fake_override,operator] declared in io.realm.kotlin.types.RealmTypeAdapter + $this: VALUE_PARAMETER name: type:kotlin.Any + VALUE_PARAMETER name:other index:0 type:kotlin.Any? + FUN FAKE_OVERRIDE name:hashCode visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.Int [fake_override] + overridden: + public open fun hashCode (): kotlin.Int [fake_override] declared in io.realm.kotlin.types.RealmTypeAdapter + $this: VALUE_PARAMETER name: type:kotlin.Any + FUN FAKE_OVERRIDE name:toString visibility:public modality:OPEN <> ($this:kotlin.Any) returnType:kotlin.String [fake_override] + overridden: + public open fun toString (): kotlin.String [fake_override] declared in io.realm.kotlin.types.RealmTypeAdapter + $this: VALUE_PARAMETER name: type:kotlin.Any CLASS CLASS name:Child modality:OPEN visibility:public superTypes:[io.realm.kotlin.types.RealmObject; io.realm.kotlin.internal.RealmObjectInternal] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:sample.input.Child CONSTRUCTOR visibility:public <> () returnType:sample.input.Child [primary] diff --git a/packages/plugin-compiler/src/test/resources/sample/input/Sample.kt b/packages/plugin-compiler/src/test/resources/sample/input/Sample.kt index 23018c2718..7f2dc24682 100644 --- a/packages/plugin-compiler/src/test/resources/sample/input/Sample.kt +++ b/packages/plugin-compiler/src/test/resources/sample/input/Sample.kt @@ -30,10 +30,13 @@ import io.realm.kotlin.types.RealmList import io.realm.kotlin.types.RealmObject import io.realm.kotlin.types.RealmSet import io.realm.kotlin.types.RealmUUID +import io.realm.kotlin.types.RealmTypeAdapter import io.realm.kotlin.types.annotations.Ignore import io.realm.kotlin.types.annotations.Index import io.realm.kotlin.types.annotations.PrimaryKey import io.realm.kotlin.types.annotations.PersistedName +import io.realm.kotlin.types.annotations.TypeAdapter +import org.mongodb.kbson.BsonDateTime import org.mongodb.kbson.BsonObjectId import org.mongodb.kbson.Decimal128 import java.util.* @@ -201,9 +204,27 @@ class Sample : RealmObject { @PersistedName("persistedNameLinkingObjectsField") val publicNameLinkingObjectsField by backlinks(Sample::objectSetField) + @TypeAdapter(adapter = RealmInstantBsonDateTimeAdapterSingleton::class) + var singletonAdaptedRealmInstant: BsonDateTime = BsonDateTime() + + @TypeAdapter(adapter = RealmInstantBsonDateTimeAdapterInstanced::class) + var instancedAdaptedRealmInstant: BsonDateTime = BsonDateTime() + fun dumpSchema(): String = "${Sample.`io_realm_kotlin_schema`()}" } +object RealmInstantBsonDateTimeAdapterSingleton: RealmTypeAdapter { + override fun fromRealm(realmValue: RealmInstant): BsonDateTime = BsonDateTime(100) + + override fun toRealm(value: BsonDateTime): RealmInstant = RealmInstant.now() +} + +class RealmInstantBsonDateTimeAdapterInstanced: RealmTypeAdapter { + override fun fromRealm(realmValue: RealmInstant): BsonDateTime = BsonDateTime(100) + + override fun toRealm(value: BsonDateTime): RealmInstant = RealmInstant.now() +} + class Child : RealmObject { var name: String? = "Child-default" val linkingObjectsByObject by backlinks(Sample::child) diff --git a/packages/test-base/src/commonMain/kotlin/io/realm/kotlin/entities/adapters/UsingInstancedAdapter.kt b/packages/test-base/src/commonMain/kotlin/io/realm/kotlin/entities/adapters/UsingInstancedAdapter.kt new file mode 100644 index 0000000000..01c17a0ff4 --- /dev/null +++ b/packages/test-base/src/commonMain/kotlin/io/realm/kotlin/entities/adapters/UsingInstancedAdapter.kt @@ -0,0 +1,40 @@ +/* + * Copyright 2021 Realm Inc. + * + * 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. + */ +@file:Suppress("invisible_member", "invisible_reference") + +package io.realm.kotlin.entities.adapters + +import io.realm.kotlin.types.RealmInstant +import io.realm.kotlin.types.RealmObject +import io.realm.kotlin.types.RealmTypeAdapter +import io.realm.kotlin.types.annotations.TypeAdapter +import org.mongodb.kbson.BsonDateTime +import io.realm.kotlin.internal.asBsonDateTime +import io.realm.kotlin.internal.toRealmInstant +import kotlin.time.Duration.Companion.milliseconds + +class UsingInstancedAdapter : RealmObject { + @TypeAdapter(adapter = RealmInstantBsonDateTimeAdapterInstanced::class) + var date: BsonDateTime = BsonDateTime() +} + +class RealmInstantBsonDateTimeAdapterInstanced : RealmTypeAdapter { + override fun fromRealm(realmValue: RealmInstant): BsonDateTime = realmValue.asBsonDateTime() + + override fun toRealm(value: BsonDateTime): RealmInstant = + value.value.milliseconds.toRealmInstant() +} + diff --git a/packages/test-base/src/commonMain/kotlin/io/realm/kotlin/entities/adapters/UsingSingletonAdapter.kt b/packages/test-base/src/commonMain/kotlin/io/realm/kotlin/entities/adapters/UsingSingletonAdapter.kt new file mode 100644 index 0000000000..85778759f5 --- /dev/null +++ b/packages/test-base/src/commonMain/kotlin/io/realm/kotlin/entities/adapters/UsingSingletonAdapter.kt @@ -0,0 +1,40 @@ +/* + * Copyright 2021 Realm Inc. + * + * 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. + */ +@file:Suppress("invisible_member", "invisible_reference") + +package io.realm.kotlin.entities.adapters + +import io.realm.kotlin.types.RealmInstant +import io.realm.kotlin.types.RealmObject +import io.realm.kotlin.types.RealmTypeAdapter +import io.realm.kotlin.types.annotations.TypeAdapter +import org.mongodb.kbson.BsonDateTime +import io.realm.kotlin.internal.asBsonDateTime +import io.realm.kotlin.internal.toRealmInstant +import kotlin.time.Duration.Companion.milliseconds + +class UsingSingletonAdapter : RealmObject { + @TypeAdapter(adapter = RealmInstantBsonDateTimeAdapterSingleton::class) + var date: BsonDateTime = BsonDateTime() +} + +object RealmInstantBsonDateTimeAdapterSingleton : RealmTypeAdapter { + override fun fromRealm(realmValue: RealmInstant): BsonDateTime = realmValue.asBsonDateTime() + + override fun toRealm(value: BsonDateTime): RealmInstant = + value.value.milliseconds.toRealmInstant() +} + diff --git a/packages/test-base/src/commonTest/kotlin/io/realm/kotlin/test/common/TypeAdapterTests.kt b/packages/test-base/src/commonTest/kotlin/io/realm/kotlin/test/common/TypeAdapterTests.kt new file mode 100644 index 0000000000..8554314336 --- /dev/null +++ b/packages/test-base/src/commonTest/kotlin/io/realm/kotlin/test/common/TypeAdapterTests.kt @@ -0,0 +1,105 @@ +/* + * Copyright 2021 Realm Inc. + * + * 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 io.realm.kotlin.test.common + +import io.realm.kotlin.Realm +import io.realm.kotlin.RealmConfiguration +import io.realm.kotlin.entities.adapters.RealmInstantBsonDateTimeAdapterInstanced +import io.realm.kotlin.entities.adapters.UsingInstancedAdapter +//import io.realm.kotlin.entities.adapters.UsingInstancedAdapter +import io.realm.kotlin.entities.adapters.UsingSingletonAdapter +import io.realm.kotlin.test.platform.PlatformUtils +import org.mongodb.kbson.BsonDateTime +import kotlin.test.AfterTest +import kotlin.test.BeforeTest +import kotlin.test.Test +import kotlin.test.assertEquals + +class TypeAdapterTests { + private lateinit var tmpDir: String + private lateinit var realm: Realm + + private lateinit var configuration: RealmConfiguration + + @BeforeTest + fun setup() { + tmpDir = PlatformUtils.createTempDir() + configuration = RealmConfiguration.Builder(setOf(UsingSingletonAdapter::class, UsingInstancedAdapter::class)) + .directory(tmpDir) + .typeAdapters { + add(RealmInstantBsonDateTimeAdapterInstanced()) + } + .build() + realm = Realm.open(configuration) + } + + @AfterTest + fun tearDown() { + if (this::realm.isInitialized && !realm.isClosed()) { + realm.close() + } + PlatformUtils.deleteTempDir(tmpDir) + } + + /** + * We shall cover with these tests: + * + * Singleton / instanced adapters + * All types including collections + * Nullability + * Default values + * Compatibility with other annotations: + * - PrimaryKey + * - Index + * - Fulltext search + * - PersistedName + * - Ignore + * Backlinks + */ + + @Test + fun useSingletonAdapter() { + val expectedDate = BsonDateTime() + + val adapted = UsingSingletonAdapter().apply { + this.date = expectedDate + } + assertEquals(expectedDate, adapted.date) + + val storedAdapted = realm.writeBlocking { + copyToRealm(adapted) + } + + assertEquals(expectedDate, storedAdapted.date) + } + + @Test + fun useInstancedAdapter() { + val expectedDate = BsonDateTime() + + val adapted = UsingInstancedAdapter().apply { + this.date = expectedDate + } + assertEquals(expectedDate, adapted.date) + + val storedAdapted = realm.writeBlocking { + copyToRealm(adapted) + } + + assertEquals(expectedDate, storedAdapted.date) + } + +} From eb9847920f6c119c35d8aab25d7e59270c05cb31 Mon Sep 17 00:00:00 2001 From: Clemente Date: Mon, 4 Dec 2023 14:51:58 +0100 Subject: [PATCH 02/32] Add support for other types --- .../kotlin/internal/InternalConfiguration.kt | 2 + .../io/realm/kotlin/types/RealmTypeAdapter.kt | 1 + .../compiler/AccessorModifierIrGeneration.kt | 213 ++++++++++++------ .../kotlin/test/common/TypeAdapterTests.kt | 34 +-- .../kotlin/test/compiler/TypeAdaptersTests.kt | 75 ++++++ 5 files changed, 240 insertions(+), 85 deletions(-) create mode 100644 packages/test-base/src/jvmTest/kotlin/io/realm/kotlin/test/compiler/TypeAdaptersTests.kt diff --git a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/InternalConfiguration.kt b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/InternalConfiguration.kt index 8ea0e771a9..2f89d0953c 100644 --- a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/InternalConfiguration.kt +++ b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/InternalConfiguration.kt @@ -37,6 +37,8 @@ public interface InternalConfiguration : Configuration { public val writeDispatcherFactory: CoroutineDispatcherFactory public val schemaMode: SchemaMode public val logger: ContextLogger + // TODO make it a map +// public val adapters: Map>, RealmTypeAdapter<*, *>> public val adapters: List> // Temporary work-around for https://github.com/realm/realm-kotlin/issues/724 diff --git a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/types/RealmTypeAdapter.kt b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/types/RealmTypeAdapter.kt index f3136c6f0c..48559a1f76 100644 --- a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/types/RealmTypeAdapter.kt +++ b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/types/RealmTypeAdapter.kt @@ -6,6 +6,7 @@ package io.realm.kotlin.types * @param R realm type. * @param U user type. */ +// TODO Perform some validation on supported R realm-types public interface RealmTypeAdapter { // where P is a supported realm type public fun fromRealm(realmValue: R): U diff --git a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/AccessorModifierIrGeneration.kt b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/AccessorModifierIrGeneration.kt index b39205a36f..94507c7902 100644 --- a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/AccessorModifierIrGeneration.kt +++ b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/AccessorModifierIrGeneration.kt @@ -73,7 +73,6 @@ import org.jetbrains.kotlin.ir.builders.irGet import org.jetbrains.kotlin.ir.builders.irGetObject import org.jetbrains.kotlin.ir.builders.irIfNull import org.jetbrains.kotlin.ir.builders.irLetS -import org.jetbrains.kotlin.ir.builders.irNull import org.jetbrains.kotlin.ir.builders.irReturn import org.jetbrains.kotlin.ir.builders.irString import org.jetbrains.kotlin.ir.declarations.IrClass @@ -109,6 +108,8 @@ import org.jetbrains.kotlin.ir.types.isShort import org.jetbrains.kotlin.ir.types.isString import org.jetbrains.kotlin.ir.types.isSubtypeOfClass import org.jetbrains.kotlin.ir.types.makeNotNull +import org.jetbrains.kotlin.ir.types.superTypes +import org.jetbrains.kotlin.ir.types.typeOrNull import org.jetbrains.kotlin.ir.util.classId import org.jetbrains.kotlin.ir.util.defaultType import org.jetbrains.kotlin.ir.util.parentAsClass @@ -123,7 +124,7 @@ import org.jetbrains.kotlin.types.KotlinType import org.jetbrains.kotlin.types.StarProjectionImpl import org.jetbrains.kotlin.types.isNullable import org.jetbrains.kotlin.types.typeUtil.supertypes -import java.lang.IllegalStateException +import kotlin.IllegalStateException import kotlin.collections.set /** @@ -413,7 +414,6 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { fromRealmValue = longToChar, toPublic = null, setFunction = setValue, -// fromPublic = charToLong, fromPublic = { _, value -> irCall(callee = charToLong).apply { putValueArgument(0, value) @@ -436,7 +436,6 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { fromRealmValue = longToShort, toPublic = null, setFunction = setValue, -// fromPublic = shortToLong, fromPublic = { _, value -> irCall(callee = shortToLong).apply { putValueArgument(0, value) @@ -459,7 +458,6 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { fromRealmValue = longToInt, toPublic = null, setFunction = setValue, -// fromPublic = intToLong, fromPublic = { _, value -> irCall(callee = intToLong).apply { putValueArgument(0, value) @@ -736,77 +734,86 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { declaration.hasAnnotation(TYPE_ADAPTER_ANNOTATION) -> { logDebug("Object property named ${declaration.name} is an adapted type.") - // TODO check nullability + val adapterClassReference = + declaration.getAnnotation(TYPE_ADAPTER_ANNOTATION.asSingleFqName()) + .getValueArgument(0)!! as IrClassReference + val adapterClass: IrClass = adapterClassReference.classType.getClass()!! + // TODO find correct super type adapter type, might be multiple ones + val (realmType: IrTypeArgument, userType) = + (adapterClassReference.symbol.superTypes().first() as IrSimpleType) + .arguments + .let { arguments -> + arguments[0] to arguments[1] + } + + // TODO check nullability // 1. Extract what is the actual schema property // TODO extract the type from the annotation, by now hardcoded one - val schemaProperty = SchemaProperty( - propertyType = PropertyType.RLM_PROPERTY_TYPE_TIMESTAMP, - declaration = declaration, - collectionType = CollectionType.NONE - ) - fields[name] = schemaProperty - // 2. Modify the accessor to use the type adapter. The type adapter might or - // not be provided (singleton vs class) - - val adapterClassReference = declaration.getAnnotation(TYPE_ADAPTER_ANNOTATION.asSingleFqName()).getValueArgument(0)!! as IrClassReference - val adapterClass: IrClass = adapterClassReference.classType.getClass()!! - // check kind (object / class) - when (adapterClass.kind) { - ClassKind.CLASS -> { - modifyAccessor( - property = schemaProperty, - getFunction = getInstant, - fromRealmValue = null, - toPublic = {objReference, realmValue -> - irCall(callee = providedAdapterFromRealm).apply { - // pass the class from the annotation - putValueArgument(0, objReference) - putValueArgument(1, adapterClassReference) - putValueArgument(2, realmValue) - } - }, - setFunction = setValue, - fromPublic = { objReference, publicValue -> - irCall(callee = providedAdapterToRealm).apply { - // pass the class from the annotation - putValueArgument(0, objReference) - putValueArgument(1, adapterClassReference) - putValueArgument(2, publicValue) - } - }, - toRealmValue = null - ) - } - ClassKind.OBJECT -> { - val fromRealm = adapterClass.lookupFunction(REALM_TYPE_ADAPTER_FROM_REALM) - val toRealm = adapterClass.lookupFunction(REALM_TYPE_ADAPTER_TO_REALM) - - modifyAccessor( - property = schemaProperty, - getFunction = getInstant, - fromRealmValue = null, - toPublic = { _, realmValue -> - irCall(callee = fromRealm).apply { - putValueArgument(0, realmValue) - dispatchReceiver = irGetObject(adapterClass.symbol) - } - }, - setFunction = setValue, - fromPublic = { _, publicValue -> - irCall(callee = toRealm).apply { - putValueArgument(0, publicValue) - dispatchReceiver = irGetObject(adapterClass.symbol) - } - }, - toRealmValue = null - ) + val schemaProperty = + retrieveSchemaProperty(declaration, realmType.typeOrNull!!) + + if(schemaProperty!= null) { + fields[name] = schemaProperty!! + // 2. Modify the accessor to use the type adapter. The type adapter might or + // not be provided (singleton vs class) + + // check kind (object / class) + when (adapterClass.kind) { + ClassKind.CLASS -> { + modifyAccessor( + property = schemaProperty, + getFunction = getInstant, + fromRealmValue = null, + toPublic = {objReference, realmValue -> + irCall(callee = providedAdapterFromRealm).apply { + // pass the class from the annotation + putValueArgument(0, objReference) + putValueArgument(1, adapterClassReference) + putValueArgument(2, realmValue) + } + }, + setFunction = setValue, + fromPublic = { objReference, publicValue -> + irCall(callee = providedAdapterToRealm).apply { + // pass the class from the annotation + putValueArgument(0, objReference) + putValueArgument(1, adapterClassReference) + putValueArgument(2, publicValue) + } + }, + toRealmValue = null + ) + } + ClassKind.OBJECT -> { + val fromRealm = adapterClass.lookupFunction(REALM_TYPE_ADAPTER_FROM_REALM) + val toRealm = adapterClass.lookupFunction(REALM_TYPE_ADAPTER_TO_REALM) + + modifyAccessor( + property = schemaProperty, + getFunction = getInstant, + fromRealmValue = null, + toPublic = { _, realmValue -> + irCall(callee = fromRealm).apply { + putValueArgument(0, realmValue) + dispatchReceiver = irGetObject(adapterClass.symbol) + } + }, + setFunction = setValue, + fromPublic = { _, publicValue -> + irCall(callee = toRealm).apply { + putValueArgument(0, publicValue) + dispatchReceiver = irGetObject(adapterClass.symbol) + } + }, + toRealmValue = null + ) + } + else -> throw IllegalStateException("Unsupported type") } - else -> throw IllegalStateException("Unsupported type") } } - else -> { logError("Realm does not support persisting properties of this type. Mark the field with `@Ignore` to suppress this error.", declaration.locationOf()) } @@ -817,6 +824,74 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { }) } + private fun retrieveSchemaProperty(property: IrProperty, type: IrType): SchemaProperty? = + when { + type.isLong() -> SchemaProperty( + propertyType = PropertyType.RLM_PROPERTY_TYPE_INT, + declaration = property, + collectionType = CollectionType.NONE + ) + type.isBoolean() -> SchemaProperty( + propertyType = PropertyType.RLM_PROPERTY_TYPE_BOOL, + declaration = property, + collectionType = CollectionType.NONE + ) + type.isString() -> SchemaProperty( + propertyType = PropertyType.RLM_PROPERTY_TYPE_STRING, + declaration = property, + collectionType = CollectionType.NONE + ) + type.isByteArray() -> SchemaProperty( + propertyType = PropertyType.RLM_PROPERTY_TYPE_BINARY, + declaration = property, + collectionType = CollectionType.NONE + ) + type.isRealmAny() -> SchemaProperty( + propertyType = PropertyType.RLM_PROPERTY_TYPE_MIXED, + declaration = property, + collectionType = CollectionType.NONE + ) + type.isRealmInstant() -> SchemaProperty( + propertyType = PropertyType.RLM_PROPERTY_TYPE_TIMESTAMP, + declaration = property, + collectionType = CollectionType.NONE + ) + type.isFloat() -> SchemaProperty( + propertyType = PropertyType.RLM_PROPERTY_TYPE_FLOAT, + declaration = property, + collectionType = CollectionType.NONE + ) + type.isDouble() -> SchemaProperty( + propertyType = PropertyType.RLM_PROPERTY_TYPE_DOUBLE, + declaration = property, + collectionType = CollectionType.NONE + ) +// type.isLinkingObject() ->PropertyType.RLM_PROPERTY_TYPE_OBJECT // TODO should be supported (I think so) +// type.isRealmInstant() ->PropertyType.RLM_PROPERTY_TYPE_LINKING_OBJECTS // TODO should be supported (Unsure write some API) + type.isDecimal128() -> SchemaProperty( + propertyType = PropertyType.RLM_PROPERTY_TYPE_DECIMAL128, + declaration = property, + collectionType = CollectionType.NONE + ) + type.isObjectId() -> SchemaProperty( + propertyType = PropertyType.RLM_PROPERTY_TYPE_OBJECT_ID, + declaration = property, + collectionType = CollectionType.NONE + ) + type.isRealmUUID() -> SchemaProperty( + propertyType = PropertyType.RLM_PROPERTY_TYPE_UUID, + declaration = property, + collectionType = CollectionType.NONE + ) + else -> { + logError( + "Invalid type parameter, only Realm types are supported", // TODO find a better error message + property.locationOf() + ) + null + } + } + private fun processCollectionField( collectionType: CollectionType, fields: MutableMap, diff --git a/packages/test-base/src/commonTest/kotlin/io/realm/kotlin/test/common/TypeAdapterTests.kt b/packages/test-base/src/commonTest/kotlin/io/realm/kotlin/test/common/TypeAdapterTests.kt index 8554314336..9812865ac5 100644 --- a/packages/test-base/src/commonTest/kotlin/io/realm/kotlin/test/common/TypeAdapterTests.kt +++ b/packages/test-base/src/commonTest/kotlin/io/realm/kotlin/test/common/TypeAdapterTests.kt @@ -28,6 +28,24 @@ import kotlin.test.BeforeTest import kotlin.test.Test import kotlin.test.assertEquals +/** + * This test suite should cover these points + * Schema validation + * Singleton / instanced adapters + * All types including collections + * Nullability + * Default values + * Compatibility with other annotations: + * - PrimaryKey + * - Index + * - Fulltext search + * - PersistedName + * - Ignore + * Backlinks + * missing instance type adapters + * copyFromRealm + * access objects realm? + */ class TypeAdapterTests { private lateinit var tmpDir: String private lateinit var realm: Realm @@ -54,22 +72,6 @@ class TypeAdapterTests { PlatformUtils.deleteTempDir(tmpDir) } - /** - * We shall cover with these tests: - * - * Singleton / instanced adapters - * All types including collections - * Nullability - * Default values - * Compatibility with other annotations: - * - PrimaryKey - * - Index - * - Fulltext search - * - PersistedName - * - Ignore - * Backlinks - */ - @Test fun useSingletonAdapter() { val expectedDate = BsonDateTime() diff --git a/packages/test-base/src/jvmTest/kotlin/io/realm/kotlin/test/compiler/TypeAdaptersTests.kt b/packages/test-base/src/jvmTest/kotlin/io/realm/kotlin/test/compiler/TypeAdaptersTests.kt new file mode 100644 index 0000000000..de4fab2504 --- /dev/null +++ b/packages/test-base/src/jvmTest/kotlin/io/realm/kotlin/test/compiler/TypeAdaptersTests.kt @@ -0,0 +1,75 @@ +/* + * Copyright 2023 Realm Inc. + * + * 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 io.realm.kotlin.test.compiler + +import com.tschuchort.compiletesting.KotlinCompilation +import com.tschuchort.compiletesting.SourceFile +import io.realm.kotlin.internal.interop.CollectionType +import io.realm.kotlin.test.util.Compiler.compileFromSource +import io.realm.kotlin.test.util.TypeDescriptor.allFieldTypes +import io.realm.kotlin.types.MutableRealmInt +import io.realm.kotlin.types.ObjectId +import io.realm.kotlin.types.RealmAny +import io.realm.kotlin.types.RealmInstant +import io.realm.kotlin.types.RealmUUID +import org.junit.Test +import org.mongodb.kbson.BsonObjectId +import org.mongodb.kbson.Decimal128 +import kotlin.reflect.KClassifier +import kotlin.test.assertEquals +import kotlin.test.assertTrue + +class TypeAdaptersTests { + // TODO: Add tests to validate type adapter definitions + // TODO: Q. Shall we fail with declaring type adapters or when we apply them? + + + @Test + fun nonRealmTypesThrow() { + val result = compileFromSource( + plugins = listOf(io.realm.kotlin.compiler.Registrar()), + source = SourceFile.kotlin( + "typeAdapter_unsupported_type.kt", + """ + import io.realm.kotlin.types.RealmInstant + import io.realm.kotlin.types.RealmObject + import io.realm.kotlin.types.RealmTypeAdapter + import io.realm.kotlin.types.annotations.TypeAdapter + + class UserType + + class NonRealmType + + class TestObject : RealmObject { + @TypeAdapter(adapter = UnsupportedRealmTypeParameter::class) + var userType: UserType = UserType() + } + + object UnsupportedRealmTypeParameter : RealmTypeAdapter { + override fun fromRealm(realmValue: NonRealmType): UserType = TODO() + + override fun toRealm(value: UserType): NonRealmType = TODO() + } + """.trimIndent() + ) + ) + assertEquals(KotlinCompilation.ExitCode.COMPILATION_ERROR, result.exitCode, result.messages) + assertTrue(result.messages.contains("Invalid type parameter, only Realm types are supported"), result.messages) + } + + // TODO: What happens if we apply the annotation to: Delegates backlinks +} From 8c3f94155bb9e1649195b196b09cda1701abbd96 Mon Sep 17 00:00:00 2001 From: Clemente Date: Mon, 4 Dec 2023 15:54:52 +0100 Subject: [PATCH 03/32] Use map for instanced adapters --- .../kotlin/io/realm/kotlin/Configuration.kt | 2 +- .../io/realm/kotlin/RealmConfiguration.kt | 4 ++-- .../kotlin/internal/ConfigurationImpl.kt | 2 +- .../io/realm/kotlin/internal/Converters.kt | 22 +++++++++++-------- .../kotlin/internal/InternalConfiguration.kt | 4 +--- .../kotlin/internal/RealmConfigurationImpl.kt | 2 +- 6 files changed, 19 insertions(+), 17 deletions(-) diff --git a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/Configuration.kt b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/Configuration.kt index 81e4c5cdb3..f32bf47a36 100644 --- a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/Configuration.kt +++ b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/Configuration.kt @@ -239,7 +239,7 @@ public interface Configuration { protected var initialDataCallback: InitialDataCallback? = null protected var inMemory: Boolean = false protected var initialRealmFileConfiguration: InitialRealmFileConfiguration? = null - protected var typeAdapters: List> = listOf() + protected var typeAdapters: Map, RealmTypeAdapter<*, *>> = mapOf() /** * Sets the filename of the realm file. diff --git a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/RealmConfiguration.kt b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/RealmConfiguration.kt index 45dfb479ef..0e5b876290 100644 --- a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/RealmConfiguration.kt +++ b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/RealmConfiguration.kt @@ -92,9 +92,9 @@ public interface RealmConfiguration : Configuration { // TODO misplaced, move around public class TypeAdapterBuilder { - internal val adapters: MutableList> = mutableListOf() + internal val adapters: MutableMap, RealmTypeAdapter<*, *>> = mutableMapOf() public fun add(adapter: RealmTypeAdapter<*,*>) { - adapters.add(adapter) + adapters[adapter::class] = adapter } } diff --git a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/ConfigurationImpl.kt b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/ConfigurationImpl.kt index e46c610152..c3396ac50d 100644 --- a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/ConfigurationImpl.kt +++ b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/ConfigurationImpl.kt @@ -69,7 +69,7 @@ public open class ConfigurationImpl( inMemory: Boolean, initialRealmFileConfiguration: InitialRealmFileConfiguration?, logger: ContextLogger, - override val adapters: List>, + override val adapters: Map, RealmTypeAdapter<*, *>>, ) : InternalConfiguration { override val path: String diff --git a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/Converters.kt b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/Converters.kt index cb53bdd78e..1c562bdc88 100644 --- a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/Converters.kt +++ b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/Converters.kt @@ -262,26 +262,30 @@ public inline fun longToInt(value: Long?): Int? = value?.toInt() public inline fun toRealm( obj: RealmObjectReference, - converterClass: KClass>, - userValue: Any, -): Any { + adapterClass: KClass<*>, + userValue: Any?, +): Any? { val adapter = obj.owner.owner .configuration - .adapters - .first { it::class == converterClass } as RealmTypeAdapter + .adapters.let { adapters -> + require(adapters.contains(adapterClass)) {"User provided adaptes don't contains adapter ${adapterClass.simpleName}"} + adapters[adapterClass] as RealmTypeAdapter + } return adapter.toRealm(userValue) } public inline fun fromRealm( obj: RealmObjectReference, - converterClass: KClass>, + adapterClass: KClass<*>, realmValue: Any, -): Any { +): Any? { val adapter = obj.owner.owner .configuration - .adapters - .first { it::class == converterClass } as RealmTypeAdapter + .adapters.let { adapters -> + require(adapters.contains(adapterClass)) {"User provided adaptes don't contains adapter ${adapterClass.simpleName}"} + adapters[adapterClass] as RealmTypeAdapter + } return adapter.fromRealm(realmValue) } diff --git a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/InternalConfiguration.kt b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/InternalConfiguration.kt index 2f89d0953c..33e7a2465b 100644 --- a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/InternalConfiguration.kt +++ b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/InternalConfiguration.kt @@ -37,9 +37,7 @@ public interface InternalConfiguration : Configuration { public val writeDispatcherFactory: CoroutineDispatcherFactory public val schemaMode: SchemaMode public val logger: ContextLogger - // TODO make it a map -// public val adapters: Map>, RealmTypeAdapter<*, *>> - public val adapters: List> + public val adapters: Map, RealmTypeAdapter<*, *>> // Temporary work-around for https://github.com/realm/realm-kotlin/issues/724 public val isFlexibleSyncConfiguration: Boolean diff --git a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmConfigurationImpl.kt b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmConfigurationImpl.kt index 9dfe7468d0..d1b9e4ea7c 100644 --- a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmConfigurationImpl.kt +++ b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmConfigurationImpl.kt @@ -49,7 +49,7 @@ internal class RealmConfigurationImpl( inMemory: Boolean, override val initialRealmFileConfiguration: InitialRealmFileConfiguration?, logger: ContextLogger, - adapters: List> + adapters: Map, RealmTypeAdapter<*, *>> ) : ConfigurationImpl( directory, name, From f64bdf3d076c37a57af05728f7fc496eba098370 Mon Sep 17 00:00:00 2001 From: Clemente Date: Mon, 4 Dec 2023 16:42:05 +0100 Subject: [PATCH 04/32] Clean up configuration + tests --- .../kotlin/io/realm/kotlin/Configuration.kt | 18 +++++++++- .../io/realm/kotlin/RealmConfiguration.kt | 13 +++----- .../kotlin/internal/ConfigurationImpl.kt | 4 ++- .../io/realm/kotlin/internal/Converters.kt | 4 +-- .../kotlin/internal/InternalConfiguration.kt | 2 +- .../kotlin/internal/RealmConfigurationImpl.kt | 4 +-- .../test/common/RealmConfigurationTests.kt | 33 +++++++++++++++++++ 7 files changed, 62 insertions(+), 16 deletions(-) diff --git a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/Configuration.kt b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/Configuration.kt index f32bf47a36..4dcb76aa34 100644 --- a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/Configuration.kt +++ b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/Configuration.kt @@ -50,6 +50,17 @@ public fun interface CompactOnLaunchCallback { public fun shouldCompact(totalBytes: Long, usedBytes: Long): Boolean } + +/** + * TODO + */ +public class TypeAdapterBuilder { + internal val typeAdapters: MutableList> = mutableListOf() + public fun add(adapter: RealmTypeAdapter<*,*>) { + typeAdapters.add(adapter) + } +} + /** * This interface is used to write data to a Realm file when the file is first created. * It will be used in a way similar to using [Realm.writeBlocking]. @@ -197,6 +208,11 @@ public interface Configuration { */ public val initialRealmFileConfiguration: InitialRealmFileConfiguration? + /** + * TODO + */ + public val typeAdapters: List> + /** * Base class for configuration builders that holds properties available to both * [RealmConfiguration] and [SyncConfiguration]. @@ -239,7 +255,7 @@ public interface Configuration { protected var initialDataCallback: InitialDataCallback? = null protected var inMemory: Boolean = false protected var initialRealmFileConfiguration: InitialRealmFileConfiguration? = null - protected var typeAdapters: Map, RealmTypeAdapter<*, *>> = mapOf() + protected var typeAdapters: List> = listOf() /** * Sets the filename of the realm file. diff --git a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/RealmConfiguration.kt b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/RealmConfiguration.kt index 0e5b876290..ec16057a01 100644 --- a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/RealmConfiguration.kt +++ b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/RealmConfiguration.kt @@ -90,17 +90,12 @@ public interface RealmConfiguration : Configuration { public fun directory(directoryPath: String): Builder = apply { this.directory = directoryPath } - // TODO misplaced, move around - public class TypeAdapterBuilder { - internal val adapters: MutableMap, RealmTypeAdapter<*, *>> = mutableMapOf() - public fun add(adapter: RealmTypeAdapter<*,*>) { - adapters[adapter::class] = adapter - } - } - + /** + * TODO + */ public fun typeAdapters(block: TypeAdapterBuilder.()->Unit): Builder = apply { - this.typeAdapters = TypeAdapterBuilder().apply(block).adapters + this.typeAdapters = TypeAdapterBuilder().apply(block).typeAdapters } /** diff --git a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/ConfigurationImpl.kt b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/ConfigurationImpl.kt index c3396ac50d..e0b5f6b152 100644 --- a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/ConfigurationImpl.kt +++ b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/ConfigurationImpl.kt @@ -69,7 +69,7 @@ public open class ConfigurationImpl( inMemory: Boolean, initialRealmFileConfiguration: InitialRealmFileConfiguration?, logger: ContextLogger, - override val adapters: Map, RealmTypeAdapter<*, *>>, + override val typeAdapters: List>, ) : InternalConfiguration { override val path: String @@ -104,6 +104,7 @@ public open class ConfigurationImpl( override val initialDataCallback: InitialDataCallback? override val inMemory: Boolean override val initialRealmFileConfiguration: InitialRealmFileConfiguration? + override val typeAdapterMap: Map, RealmTypeAdapter<*, *>> override fun createNativeConfiguration(): RealmConfigurationPointer { val nativeConfig: RealmConfigurationPointer = RealmInterop.realm_config_new() @@ -150,6 +151,7 @@ public open class ConfigurationImpl( this.initialDataCallback = initialDataCallback this.inMemory = inMemory this.initialRealmFileConfiguration = initialRealmFileConfiguration + this.typeAdapterMap = typeAdapters.associateBy { it::class } // We need to freeze `compactOnLaunchCallback` reference on initial thread for Kotlin Native val compactCallback = compactOnLaunchCallback?.let { callback -> diff --git a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/Converters.kt b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/Converters.kt index 1c562bdc88..514211ab46 100644 --- a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/Converters.kt +++ b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/Converters.kt @@ -267,7 +267,7 @@ public inline fun toRealm( ): Any? { val adapter = obj.owner.owner .configuration - .adapters.let { adapters -> + .typeAdapterMap.let { adapters -> require(adapters.contains(adapterClass)) {"User provided adaptes don't contains adapter ${adapterClass.simpleName}"} adapters[adapterClass] as RealmTypeAdapter } @@ -282,7 +282,7 @@ public inline fun fromRealm( ): Any? { val adapter = obj.owner.owner .configuration - .adapters.let { adapters -> + .typeAdapterMap.let { adapters -> require(adapters.contains(adapterClass)) {"User provided adaptes don't contains adapter ${adapterClass.simpleName}"} adapters[adapterClass] as RealmTypeAdapter } diff --git a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/InternalConfiguration.kt b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/InternalConfiguration.kt index 33e7a2465b..db5b75156e 100644 --- a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/InternalConfiguration.kt +++ b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/InternalConfiguration.kt @@ -37,7 +37,7 @@ public interface InternalConfiguration : Configuration { public val writeDispatcherFactory: CoroutineDispatcherFactory public val schemaMode: SchemaMode public val logger: ContextLogger - public val adapters: Map, RealmTypeAdapter<*, *>> + public val typeAdapterMap: Map, RealmTypeAdapter<*, *>> // Temporary work-around for https://github.com/realm/realm-kotlin/issues/724 public val isFlexibleSyncConfiguration: Boolean diff --git a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmConfigurationImpl.kt b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmConfigurationImpl.kt index d1b9e4ea7c..339b606e87 100644 --- a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmConfigurationImpl.kt +++ b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmConfigurationImpl.kt @@ -49,7 +49,7 @@ internal class RealmConfigurationImpl( inMemory: Boolean, override val initialRealmFileConfiguration: InitialRealmFileConfiguration?, logger: ContextLogger, - adapters: Map, RealmTypeAdapter<*, *>> + typeAdapters: List> ) : ConfigurationImpl( directory, name, @@ -72,6 +72,6 @@ internal class RealmConfigurationImpl( inMemory, initialRealmFileConfiguration, logger, - adapters, + typeAdapters, ), RealmConfiguration diff --git a/packages/test-base/src/commonTest/kotlin/io/realm/kotlin/test/common/RealmConfigurationTests.kt b/packages/test-base/src/commonTest/kotlin/io/realm/kotlin/test/common/RealmConfigurationTests.kt index b84b0226d6..e57d229279 100644 --- a/packages/test-base/src/commonTest/kotlin/io/realm/kotlin/test/common/RealmConfigurationTests.kt +++ b/packages/test-base/src/commonTest/kotlin/io/realm/kotlin/test/common/RealmConfigurationTests.kt @@ -34,6 +34,7 @@ import io.realm.kotlin.test.platform.PlatformUtils import io.realm.kotlin.test.platform.platformFileSystem import io.realm.kotlin.test.util.TestLogger import io.realm.kotlin.test.util.use +import io.realm.kotlin.types.RealmTypeAdapter import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.newSingleThreadContext import okio.Path.Companion.toPath @@ -41,6 +42,7 @@ import kotlin.random.Random import kotlin.test.AfterTest import kotlin.test.BeforeTest import kotlin.test.Test +import kotlin.test.assertContains import kotlin.test.assertContentEquals import kotlin.test.assertEquals import kotlin.test.assertFailsWith @@ -493,6 +495,37 @@ class RealmConfigurationTests { RealmLog.reset() } + @Test + fun customTypeAdapters_defaultEmpty() { + val typeAdapter = object: RealmTypeAdapter { + override fun fromRealm(realmValue: String): String = TODO("Not yet implemented") + + override fun toRealm(value: String): String = TODO("Not yet implemented") + } + + val config = RealmConfiguration.Builder(setOf()) + .build() + + assertTrue(config.typeAdapters.isEmpty()) + } + + @Test + fun defineCustomTypeAdapters() { + val typeAdapter = object: RealmTypeAdapter { + override fun fromRealm(realmValue: String): String = TODO("Not yet implemented") + + override fun toRealm(value: String): String = TODO("Not yet implemented") + } + + val config = RealmConfiguration.Builder(setOf()) + .typeAdapters { + add(typeAdapter) + } + .build() + + assertContains(config.typeAdapters, typeAdapter) + } + private fun assertFailsWithEncryptionKey(builder: RealmConfiguration.Builder, keyLength: Int) { val key = Random.nextBytes(keyLength) assertFailsWith( From b5b6a20ea6e9c8b5b1bfe8e1ad7e56cc7f7d2fd0 Mon Sep 17 00:00:00 2001 From: Clemente Date: Tue, 5 Dec 2023 12:41:34 +0100 Subject: [PATCH 05/32] Add some compile tests --- .../compiler/AccessorModifierIrGeneration.kt | 13 +- .../kotlin/test/compiler/TypeAdaptersTests.kt | 137 +++++++++++++++++- 2 files changed, 140 insertions(+), 10 deletions(-) diff --git a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/AccessorModifierIrGeneration.kt b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/AccessorModifierIrGeneration.kt index 94507c7902..534217cf80 100644 --- a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/AccessorModifierIrGeneration.kt +++ b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/AccessorModifierIrGeneration.kt @@ -93,6 +93,7 @@ import org.jetbrains.kotlin.ir.interpreter.getAnnotation import org.jetbrains.kotlin.ir.types.IrSimpleType import org.jetbrains.kotlin.ir.types.IrType import org.jetbrains.kotlin.ir.types.IrTypeArgument +import org.jetbrains.kotlin.ir.types.classFqName import org.jetbrains.kotlin.ir.types.getClass import org.jetbrains.kotlin.ir.types.impl.IrAbstractSimpleType import org.jetbrains.kotlin.ir.types.isBoolean @@ -752,7 +753,7 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { // TODO extract the type from the annotation, by now hardcoded one val schemaProperty = - retrieveSchemaProperty(declaration, realmType.typeOrNull!!) + retrieveSchemaProperty(declaration, realmType.typeOrNull!!.makeNotNull()) if(schemaProperty!= null) { fields[name] = schemaProperty!! @@ -826,6 +827,11 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { private fun retrieveSchemaProperty(property: IrProperty, type: IrType): SchemaProperty? = when { + // TODO should we allow these realm int subtypes? + type.isChar() || + type.isByte() || + type.isShort() || + type.isInt() || type.isLong() -> SchemaProperty( propertyType = PropertyType.RLM_PROPERTY_TYPE_INT, declaration = property, @@ -873,7 +879,8 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { declaration = property, collectionType = CollectionType.NONE ) - type.isObjectId() -> SchemaProperty( + type.isObjectId() || + type.isRealmObjectId() -> SchemaProperty( propertyType = PropertyType.RLM_PROPERTY_TYPE_OBJECT_ID, declaration = property, collectionType = CollectionType.NONE @@ -885,7 +892,7 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { ) else -> { logError( - "Invalid type parameter, only Realm types are supported", // TODO find a better error message + "Invalid type parameter '${type.classFqName}', only Realm types are supported", // TODO find a better error message property.locationOf() ) null diff --git a/packages/test-base/src/jvmTest/kotlin/io/realm/kotlin/test/compiler/TypeAdaptersTests.kt b/packages/test-base/src/jvmTest/kotlin/io/realm/kotlin/test/compiler/TypeAdaptersTests.kt index de4fab2504..6378dcdd21 100644 --- a/packages/test-base/src/jvmTest/kotlin/io/realm/kotlin/test/compiler/TypeAdaptersTests.kt +++ b/packages/test-base/src/jvmTest/kotlin/io/realm/kotlin/test/compiler/TypeAdaptersTests.kt @@ -20,11 +20,13 @@ import com.tschuchort.compiletesting.KotlinCompilation import com.tschuchort.compiletesting.SourceFile import io.realm.kotlin.internal.interop.CollectionType import io.realm.kotlin.test.util.Compiler.compileFromSource +import io.realm.kotlin.test.util.TypeDescriptor import io.realm.kotlin.test.util.TypeDescriptor.allFieldTypes import io.realm.kotlin.types.MutableRealmInt import io.realm.kotlin.types.ObjectId import io.realm.kotlin.types.RealmAny import io.realm.kotlin.types.RealmInstant +import io.realm.kotlin.types.RealmObject import io.realm.kotlin.types.RealmUUID import org.junit.Test import org.mongodb.kbson.BsonObjectId @@ -33,13 +35,17 @@ import kotlin.reflect.KClassifier import kotlin.test.assertEquals import kotlin.test.assertTrue +/** + * These tests should validate: + * - [x] Adapter with a non-realm type should fail + * - [x] Adapter annotation on unsupported types: delegate, function etc + * - [ ] Adapters type supportness + * - [ ] Instanced and singleton adapters + */ class TypeAdaptersTests { - // TODO: Add tests to validate type adapter definitions - // TODO: Q. Shall we fail with declaring type adapters or when we apply them? - - + // TODO: Can we make it fail when declaring type adapters rather than when we apply them? @Test - fun nonRealmTypesThrow() { + fun `adapters don't support R-types that are not Realm types`() { val result = compileFromSource( plugins = listOf(io.realm.kotlin.compiler.Registrar()), source = SourceFile.kotlin( @@ -68,8 +74,125 @@ class TypeAdaptersTests { ) ) assertEquals(KotlinCompilation.ExitCode.COMPILATION_ERROR, result.exitCode, result.messages) - assertTrue(result.messages.contains("Invalid type parameter, only Realm types are supported"), result.messages) + assertTrue( + result.messages.contains("Invalid type parameter 'NonRealmType', only Realm types are supported"), + result.messages + ) + } + + @Test + fun `applying adapter on backlinked property should fail`() { + val result = compileFromSource( + plugins = listOf(io.realm.kotlin.compiler.Registrar()), + source = SourceFile.kotlin( + "typeAdapter_on_backlinks_fail.kt", + """ + import io.realm.kotlin.ext.backlinks + import io.realm.kotlin.types.RealmInstant + import io.realm.kotlin.types.RealmObject + import io.realm.kotlin.types.RealmTypeAdapter + import io.realm.kotlin.types.annotations.TypeAdapter + + class UserType + + class TestObject1: RealmObject { + var myObject: TestObject2 = TestObject2() + } + + class TestObject2 : RealmObject { + @TypeAdapter(adapter = ValidRealmTypeAdapter::class) + val userType by backlinks(TestObject1::myObject) + } + + object ValidRealmTypeAdapter : RealmTypeAdapter { + override fun fromRealm(realmValue: String): UserType = TODO() + + override fun toRealm(value: UserType): String = TODO() + } + """.trimIndent() + ) + ) + assertEquals(KotlinCompilation.ExitCode.COMPILATION_ERROR, result.exitCode, result.messages) + assertTrue( + result.messages.contains("Invalid type parameter, only Realm types are supported"), + result.messages + ) } - // TODO: What happens if we apply the annotation to: Delegates backlinks + @Test + fun `type adapters supportness`() { + val defaults = mapOf( + Boolean::class to true, + Byte::class to "1", + Char::class to "\'c\'", + Short::class to "1", + Int::class to "1", + Long::class to "1", + Float::class to "1.4f", + Double::class to "1.4", + Decimal128::class to "BsonDecimal128(\"1.4E100\")", + String::class to "\"Realm\"", + RealmInstant::class to "RealmInstant.from(42, 420)", + ObjectId::class to "ObjectId.create()", + BsonObjectId::class to "BsonObjectId()", + RealmUUID::class to "RealmUUID.random()", + ByteArray::class to "byteArrayOf(42)", + MutableRealmInt::class to "MutableRealmInt.create(42)" + ) + + allFieldTypes + .filter { type: TypeDescriptor.RealmFieldType -> + // TODO at some point test collections + type.collectionType == CollectionType.RLM_COLLECTION_TYPE_NONE + } + .filterNot { type -> + // TODO tidy list unsupported types in TypeDescriptor + type.elementType.classifier == MutableRealmInt::class || + type.elementType.classifier == RealmObject::class + } + .forEach { type -> + val elementType = type.elementType + val default = if (!elementType.nullable) defaults[elementType.classifier] + ?: error("unmapped default") else null + + val kotlinLiteral = type.toKotlinLiteral() + + val result = compileFromSource( + plugins = listOf(io.realm.kotlin.compiler.Registrar()), + source = SourceFile.kotlin( + "typeadapter_supportness_$kotlinLiteral.kt", + """ + import io.realm.kotlin.types.RealmAny + import io.realm.kotlin.types.RealmInstant + import io.realm.kotlin.types.MutableRealmInt + import io.realm.kotlin.types.RealmObject + import io.realm.kotlin.types.RealmTypeAdapter + import io.realm.kotlin.types.RealmUUID + import io.realm.kotlin.types.annotations.TypeAdapter + import io.realm.kotlin.types.ObjectId + import org.mongodb.kbson.BsonDecimal128 + import org.mongodb.kbson.BsonObjectId + + class UserType + + class NonRealmType + + class TestObject : RealmObject { + @TypeAdapter(adapter = ValidRealmTypeAdapter::class) + var userType: UserType = UserType() + } + + object ValidRealmTypeAdapter : RealmTypeAdapter<$kotlinLiteral, UserType> { + override fun fromRealm(realmValue: $kotlinLiteral): UserType = TODO() + + override fun toRealm(value: UserType): $kotlinLiteral = TODO() + } + """.trimIndent() + ) + ) + assertEquals(KotlinCompilation.ExitCode.OK, result.exitCode, result.messages) +// assertTrue(result.messages.contains("Invalid type parameter, only Realm types are supported"), result.messages) + } + + } } From 57e8bf30c4cc3dde99a30f85109e0ec2943e88e5 Mon Sep 17 00:00:00 2001 From: Clemente Date: Tue, 5 Dec 2023 13:52:49 +0100 Subject: [PATCH 06/32] Enable Realm list tests --- .../kotlin/io/realm/kotlin/test/util/TypeDescriptor.kt | 2 +- .../kotlin/io/realm/kotlin/test/compiler/TypeAdaptersTests.kt | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/test-base/src/commonMain/kotlin/io/realm/kotlin/test/util/TypeDescriptor.kt b/packages/test-base/src/commonMain/kotlin/io/realm/kotlin/test/util/TypeDescriptor.kt index e580576cfd..2ff454afaa 100644 --- a/packages/test-base/src/commonMain/kotlin/io/realm/kotlin/test/util/TypeDescriptor.kt +++ b/packages/test-base/src/commonMain/kotlin/io/realm/kotlin/test/util/TypeDescriptor.kt @@ -383,7 +383,7 @@ object TypeDescriptor { (elementType.classifier as KClass<*>).simpleName + (if (elementType.nullable) "?" else "") return when (collectionType) { CollectionType.RLM_COLLECTION_TYPE_NONE -> element - CollectionType.RLM_COLLECTION_TYPE_LIST -> "List<$element>" + CollectionType.RLM_COLLECTION_TYPE_LIST -> "RealmList<$element>" CollectionType.RLM_COLLECTION_TYPE_SET -> TODO() CollectionType.RLM_COLLECTION_TYPE_DICTIONARY -> TODO() else -> throw IllegalArgumentException("Wrong collection type: $collectionType") diff --git a/packages/test-base/src/jvmTest/kotlin/io/realm/kotlin/test/compiler/TypeAdaptersTests.kt b/packages/test-base/src/jvmTest/kotlin/io/realm/kotlin/test/compiler/TypeAdaptersTests.kt index 6378dcdd21..50bbc7ea36 100644 --- a/packages/test-base/src/jvmTest/kotlin/io/realm/kotlin/test/compiler/TypeAdaptersTests.kt +++ b/packages/test-base/src/jvmTest/kotlin/io/realm/kotlin/test/compiler/TypeAdaptersTests.kt @@ -143,7 +143,8 @@ class TypeAdaptersTests { allFieldTypes .filter { type: TypeDescriptor.RealmFieldType -> // TODO at some point test collections - type.collectionType == CollectionType.RLM_COLLECTION_TYPE_NONE + type.collectionType == CollectionType.RLM_COLLECTION_TYPE_NONE || + type.collectionType == CollectionType.RLM_COLLECTION_TYPE_LIST } .filterNot { type -> // TODO tidy list unsupported types in TypeDescriptor @@ -163,6 +164,7 @@ class TypeAdaptersTests { "typeadapter_supportness_$kotlinLiteral.kt", """ import io.realm.kotlin.types.RealmAny + import io.realm.kotlin.types.RealmList import io.realm.kotlin.types.RealmInstant import io.realm.kotlin.types.MutableRealmInt import io.realm.kotlin.types.RealmObject From 43dd5dc5b00ee9cf4cdca278d7b3a2c5f020d55c Mon Sep 17 00:00:00 2001 From: Clemente Date: Tue, 5 Dec 2023 16:16:42 +0100 Subject: [PATCH 07/32] Enable collections --- .../compiler/AccessorModifierIrGeneration.kt | 336 +++++++----------- .../realm/kotlin/test/util/TypeDescriptor.kt | 4 +- .../kotlin/test/compiler/TypeAdaptersTests.kt | 13 +- 3 files changed, 142 insertions(+), 211 deletions(-) diff --git a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/AccessorModifierIrGeneration.kt b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/AccessorModifierIrGeneration.kt index 534217cf80..81b3956f5a 100644 --- a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/AccessorModifierIrGeneration.kt +++ b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/AccessorModifierIrGeneration.kt @@ -96,6 +96,7 @@ import org.jetbrains.kotlin.ir.types.IrTypeArgument import org.jetbrains.kotlin.ir.types.classFqName import org.jetbrains.kotlin.ir.types.getClass import org.jetbrains.kotlin.ir.types.impl.IrAbstractSimpleType +import org.jetbrains.kotlin.ir.types.impl.originalKotlinType import org.jetbrains.kotlin.ir.types.isBoolean import org.jetbrains.kotlin.ir.types.isByte import org.jetbrains.kotlin.ir.types.isByteArray @@ -110,6 +111,7 @@ import org.jetbrains.kotlin.ir.types.isString import org.jetbrains.kotlin.ir.types.isSubtypeOfClass import org.jetbrains.kotlin.ir.types.makeNotNull import org.jetbrains.kotlin.ir.types.superTypes +import org.jetbrains.kotlin.ir.types.toKotlinType import org.jetbrains.kotlin.ir.types.typeOrNull import org.jetbrains.kotlin.ir.util.classId import org.jetbrains.kotlin.ir.util.defaultType @@ -232,6 +234,12 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { private lateinit var objectReferenceProperty: IrProperty private lateinit var objectReferenceType: IrType + data class TypeAdapterMethodReferences( + val propertyType: IrType, + val toPublic: (IrBuilderWithScope.(IrGetValue, IrFunctionAccessExpression)->IrDeclarationReference), + val fromPublic: (IrBuilderWithScope.(IrGetValue, IrGetValue)->IrDeclarationReference), + ) + fun modifyPropertiesAndCollectSchema(irClass: IrClass) { logDebug("Processing class ${irClass.name}") val fields = SchemaCollector.properties @@ -265,8 +273,8 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { } val propertyTypeRaw = declaration.backingField!!.type - val propertyType = propertyTypeRaw.makeNotNull() - val nullable = propertyTypeRaw.isNullable() + var propertyType = propertyTypeRaw.makeNotNull() + var nullable = propertyTypeRaw.isNullable() val excludeProperty = declaration.hasAnnotation(IGNORE_ANNOTATION) || declaration.hasAnnotation(TRANSIENT_ANNOTATION) || @@ -290,6 +298,83 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { } } + val typeAdapterMethodReferences = if(declaration.hasAnnotation(TYPE_ADAPTER_ANNOTATION)) { + logDebug("Object property named ${declaration.name} is an adapted type.") + + // TODO throw on unsupported types + + val adapterClassReference = + declaration.getAnnotation(TYPE_ADAPTER_ANNOTATION.asSingleFqName()) + .getValueArgument(0)!! as IrClassReference + val adapterClass: IrClass = adapterClassReference.classType.getClass()!! + + // TODO find correct super type adapter type, might be multiple ones + val (realmType: IrTypeArgument, userType) = + (adapterClassReference.symbol.superTypes().first() as IrSimpleType) + .arguments + .let { arguments -> + arguments[0] to arguments[1] + } + + // TODO throw proper error on null + // replace the property type with the one from the type adapter + realmType.typeOrNull!!.let { + propertyType = it.makeNotNull() + nullable = it.isNullable() + } + + when (adapterClass.kind) { + ClassKind.CLASS -> { + TypeAdapterMethodReferences( + propertyType = propertyType, + toPublic = { objReference, realmValue -> + irCall(callee = providedAdapterFromRealm).apply { + // pass the class from the annotation + putValueArgument(0, objReference) + putValueArgument(1, adapterClassReference) + putValueArgument(2, realmValue) + } + }, + fromPublic = { objReference, publicValue -> + irCall(callee = providedAdapterToRealm).apply { + // pass the class from the annotation + putValueArgument(0, objReference) + putValueArgument(1, adapterClassReference) + putValueArgument(2, publicValue) + } + } + ) + } + + ClassKind.OBJECT -> { + val fromRealm = + adapterClass.lookupFunction(REALM_TYPE_ADAPTER_FROM_REALM) + val toRealm = + adapterClass.lookupFunction(REALM_TYPE_ADAPTER_TO_REALM) + + TypeAdapterMethodReferences( + propertyType = propertyType, + toPublic = { _, realmValue -> + irCall(callee = fromRealm).apply { + putValueArgument(0, realmValue) + dispatchReceiver = irGetObject(adapterClass.symbol) + } + }, + fromPublic = { _, publicValue -> + irCall(callee = toRealm).apply { + putValueArgument(0, publicValue) + dispatchReceiver = irGetObject(adapterClass.symbol) + } + } + ) + } + + else -> throw IllegalStateException("Unsupported type") + } + } else { + null + } + when { excludeProperty -> { logDebug("Property named ${declaration.name} ignored") @@ -312,9 +397,9 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { property = schemaProperty, getFunction = getMutableInt, fromRealmValue = null, - toPublic = null, + toPublic = typeAdapterMethodReferences?.toPublic, setFunction = setValue, - fromPublic = null, + fromPublic = typeAdapterMethodReferences?.fromPublic, toRealmValue = null ) } @@ -336,9 +421,9 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { property = schemaProperty, getFunction = getRealmAny, fromRealmValue = null, - toPublic = null, + toPublic = typeAdapterMethodReferences?.toPublic, setFunction = setValue, - fromPublic = null, + fromPublic = typeAdapterMethodReferences?.fromPublic, toRealmValue = null ) } @@ -355,9 +440,9 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { property = schemaProperty, getFunction = getByteArray, fromRealmValue = null, - toPublic = null, + toPublic = typeAdapterMethodReferences?.toPublic, setFunction = setValue, - fromPublic = null, + fromPublic = typeAdapterMethodReferences?.fromPublic, toRealmValue = null ) } @@ -373,9 +458,9 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { property = schemaProperty, getFunction = getString, fromRealmValue = null, - toPublic = null, + toPublic = typeAdapterMethodReferences?.toPublic, setFunction = setValue, - fromPublic = null, + fromPublic = typeAdapterMethodReferences?.fromPublic, toRealmValue = null ) } @@ -413,7 +498,7 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { property = schemaProperty, getFunction = getLong, fromRealmValue = longToChar, - toPublic = null, + toPublic = typeAdapterMethodReferences?.toPublic, setFunction = setValue, fromPublic = { _, value -> irCall(callee = charToLong).apply { @@ -435,7 +520,7 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { property = schemaProperty, getFunction = getLong, fromRealmValue = longToShort, - toPublic = null, + toPublic = typeAdapterMethodReferences?.toPublic, setFunction = setValue, fromPublic = { _, value -> irCall(callee = shortToLong).apply { @@ -457,7 +542,7 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { property = schemaProperty, getFunction = getLong, fromRealmValue = longToInt, - toPublic = null, + toPublic = typeAdapterMethodReferences?.toPublic, setFunction = setValue, fromPublic = { _, value -> irCall(callee = intToLong).apply { @@ -479,9 +564,9 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { property = schemaProperty, getFunction = getLong, fromRealmValue = null, - toPublic = null, + toPublic = typeAdapterMethodReferences?.toPublic, setFunction = setValue, - fromPublic = null, + fromPublic = typeAdapterMethodReferences?.fromPublic, toRealmValue = null ) } @@ -497,9 +582,9 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { property = schemaProperty, getFunction = getBoolean, fromRealmValue = null, - toPublic = null, + toPublic = typeAdapterMethodReferences?.toPublic, setFunction = setValue, - fromPublic = null, + fromPublic = typeAdapterMethodReferences?.fromPublic, toRealmValue = null ) } @@ -515,9 +600,9 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { property = schemaProperty, getFunction = getFloat, fromRealmValue = null, - toPublic = null, + toPublic = typeAdapterMethodReferences?.toPublic, setFunction = setValue, - fromPublic = null, + fromPublic = typeAdapterMethodReferences?.fromPublic, toRealmValue = null ) } @@ -533,9 +618,9 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { property = schemaProperty, getFunction = getDouble, fromRealmValue = null, - toPublic = null, + toPublic = typeAdapterMethodReferences?.toPublic, setFunction = setValue, - fromPublic = null, + fromPublic = typeAdapterMethodReferences?.fromPublic, toRealmValue = null ) } @@ -551,9 +636,9 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { property = schemaProperty, getFunction = getDecimal128, fromRealmValue = null, - toPublic = null, + toPublic = typeAdapterMethodReferences?.toPublic, setFunction = setValue, - fromPublic = null, + fromPublic = typeAdapterMethodReferences?.fromPublic, toRealmValue = null ) } @@ -609,9 +694,9 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { property = schemaProperty, getFunction = getInstant, fromRealmValue = null, - toPublic = null, + toPublic = typeAdapterMethodReferences?.toPublic, setFunction = setValue, - fromPublic = null, + fromPublic = typeAdapterMethodReferences?.fromPublic, toRealmValue = null ) } @@ -627,9 +712,9 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { property = schemaProperty, getFunction = getObjectId, fromRealmValue = null, - toPublic = null, + toPublic = typeAdapterMethodReferences?.toPublic, setFunction = setValue, - fromPublic = null, + fromPublic = typeAdapterMethodReferences?.fromPublic, toRealmValue = null ) } @@ -645,9 +730,9 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { property = schemaProperty, getFunction = getObjectId, fromRealmValue = objectIdToRealmObjectId, - toPublic = null, + toPublic = typeAdapterMethodReferences?.toPublic, setFunction = setValue, - fromPublic = null, + fromPublic = typeAdapterMethodReferences?.fromPublic, toRealmValue = null ) } @@ -663,23 +748,23 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { property = schemaProperty, getFunction = getUUID, fromRealmValue = null, - toPublic = null, + toPublic = typeAdapterMethodReferences?.toPublic, setFunction = setValue, - fromPublic = null, + fromPublic = typeAdapterMethodReferences?.fromPublic, toRealmValue = null, ) } propertyType.isRealmList() -> { logDebug("RealmList property named ${declaration.name} is ${if (nullable) "" else "not "}nullable") - processCollectionField(CollectionType.LIST, fields, name, declaration) + processCollectionField(CollectionType.LIST, fields, name, declaration, typeAdapterMethodReferences) } propertyType.isRealmSet() -> { logDebug("RealmSet property named ${declaration.name} is ${if (nullable) "" else "not "}nullable") - processCollectionField(CollectionType.SET, fields, name, declaration) + processCollectionField(CollectionType.SET, fields, name, declaration, typeAdapterMethodReferences) } propertyType.isRealmDictionary() -> { logDebug("RealmDictionary property named ${declaration.name} is ${if (nullable) "" else "not "}nullable") - processCollectionField(CollectionType.DICTIONARY, fields, name, declaration) + processCollectionField(CollectionType.DICTIONARY, fields, name, declaration, typeAdapterMethodReferences) } propertyType.isSubtypeOfClass(embeddedRealmObjectInterface) -> { logDebug("Object property named ${declaration.name} is embedded and ${if (nullable) "" else "not "}nullable") @@ -693,9 +778,9 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { schemaProperty, getFunction = getObject, fromRealmValue = null, - toPublic = null, + toPublic = typeAdapterMethodReferences?.toPublic, setFunction = setEmbeddedRealmObject, - fromPublic = null, + fromPublic = typeAdapterMethodReferences?.fromPublic, toRealmValue = null ) } @@ -726,95 +811,12 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { property = schemaProperty, getFunction = getObject, fromRealmValue = null, - toPublic = null, + toPublic = typeAdapterMethodReferences?.toPublic, setFunction = setObject, - fromPublic = null, + fromPublic = typeAdapterMethodReferences?.fromPublic, toRealmValue = null ) } - declaration.hasAnnotation(TYPE_ADAPTER_ANNOTATION) -> { - logDebug("Object property named ${declaration.name} is an adapted type.") - - val adapterClassReference = - declaration.getAnnotation(TYPE_ADAPTER_ANNOTATION.asSingleFqName()) - .getValueArgument(0)!! as IrClassReference - val adapterClass: IrClass = adapterClassReference.classType.getClass()!! - - // TODO find correct super type adapter type, might be multiple ones - val (realmType: IrTypeArgument, userType) = - (adapterClassReference.symbol.superTypes().first() as IrSimpleType) - .arguments - .let { arguments -> - arguments[0] to arguments[1] - } - - // TODO check nullability - // 1. Extract what is the actual schema property - // TODO extract the type from the annotation, by now hardcoded one - - val schemaProperty = - retrieveSchemaProperty(declaration, realmType.typeOrNull!!.makeNotNull()) - - if(schemaProperty!= null) { - fields[name] = schemaProperty!! - // 2. Modify the accessor to use the type adapter. The type adapter might or - // not be provided (singleton vs class) - - // check kind (object / class) - when (adapterClass.kind) { - ClassKind.CLASS -> { - modifyAccessor( - property = schemaProperty, - getFunction = getInstant, - fromRealmValue = null, - toPublic = {objReference, realmValue -> - irCall(callee = providedAdapterFromRealm).apply { - // pass the class from the annotation - putValueArgument(0, objReference) - putValueArgument(1, adapterClassReference) - putValueArgument(2, realmValue) - } - }, - setFunction = setValue, - fromPublic = { objReference, publicValue -> - irCall(callee = providedAdapterToRealm).apply { - // pass the class from the annotation - putValueArgument(0, objReference) - putValueArgument(1, adapterClassReference) - putValueArgument(2, publicValue) - } - }, - toRealmValue = null - ) - } - ClassKind.OBJECT -> { - val fromRealm = adapterClass.lookupFunction(REALM_TYPE_ADAPTER_FROM_REALM) - val toRealm = adapterClass.lookupFunction(REALM_TYPE_ADAPTER_TO_REALM) - - modifyAccessor( - property = schemaProperty, - getFunction = getInstant, - fromRealmValue = null, - toPublic = { _, realmValue -> - irCall(callee = fromRealm).apply { - putValueArgument(0, realmValue) - dispatchReceiver = irGetObject(adapterClass.symbol) - } - }, - setFunction = setValue, - fromPublic = { _, publicValue -> - irCall(callee = toRealm).apply { - putValueArgument(0, publicValue) - dispatchReceiver = irGetObject(adapterClass.symbol) - } - }, - toRealmValue = null - ) - } - else -> throw IllegalStateException("Unsupported type") - } - } - } else -> { logError("Realm does not support persisting properties of this type. Mark the field with `@Ignore` to suppress this error.", declaration.locationOf()) } @@ -825,87 +827,17 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { }) } - private fun retrieveSchemaProperty(property: IrProperty, type: IrType): SchemaProperty? = - when { - // TODO should we allow these realm int subtypes? - type.isChar() || - type.isByte() || - type.isShort() || - type.isInt() || - type.isLong() -> SchemaProperty( - propertyType = PropertyType.RLM_PROPERTY_TYPE_INT, - declaration = property, - collectionType = CollectionType.NONE - ) - type.isBoolean() -> SchemaProperty( - propertyType = PropertyType.RLM_PROPERTY_TYPE_BOOL, - declaration = property, - collectionType = CollectionType.NONE - ) - type.isString() -> SchemaProperty( - propertyType = PropertyType.RLM_PROPERTY_TYPE_STRING, - declaration = property, - collectionType = CollectionType.NONE - ) - type.isByteArray() -> SchemaProperty( - propertyType = PropertyType.RLM_PROPERTY_TYPE_BINARY, - declaration = property, - collectionType = CollectionType.NONE - ) - type.isRealmAny() -> SchemaProperty( - propertyType = PropertyType.RLM_PROPERTY_TYPE_MIXED, - declaration = property, - collectionType = CollectionType.NONE - ) - type.isRealmInstant() -> SchemaProperty( - propertyType = PropertyType.RLM_PROPERTY_TYPE_TIMESTAMP, - declaration = property, - collectionType = CollectionType.NONE - ) - type.isFloat() -> SchemaProperty( - propertyType = PropertyType.RLM_PROPERTY_TYPE_FLOAT, - declaration = property, - collectionType = CollectionType.NONE - ) - type.isDouble() -> SchemaProperty( - propertyType = PropertyType.RLM_PROPERTY_TYPE_DOUBLE, - declaration = property, - collectionType = CollectionType.NONE - ) -// type.isLinkingObject() ->PropertyType.RLM_PROPERTY_TYPE_OBJECT // TODO should be supported (I think so) -// type.isRealmInstant() ->PropertyType.RLM_PROPERTY_TYPE_LINKING_OBJECTS // TODO should be supported (Unsure write some API) - type.isDecimal128() -> SchemaProperty( - propertyType = PropertyType.RLM_PROPERTY_TYPE_DECIMAL128, - declaration = property, - collectionType = CollectionType.NONE - ) - type.isObjectId() || - type.isRealmObjectId() -> SchemaProperty( - propertyType = PropertyType.RLM_PROPERTY_TYPE_OBJECT_ID, - declaration = property, - collectionType = CollectionType.NONE - ) - type.isRealmUUID() -> SchemaProperty( - propertyType = PropertyType.RLM_PROPERTY_TYPE_UUID, - declaration = property, - collectionType = CollectionType.NONE - ) - else -> { - logError( - "Invalid type parameter '${type.classFqName}', only Realm types are supported", // TODO find a better error message - property.locationOf() - ) - null - } - } - private fun processCollectionField( collectionType: CollectionType, fields: MutableMap, name: String, - declaration: IrProperty + declaration: IrProperty, + typeAdapterMethodReferences: TypeAdapterMethodReferences?, ) { - val type: KotlinType = declaration.symbol.owner.toIrBasedDescriptor().type + val type: KotlinType = + typeAdapterMethodReferences?.propertyType?.originalKotlinType + ?: declaration.symbol.owner.toIrBasedDescriptor().type + if (type.arguments[0] is StarProjectionImpl) { logError( "Error in field ${declaration.name} - ${collectionType.description} cannot use a '*' projection.", @@ -914,7 +846,7 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { return } val collectionGenericType = type.arguments[0].type - val coreGenericTypes = getCollectionGenericCoreType(collectionType, declaration) + val coreGenericTypes = getCollectionGenericCoreType(collectionType, declaration, type) // Only process field if we got valid generics if (coreGenericTypes != null) { @@ -951,14 +883,14 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { else -> throw UnsupportedOperationException("Only collections or dictionaries are supposed to modify the getter for '$name'") }, fromRealmValue = null, - toPublic = null, + toPublic = typeAdapterMethodReferences?.toPublic, setFunction = when (collectionType) { CollectionType.LIST -> setList CollectionType.SET -> setSet CollectionType.DICTIONARY -> setDictionary else -> throw UnsupportedOperationException("Only collections or dictionaries are supposed to modify the setter for '$name'") }, - fromPublic = null, + fromPublic = typeAdapterMethodReferences?.fromPublic, toRealmValue = null, collectionType = collectionType ) @@ -1230,10 +1162,10 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { @Suppress("ReturnCount", "LongMethod") private fun getCollectionGenericCoreType( collectionType: CollectionType, - declaration: IrProperty + declaration: IrProperty, + descriptorType: KotlinType, ): CoreType? { // Check first if the generic is a subclass of RealmObject - val descriptorType: KotlinType = declaration.toIrBasedDescriptor().type val collectionGenericType: KotlinType = descriptorType.arguments[0].type val supertypes = collectionGenericType.constructor.supertypes diff --git a/packages/test-base/src/commonMain/kotlin/io/realm/kotlin/test/util/TypeDescriptor.kt b/packages/test-base/src/commonMain/kotlin/io/realm/kotlin/test/util/TypeDescriptor.kt index 2ff454afaa..10cae98b2c 100644 --- a/packages/test-base/src/commonMain/kotlin/io/realm/kotlin/test/util/TypeDescriptor.kt +++ b/packages/test-base/src/commonMain/kotlin/io/realm/kotlin/test/util/TypeDescriptor.kt @@ -384,8 +384,8 @@ object TypeDescriptor { return when (collectionType) { CollectionType.RLM_COLLECTION_TYPE_NONE -> element CollectionType.RLM_COLLECTION_TYPE_LIST -> "RealmList<$element>" - CollectionType.RLM_COLLECTION_TYPE_SET -> TODO() - CollectionType.RLM_COLLECTION_TYPE_DICTIONARY -> TODO() + CollectionType.RLM_COLLECTION_TYPE_SET -> "RealmSet<$element>" + CollectionType.RLM_COLLECTION_TYPE_DICTIONARY -> "RealmDictionary<$element>" else -> throw IllegalArgumentException("Wrong collection type: $collectionType") } } diff --git a/packages/test-base/src/jvmTest/kotlin/io/realm/kotlin/test/compiler/TypeAdaptersTests.kt b/packages/test-base/src/jvmTest/kotlin/io/realm/kotlin/test/compiler/TypeAdaptersTests.kt index 50bbc7ea36..9d0479c20c 100644 --- a/packages/test-base/src/jvmTest/kotlin/io/realm/kotlin/test/compiler/TypeAdaptersTests.kt +++ b/packages/test-base/src/jvmTest/kotlin/io/realm/kotlin/test/compiler/TypeAdaptersTests.kt @@ -41,6 +41,7 @@ import kotlin.test.assertTrue * - [x] Adapter annotation on unsupported types: delegate, function etc * - [ ] Adapters type supportness * - [ ] Instanced and singleton adapters + * - [ ] Other annotations Ignore, Index etc */ class TypeAdaptersTests { // TODO: Can we make it fail when declaring type adapters rather than when we apply them? @@ -141,14 +142,8 @@ class TypeAdaptersTests { ) allFieldTypes - .filter { type: TypeDescriptor.RealmFieldType -> - // TODO at some point test collections - type.collectionType == CollectionType.RLM_COLLECTION_TYPE_NONE || - type.collectionType == CollectionType.RLM_COLLECTION_TYPE_LIST - } .filterNot { type -> - // TODO tidy list unsupported types in TypeDescriptor - type.elementType.classifier == MutableRealmInt::class || +// // TODO tidy list unsupported types in TypeDescriptor type.elementType.classifier == RealmObject::class } .forEach { type -> @@ -158,13 +153,17 @@ class TypeAdaptersTests { val kotlinLiteral = type.toKotlinLiteral() + println(kotlinLiteral) + val result = compileFromSource( plugins = listOf(io.realm.kotlin.compiler.Registrar()), source = SourceFile.kotlin( "typeadapter_supportness_$kotlinLiteral.kt", """ import io.realm.kotlin.types.RealmAny + import io.realm.kotlin.types.RealmDictionary import io.realm.kotlin.types.RealmList + import io.realm.kotlin.types.RealmSet import io.realm.kotlin.types.RealmInstant import io.realm.kotlin.types.MutableRealmInt import io.realm.kotlin.types.RealmObject From c53aa14b9ecefb62f1b3231a6061cee3180138f8 Mon Sep 17 00:00:00 2001 From: Clemente Date: Tue, 5 Dec 2023 16:29:47 +0100 Subject: [PATCH 08/32] Disable derived numerical types --- .../compiler/AccessorModifierIrGeneration.kt | 21 ++++++++++++------- .../kotlin/test/compiler/TypeAdaptersTests.kt | 9 ++++++-- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/AccessorModifierIrGeneration.kt b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/AccessorModifierIrGeneration.kt index 81b3956f5a..ba1b9fa899 100644 --- a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/AccessorModifierIrGeneration.kt +++ b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/AccessorModifierIrGeneration.kt @@ -301,14 +301,12 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { val typeAdapterMethodReferences = if(declaration.hasAnnotation(TYPE_ADAPTER_ANNOTATION)) { logDebug("Object property named ${declaration.name} is an adapted type.") - // TODO throw on unsupported types - val adapterClassReference = declaration.getAnnotation(TYPE_ADAPTER_ANNOTATION.asSingleFqName()) .getValueArgument(0)!! as IrClassReference val adapterClass: IrClass = adapterClassReference.classType.getClass()!! - // TODO find correct super type adapter type, might be multiple ones + // TODO find correct super type adapter type, might be multiple ones because inheritance val (realmType: IrTypeArgument, userType) = (adapterClassReference.symbol.superTypes().first() as IrSimpleType) .arguments @@ -316,11 +314,18 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { arguments[0] to arguments[1] } - // TODO throw proper error on null - // replace the property type with the one from the type adapter - realmType.typeOrNull!!.let { - propertyType = it.makeNotNull() - nullable = it.isNullable() + // Replace the property type with the one from the type adapter + realmType.typeOrNull.let { + if(it != null) { + propertyType = it.makeNotNull() + if(propertyType.isChar() || propertyType.isByte() || propertyType.isShort() || propertyType.isInt() || propertyType.isMutableRealmInteger()) { + // TODO improve messaging + logError("Unsupported Realm storage type. Use `Long` instead", declaration.locationOf()) + } + nullable = it.isNullable() + } else { + logError("Could not retrieve the storage type.") + } } when (adapterClass.kind) { diff --git a/packages/test-base/src/jvmTest/kotlin/io/realm/kotlin/test/compiler/TypeAdaptersTests.kt b/packages/test-base/src/jvmTest/kotlin/io/realm/kotlin/test/compiler/TypeAdaptersTests.kt index 9d0479c20c..921ba8cc17 100644 --- a/packages/test-base/src/jvmTest/kotlin/io/realm/kotlin/test/compiler/TypeAdaptersTests.kt +++ b/packages/test-base/src/jvmTest/kotlin/io/realm/kotlin/test/compiler/TypeAdaptersTests.kt @@ -143,8 +143,13 @@ class TypeAdaptersTests { allFieldTypes .filterNot { type -> -// // TODO tidy list unsupported types in TypeDescriptor - type.elementType.classifier == RealmObject::class + // TODO tidy list unsupported types in TypeDescriptor + type.elementType.classifier == RealmObject::class || + type.elementType.classifier == Byte::class || + type.elementType.classifier == Char::class || + type.elementType.classifier == Short::class || + type.elementType.classifier == Int::class || + type.elementType.classifier == MutableRealmInt::class } .forEach { type -> val elementType = type.elementType From 681a73ebc554597ef5c9830f7a9bd95e41ae25d1 Mon Sep 17 00:00:00 2001 From: Clemente Date: Fri, 8 Dec 2023 18:02:28 +0100 Subject: [PATCH 09/32] More tests --- .../kotlin/entities/adapters/AllTypes.kt | 410 ++++++++++++++++++ .../kotlin/test/common/TypeAdapterTests.kt | 34 +- .../kotlin/test/compiler/TypeAdaptersTests.kt | 6 +- 3 files changed, 436 insertions(+), 14 deletions(-) create mode 100644 packages/test-base/src/commonMain/kotlin/io/realm/kotlin/entities/adapters/AllTypes.kt diff --git a/packages/test-base/src/commonMain/kotlin/io/realm/kotlin/entities/adapters/AllTypes.kt b/packages/test-base/src/commonMain/kotlin/io/realm/kotlin/entities/adapters/AllTypes.kt new file mode 100644 index 0000000000..308df35156 --- /dev/null +++ b/packages/test-base/src/commonMain/kotlin/io/realm/kotlin/entities/adapters/AllTypes.kt @@ -0,0 +1,410 @@ +package io.realm.kotlin.entities.adapters + +import io.realm.kotlin.ext.asBsonObjectId +import io.realm.kotlin.ext.asRealmObject +import io.realm.kotlin.types.ObjectId +import io.realm.kotlin.types.RealmAny +import io.realm.kotlin.types.RealmInstant +import io.realm.kotlin.types.RealmObject +import io.realm.kotlin.types.RealmTypeAdapter +import io.realm.kotlin.types.RealmUUID +import io.realm.kotlin.types.annotations.TypeAdapter +import org.mongodb.kbson.BsonDecimal128 +import org.mongodb.kbson.BsonObjectId +import org.mongodb.kbson.Decimal128 + + +@Suppress("MagicNumber") +class AllTypes : RealmObject { + + @TypeAdapter(StringAdapter::class) + var stringField: String = "Realm" + + @TypeAdapter(BooleanAdapter::class) + var booleanField: Boolean = true + + @TypeAdapter(FloatAdapter::class) + var floatField: Float = 3.14f + + @TypeAdapter(DoubleAdapter::class) + var doubleField: Double = 1.19840122 + + @TypeAdapter(Decimal128Adapter::class) + var decimal128Field: Decimal128 = BsonDecimal128("1.8446744073709551618E-6157") + + @TypeAdapter(TimestampAdapter::class) + var timestampField: RealmInstant = RealmInstant.from(100, 1000) + + @TypeAdapter(ObjectIdAdapter::class) + var objectIdField: ObjectId = ObjectId.from("507f1f77bcf86cd799439011") + + @TypeAdapter(BsonObjectIdAdapter::class) + var bsonObjectIdField: BsonObjectId = BsonObjectId("507f1f77bcf86cd799439011") + + @TypeAdapter(UuidAdapter::class) + var uuidField: RealmUUID = RealmUUID.from("46423f1b-ce3e-4a7e-812f-004cf9c42d76") + + @TypeAdapter(BinaryAdapter::class) + var binaryField: ByteArray = byteArrayOf(42) + + @TypeAdapter(NullableStringAdapter::class) + var nullableStringField: String? = null + + @TypeAdapter(NullableBooleanAdapter::class) + var nullableBooleanField: Boolean? = null + + @TypeAdapter(NullableFloatAdapter::class) + var nullableFloatField: Float? = null + + @TypeAdapter(NullableDoubleAdapter::class) + var nullableDoubleField: Double? = null + + @TypeAdapter(NullableDecimal128Adapter::class) + var nullableDecimal128Field: Decimal128? = null + + @TypeAdapter(NullableTimestampAdapter::class) + var nullableTimestampField: RealmInstant? = null + + @TypeAdapter(NullableObjectIdAdapter::class) + var nullableObjectIdField: ObjectId? = null + + @TypeAdapter(NullableBsonObjectIdAdapter::class) + var nullableBsonObjectIdField: BsonObjectId? = null + + @TypeAdapter(NullableUuidAdapter::class) + var nullableUuidField: RealmUUID? = null + + @TypeAdapter(NullableBinaryAdapter::class) + var nullableBinaryField: ByteArray? = null + + @TypeAdapter(RealmAnyAdapter::class) + var nullableRealmAnyField: RealmAny? = null + +// var nullableObject: Sample? = null +// +// var stringListField: RealmList = realmListOf() +// var byteListField: RealmList = realmListOf() +// var charListField: RealmList = realmListOf() +// var shortListField: RealmList = realmListOf() +// var intListField: RealmList = realmListOf() +// var longListField: RealmList = realmListOf() +// var booleanListField: RealmList = realmListOf() +// var floatListField: RealmList = realmListOf() +// var doubleListField: RealmList = realmListOf() +// var timestampListField: RealmList = realmListOf() +// var objectIdListField: RealmList = realmListOf() +// var bsonObjectIdListField: RealmList = realmListOf() +// var uuidListField: RealmList = realmListOf() +// var binaryListField: RealmList = realmListOf() +// var decimal128ListField: RealmList = realmListOf() +// var objectListField: RealmList = realmListOf() +// +// var nullableStringListField: RealmList = realmListOf() +// var nullableByteListField: RealmList = realmListOf() +// var nullableCharListField: RealmList = realmListOf() +// var nullableShortListField: RealmList = realmListOf() +// var nullableIntListField: RealmList = realmListOf() +// var nullableLongListField: RealmList = realmListOf() +// var nullableBooleanListField: RealmList = realmListOf() +// var nullableFloatListField: RealmList = realmListOf() +// var nullableDoubleListField: RealmList = realmListOf() +// var nullableTimestampListField: RealmList = realmListOf() +// var nullableObjectIdListField: RealmList = realmListOf() +// var nullableBsonObjectIdListField: RealmList = realmListOf() +// var nullableUUIDListField: RealmList = realmListOf() +// var nullableBinaryListField: RealmList = realmListOf() +// var nullableDecimal128ListField: RealmList = realmListOf() +// var nullableRealmAnyListField: RealmList = realmListOf() +// +// var stringSetField: RealmSet = realmSetOf() +// var byteSetField: RealmSet = realmSetOf() +// var charSetField: RealmSet = realmSetOf() +// var shortSetField: RealmSet = realmSetOf() +// var intSetField: RealmSet = realmSetOf() +// var longSetField: RealmSet = realmSetOf() +// var booleanSetField: RealmSet = realmSetOf() +// var floatSetField: RealmSet = realmSetOf() +// var doubleSetField: RealmSet = realmSetOf() +// var timestampSetField: RealmSet = realmSetOf() +// var objectIdSetField: RealmSet = realmSetOf() +// var bsonObjectIdSetField: RealmSet = realmSetOf() +// var uuidSetField: RealmSet = realmSetOf() +// var binarySetField: RealmSet = realmSetOf() +// var decimal128SetField: RealmSet = realmSetOf() +// var objectSetField: RealmSet = realmSetOf() +// +// var nullableStringSetField: RealmSet = realmSetOf() +// var nullableByteSetField: RealmSet = realmSetOf() +// var nullableCharSetField: RealmSet = realmSetOf() +// var nullableShortSetField: RealmSet = realmSetOf() +// var nullableIntSetField: RealmSet = realmSetOf() +// var nullableLongSetField: RealmSet = realmSetOf() +// var nullableBooleanSetField: RealmSet = realmSetOf() +// var nullableFloatSetField: RealmSet = realmSetOf() +// var nullableDoubleSetField: RealmSet = realmSetOf() +// var nullableTimestampSetField: RealmSet = realmSetOf() +// var nullableObjectIdSetField: RealmSet = realmSetOf() +// var nullableBsonObjectIdSetField: RealmSet = realmSetOf() +// var nullableUUIDSetField: RealmSet = realmSetOf() +// var nullableBinarySetField: RealmSet = realmSetOf() +// var nullableDecimal128SetField: RealmSet = realmSetOf() +// var nullableRealmAnySetField: RealmSet = realmSetOf() +// +// var stringDictionaryField: RealmDictionary = realmDictionaryOf() +// var byteDictionaryField: RealmDictionary = realmDictionaryOf() +// var charDictionaryField: RealmDictionary = realmDictionaryOf() +// var shortDictionaryField: RealmDictionary = realmDictionaryOf() +// var intDictionaryField: RealmDictionary = realmDictionaryOf() +// var longDictionaryField: RealmDictionary = realmDictionaryOf() +// var booleanDictionaryField: RealmDictionary = realmDictionaryOf() +// var floatDictionaryField: RealmDictionary = realmDictionaryOf() +// var doubleDictionaryField: RealmDictionary = realmDictionaryOf() +// var timestampDictionaryField: RealmDictionary = realmDictionaryOf() +// var objectIdDictionaryField: RealmDictionary = realmDictionaryOf() +// var bsonObjectIdDictionaryField: RealmDictionary = realmDictionaryOf() +// var uuidDictionaryField: RealmDictionary = realmDictionaryOf() +// var binaryDictionaryField: RealmDictionary = realmDictionaryOf() +// var decimal128DictionaryField: RealmDictionary = realmDictionaryOf() +// +// var nullableStringDictionaryField: RealmDictionary = realmDictionaryOf() +// var nullableByteDictionaryField: RealmDictionary = realmDictionaryOf() +// var nullableCharDictionaryField: RealmDictionary = realmDictionaryOf() +// var nullableShortDictionaryField: RealmDictionary = realmDictionaryOf() +// var nullableIntDictionaryField: RealmDictionary = realmDictionaryOf() +// var nullableLongDictionaryField: RealmDictionary = realmDictionaryOf() +// var nullableBooleanDictionaryField: RealmDictionary = realmDictionaryOf() +// var nullableFloatDictionaryField: RealmDictionary = realmDictionaryOf() +// var nullableDoubleDictionaryField: RealmDictionary = realmDictionaryOf() +// var nullableTimestampDictionaryField: RealmDictionary = realmDictionaryOf() +// var nullableObjectIdDictionaryField: RealmDictionary = realmDictionaryOf() +// var nullableBsonObjectIdDictionaryField: RealmDictionary = realmDictionaryOf() +// var nullableUUIDDictionaryField: RealmDictionary = realmDictionaryOf() +// var nullableBinaryDictionaryField: RealmDictionary = realmDictionaryOf() +// var nullableDecimal128DictionaryField: RealmDictionary = realmDictionaryOf() +// var nullableRealmAnyDictionaryField: RealmDictionary = realmDictionaryOf() +// var nullableObjectDictionaryFieldNotNull: RealmDictionary = realmDictionaryOf() +// var nullableObjectDictionaryFieldNull: RealmDictionary = realmDictionaryOf() +// +// val objectBacklinks by backlinks(Sample::nullableObject) +// val listBacklinks by backlinks(Sample::objectListField) +// val setBacklinks by backlinks(Sample::objectSetField) +// +// @PersistedName("persistedStringField") +// var publicStringField = "Realm" +// +// // For verification that references inside class is also using our modified accessors and are +// // not optimized to use the backing field directly. +// fun stringFieldGetter(): String { +// return stringField +// } +// +// fun stringFieldSetter(s: String) { +// stringField = s +// } + + companion object { + // Empty object required by SampleTests + } + + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other == null || this::class != other::class) return false + + other as AllTypes + + if (stringField != other.stringField) return false + if (booleanField != other.booleanField) return false + if (floatField != other.floatField) return false + if (doubleField != other.doubleField) return false + if (decimal128Field != other.decimal128Field) return false + if (timestampField != other.timestampField) return false + if (objectIdField != other.objectIdField) return false + if (bsonObjectIdField != other.bsonObjectIdField) return false + if (uuidField != other.uuidField) return false + if (!binaryField.contentEquals(other.binaryField)) return false + if (nullableStringField != other.nullableStringField) return false + if (nullableBooleanField != other.nullableBooleanField) return false + if (nullableFloatField != other.nullableFloatField) return false + if (nullableDoubleField != other.nullableDoubleField) return false + if (nullableDecimal128Field != other.nullableDecimal128Field) return false + if (nullableTimestampField != other.nullableTimestampField) return false + if (nullableObjectIdField != other.nullableObjectIdField) return false + if (nullableBsonObjectIdField != other.nullableBsonObjectIdField) return false + if (nullableUuidField != other.nullableUuidField) return false + if (nullableBinaryField != null) { + if (other.nullableBinaryField == null) return false + if (!nullableBinaryField.contentEquals(other.nullableBinaryField)) return false + } else if (other.nullableBinaryField != null) return false + if (nullableRealmAnyField != other.nullableRealmAnyField) return false + + return true + } + + override fun hashCode(): Int { + var result = stringField.hashCode() + result = 31 * result + booleanField.hashCode() + result = 31 * result + floatField.hashCode() + result = 31 * result + doubleField.hashCode() + result = 31 * result + decimal128Field.hashCode() + result = 31 * result + timestampField.hashCode() + result = 31 * result + objectIdField.hashCode() + result = 31 * result + bsonObjectIdField.hashCode() + result = 31 * result + uuidField.hashCode() + result = 31 * result + binaryField.contentHashCode() + result = 31 * result + (nullableStringField?.hashCode() ?: 0) + result = 31 * result + (nullableBooleanField?.hashCode() ?: 0) + result = 31 * result + (nullableFloatField?.hashCode() ?: 0) + result = 31 * result + (nullableDoubleField?.hashCode() ?: 0) + result = 31 * result + (nullableDecimal128Field?.hashCode() ?: 0) + result = 31 * result + (nullableTimestampField?.hashCode() ?: 0) + result = 31 * result + (nullableObjectIdField?.hashCode() ?: 0) + result = 31 * result + (nullableBsonObjectIdField?.hashCode() ?: 0) + result = 31 * result + (nullableUuidField?.hashCode() ?: 0) + result = 31 * result + (nullableBinaryField?.contentHashCode() ?: 0) + result = 31 * result + (nullableRealmAnyField?.hashCode() ?: 0) + return result + } + +} + +// Passthrough converters +object StringAdapter : RealmTypeAdapter { + override fun fromRealm(realmValue: String): String = realmValue.toString() + + override fun toRealm(value: String): String = value.toString() +} + +object BooleanAdapter : RealmTypeAdapter { + override fun fromRealm(realmValue: Boolean): Boolean = realmValue.not().not() + + override fun toRealm(value: Boolean): Boolean = value.not().not() +} + +object FloatAdapter : RealmTypeAdapter { + override fun fromRealm(realmValue: Float): Float = realmValue.toFloat() + + override fun toRealm(value: Float): Float = value.toFloat() +} + +object DoubleAdapter : RealmTypeAdapter { + override fun fromRealm(realmValue: Double): Double = realmValue.toDouble() + + override fun toRealm(value: Double): Double = value.toDouble() +} + +object Decimal128Adapter : RealmTypeAdapter { + override fun fromRealm(realmValue: Decimal128): Decimal128 = Decimal128.fromIEEE754BIDEncoding(realmValue.high, realmValue.low) + + override fun toRealm(value: Decimal128): Decimal128 = Decimal128.fromIEEE754BIDEncoding(value.high, value.low) +} + +object TimestampAdapter : RealmTypeAdapter { + override fun fromRealm(realmValue: RealmInstant): RealmInstant = RealmInstant.from(realmValue.epochSeconds, realmValue.nanosecondsOfSecond) + + override fun toRealm(value: RealmInstant): RealmInstant = RealmInstant.from(value.epochSeconds, value.nanosecondsOfSecond) +} + +object ObjectIdAdapter : RealmTypeAdapter { + override fun fromRealm(realmValue: ObjectId): ObjectId = ObjectId.from(realmValue.asBsonObjectId().toHexString()) + + override fun toRealm(value: ObjectId): ObjectId = ObjectId.from(value.asBsonObjectId().toHexString()) +} + +object BsonObjectIdAdapter : RealmTypeAdapter { + override fun fromRealm(realmValue: BsonObjectId): BsonObjectId = BsonObjectId(realmValue.toHexString()) + + override fun toRealm(value: BsonObjectId): BsonObjectId = BsonObjectId(value.toHexString()) +} + +object UuidAdapter : RealmTypeAdapter { + override fun fromRealm(realmValue: RealmUUID): RealmUUID = RealmUUID.from(realmValue.bytes) + + override fun toRealm(value: RealmUUID): RealmUUID = RealmUUID.from(value.bytes) +} + +object BinaryAdapter : RealmTypeAdapter { + override fun fromRealm(realmValue: ByteArray): ByteArray = realmValue.copyOf() + + override fun toRealm(value: ByteArray): ByteArray = value.copyOf() +} + + +object NullableStringAdapter : RealmTypeAdapter { + override fun fromRealm(realmValue: String?): String? = realmValue?.toString() + + override fun toRealm(value: String?): String? = value?.toString() +} + +object NullableBooleanAdapter : RealmTypeAdapter { + override fun fromRealm(realmValue: Boolean?): Boolean? = realmValue?.not()?.not() + + override fun toRealm(value: Boolean?): Boolean? = value?.not()?.not() +} + +object NullableFloatAdapter : RealmTypeAdapter { + override fun fromRealm(realmValue: Float?): Float? = realmValue?.toFloat() + + override fun toRealm(value: Float?): Float? = value?.toFloat() +} + +object NullableDoubleAdapter : RealmTypeAdapter { + override fun fromRealm(realmValue: Double?): Double? = realmValue?.toDouble() + + override fun toRealm(value: Double?): Double? = value?.toDouble() +} + +object NullableDecimal128Adapter : RealmTypeAdapter { + override fun fromRealm(realmValue: Decimal128?): Decimal128? = realmValue?.let { Decimal128.fromIEEE754BIDEncoding(realmValue.high, realmValue.low) } + + override fun toRealm(value: Decimal128?): Decimal128? = value?.let { Decimal128.fromIEEE754BIDEncoding(value.high, value.low) } +} + +object NullableTimestampAdapter : RealmTypeAdapter { + override fun fromRealm(realmValue: RealmInstant?): RealmInstant? = realmValue?.let { RealmInstant.from(realmValue.epochSeconds, realmValue.nanosecondsOfSecond) } + + override fun toRealm(value: RealmInstant?): RealmInstant? = value?.let { RealmInstant.from(value.epochSeconds, value.nanosecondsOfSecond) } +} + +object NullableObjectIdAdapter : RealmTypeAdapter { + override fun fromRealm(realmValue: ObjectId?): ObjectId? = realmValue?.let { ObjectId.from(realmValue.asBsonObjectId().toHexString()) } + + override fun toRealm(value: ObjectId?): ObjectId? = value?.let { ObjectId.from(value.asBsonObjectId().toHexString()) } +} + +object NullableBsonObjectIdAdapter : RealmTypeAdapter { + override fun fromRealm(realmValue: BsonObjectId?): BsonObjectId? = realmValue?.let { BsonObjectId(realmValue.toHexString()) } + + override fun toRealm(value: BsonObjectId?): BsonObjectId? = value?.let { BsonObjectId(value.toHexString()) } +} + +object NullableUuidAdapter : RealmTypeAdapter { + override fun fromRealm(realmValue: RealmUUID?): RealmUUID? = realmValue?.let { RealmUUID.from(realmValue.bytes) } + + override fun toRealm(value: RealmUUID?): RealmUUID? = value?.let { RealmUUID.from(value.bytes) } +} + +object NullableBinaryAdapter : RealmTypeAdapter { + override fun fromRealm(realmValue: ByteArray?): ByteArray? = realmValue?.let { realmValue.copyOf() } + + override fun toRealm(value: ByteArray?): ByteArray? = value?.let { value.copyOf() } +} + +object RealmAnyAdapter : RealmTypeAdapter { + override fun fromRealm(realmValue: RealmAny?): RealmAny? = realmValue?.let { realmValue.clone() } + + override fun toRealm(value: RealmAny?): RealmAny? = value?.let { value.clone() } +} + +internal fun RealmAny.clone() = when(type) { + RealmAny.Type.INT -> RealmAny.create(asInt()) + RealmAny.Type.BOOL -> RealmAny.create(asBoolean()) + RealmAny.Type.STRING -> RealmAny.create(asString()) + RealmAny.Type.BINARY -> RealmAny.create(asByteArray()) + RealmAny.Type.TIMESTAMP -> RealmAny.create(asRealmInstant()) + RealmAny.Type.FLOAT -> RealmAny.create(asFloat()) + RealmAny.Type.DOUBLE -> RealmAny.create(asDouble()) + RealmAny.Type.DECIMAL128 -> RealmAny.create(asDecimal128()) + RealmAny.Type.OBJECT_ID -> RealmAny.create(asObjectId()) + RealmAny.Type.UUID -> RealmAny.create(asRealmUUID()) + RealmAny.Type.OBJECT -> RealmAny.create(asRealmObject()) +} diff --git a/packages/test-base/src/commonTest/kotlin/io/realm/kotlin/test/common/TypeAdapterTests.kt b/packages/test-base/src/commonTest/kotlin/io/realm/kotlin/test/common/TypeAdapterTests.kt index 9812865ac5..9c047b0dd6 100644 --- a/packages/test-base/src/commonTest/kotlin/io/realm/kotlin/test/common/TypeAdapterTests.kt +++ b/packages/test-base/src/commonTest/kotlin/io/realm/kotlin/test/common/TypeAdapterTests.kt @@ -17,6 +17,7 @@ package io.realm.kotlin.test.common import io.realm.kotlin.Realm import io.realm.kotlin.RealmConfiguration +import io.realm.kotlin.entities.adapters.AllTypes import io.realm.kotlin.entities.adapters.RealmInstantBsonDateTimeAdapterInstanced import io.realm.kotlin.entities.adapters.UsingInstancedAdapter //import io.realm.kotlin.entities.adapters.UsingInstancedAdapter @@ -55,7 +56,7 @@ class TypeAdapterTests { @BeforeTest fun setup() { tmpDir = PlatformUtils.createTempDir() - configuration = RealmConfiguration.Builder(setOf(UsingSingletonAdapter::class, UsingInstancedAdapter::class)) + configuration = RealmConfiguration.Builder(setOf(UsingSingletonAdapter::class, UsingInstancedAdapter::class, AllTypes::class)) .directory(tmpDir) .typeAdapters { add(RealmInstantBsonDateTimeAdapterInstanced()) @@ -76,32 +77,43 @@ class TypeAdapterTests { fun useSingletonAdapter() { val expectedDate = BsonDateTime() - val adapted = UsingSingletonAdapter().apply { + val unmanagedObject = UsingSingletonAdapter().apply { this.date = expectedDate } - assertEquals(expectedDate, adapted.date) + assertEquals(expectedDate, unmanagedObject.date) - val storedAdapted = realm.writeBlocking { - copyToRealm(adapted) + val managedObject = realm.writeBlocking { + copyToRealm(unmanagedObject) } - assertEquals(expectedDate, storedAdapted.date) + assertEquals(expectedDate, managedObject.date) } @Test fun useInstancedAdapter() { val expectedDate = BsonDateTime() - val adapted = UsingInstancedAdapter().apply { + val unmanagedObject = UsingInstancedAdapter().apply { this.date = expectedDate } - assertEquals(expectedDate, adapted.date) + assertEquals(expectedDate, unmanagedObject.date) - val storedAdapted = realm.writeBlocking { - copyToRealm(adapted) + val managedObject = realm.writeBlocking { + copyToRealm(unmanagedObject) } - assertEquals(expectedDate, storedAdapted.date) + assertEquals(expectedDate, managedObject.date) + } + + @Test + fun allTypes() { + val unmanagedObject = AllTypes() + + val managedObject = realm.writeBlocking { + copyToRealm(unmanagedObject) + } + + assertEquals(unmanagedObject, managedObject) } } diff --git a/packages/test-base/src/jvmTest/kotlin/io/realm/kotlin/test/compiler/TypeAdaptersTests.kt b/packages/test-base/src/jvmTest/kotlin/io/realm/kotlin/test/compiler/TypeAdaptersTests.kt index 921ba8cc17..4a1a627f37 100644 --- a/packages/test-base/src/jvmTest/kotlin/io/realm/kotlin/test/compiler/TypeAdaptersTests.kt +++ b/packages/test-base/src/jvmTest/kotlin/io/realm/kotlin/test/compiler/TypeAdaptersTests.kt @@ -20,11 +20,9 @@ import com.tschuchort.compiletesting.KotlinCompilation import com.tschuchort.compiletesting.SourceFile import io.realm.kotlin.internal.interop.CollectionType import io.realm.kotlin.test.util.Compiler.compileFromSource -import io.realm.kotlin.test.util.TypeDescriptor import io.realm.kotlin.test.util.TypeDescriptor.allFieldTypes import io.realm.kotlin.types.MutableRealmInt import io.realm.kotlin.types.ObjectId -import io.realm.kotlin.types.RealmAny import io.realm.kotlin.types.RealmInstant import io.realm.kotlin.types.RealmObject import io.realm.kotlin.types.RealmUUID @@ -39,7 +37,9 @@ import kotlin.test.assertTrue * These tests should validate: * - [x] Adapter with a non-realm type should fail * - [x] Adapter annotation on unsupported types: delegate, function etc - * - [ ] Adapters type supportness + * - [ ] Adapter on wrong type + * - [x] Adapters type supportness + * - [ ] Adapters type unsupportness * - [ ] Instanced and singleton adapters * - [ ] Other annotations Ignore, Index etc */ From b607f3660a5e7e8a7a2b945381219a634cd7fac7 Mon Sep 17 00:00:00 2001 From: Clemente Date: Fri, 8 Dec 2023 18:38:05 +0100 Subject: [PATCH 10/32] Add support for objects --- .../compiler/AccessorModifierIrGeneration.kt | 57 +++++++++++++++++-- .../io/realm/kotlin/compiler/IrUtils.kt | 1 + .../kotlin/entities/adapters/AllTypes.kt | 12 +++- .../kotlin/test/compiler/TypeAdaptersTests.kt | 18 ++++-- 4 files changed, 76 insertions(+), 12 deletions(-) diff --git a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/AccessorModifierIrGeneration.kt b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/AccessorModifierIrGeneration.kt index ba1b9fa899..7d32340d16 100644 --- a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/AccessorModifierIrGeneration.kt +++ b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/AccessorModifierIrGeneration.kt @@ -389,6 +389,7 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { val schemaProperty = SchemaProperty( propertyType = PropertyType.RLM_PROPERTY_TYPE_INT, declaration = declaration, + type = propertyType, collectionType = CollectionType.NONE ) fields[name] = schemaProperty @@ -400,6 +401,7 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { // the managed object to which the fields belongs. modifyAccessor( property = schemaProperty, + type = propertyType, getFunction = getMutableInt, fromRealmValue = null, toPublic = typeAdapterMethodReferences?.toPublic, @@ -418,12 +420,14 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { } val schemaProperty = SchemaProperty( propertyType = PropertyType.RLM_PROPERTY_TYPE_MIXED, + type = propertyType, declaration = declaration, collectionType = CollectionType.NONE ) fields[name] = schemaProperty modifyAccessor( property = schemaProperty, + type = propertyType, getFunction = getRealmAny, fromRealmValue = null, toPublic = typeAdapterMethodReferences?.toPublic, @@ -438,11 +442,13 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { val schemaProperty = SchemaProperty( propertyType = PropertyType.RLM_PROPERTY_TYPE_BINARY, declaration = declaration, + type = propertyType, collectionType = CollectionType.NONE ) fields[name] = schemaProperty modifyAccessor( property = schemaProperty, + type = propertyType, getFunction = getByteArray, fromRealmValue = null, toPublic = typeAdapterMethodReferences?.toPublic, @@ -456,11 +462,13 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { val schemaProperty = SchemaProperty( propertyType = PropertyType.RLM_PROPERTY_TYPE_STRING, declaration = declaration, + type = propertyType, collectionType = CollectionType.NONE ) fields[name] = schemaProperty modifyAccessor( property = schemaProperty, + type = propertyType, getFunction = getString, fromRealmValue = null, toPublic = typeAdapterMethodReferences?.toPublic, @@ -474,11 +482,13 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { val schemaProperty = SchemaProperty( propertyType = PropertyType.RLM_PROPERTY_TYPE_INT, declaration = declaration, + type = propertyType, collectionType = CollectionType.NONE ) fields[name] = schemaProperty modifyAccessor( property = schemaProperty, + type = propertyType, getFunction = getLong, fromRealmValue = longToByte, toPublic = null, @@ -496,11 +506,13 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { val schemaProperty = SchemaProperty( propertyType = PropertyType.RLM_PROPERTY_TYPE_INT, declaration = declaration, + type = propertyType, collectionType = CollectionType.NONE ) fields[name] = schemaProperty modifyAccessor( property = schemaProperty, + type = propertyType, getFunction = getLong, fromRealmValue = longToChar, toPublic = typeAdapterMethodReferences?.toPublic, @@ -518,11 +530,13 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { val schemaProperty = SchemaProperty( propertyType = PropertyType.RLM_PROPERTY_TYPE_INT, declaration = declaration, + type = propertyType, collectionType = CollectionType.NONE ) fields[name] = schemaProperty modifyAccessor( property = schemaProperty, + type = propertyType, getFunction = getLong, fromRealmValue = longToShort, toPublic = typeAdapterMethodReferences?.toPublic, @@ -540,11 +554,13 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { val schemaProperty = SchemaProperty( propertyType = PropertyType.RLM_PROPERTY_TYPE_INT, declaration = declaration, + type = propertyType, collectionType = CollectionType.NONE ) fields[name] = schemaProperty modifyAccessor( property = schemaProperty, + type = propertyType, getFunction = getLong, fromRealmValue = longToInt, toPublic = typeAdapterMethodReferences?.toPublic, @@ -562,11 +578,13 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { val schemaProperty = SchemaProperty( propertyType = PropertyType.RLM_PROPERTY_TYPE_INT, declaration = declaration, + type = propertyType, collectionType = CollectionType.NONE ) fields[name] = schemaProperty modifyAccessor( property = schemaProperty, + type = propertyType, getFunction = getLong, fromRealmValue = null, toPublic = typeAdapterMethodReferences?.toPublic, @@ -580,11 +598,13 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { val schemaProperty = SchemaProperty( propertyType = PropertyType.RLM_PROPERTY_TYPE_BOOL, declaration = declaration, + type = propertyType, collectionType = CollectionType.NONE ) fields[name] = schemaProperty modifyAccessor( property = schemaProperty, + type = propertyType, getFunction = getBoolean, fromRealmValue = null, toPublic = typeAdapterMethodReferences?.toPublic, @@ -598,11 +618,13 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { val schemaProperty = SchemaProperty( propertyType = PropertyType.RLM_PROPERTY_TYPE_FLOAT, declaration = declaration, + type = propertyType, collectionType = CollectionType.NONE ) fields[name] = schemaProperty modifyAccessor( property = schemaProperty, + type = propertyType, getFunction = getFloat, fromRealmValue = null, toPublic = typeAdapterMethodReferences?.toPublic, @@ -616,11 +638,13 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { val schemaProperty = SchemaProperty( propertyType = PropertyType.RLM_PROPERTY_TYPE_DOUBLE, declaration = declaration, + type = propertyType, collectionType = CollectionType.NONE ) fields[name] = schemaProperty modifyAccessor( property = schemaProperty, + type = propertyType, getFunction = getDouble, fromRealmValue = null, toPublic = typeAdapterMethodReferences?.toPublic, @@ -634,11 +658,13 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { val schemaProperty = SchemaProperty( propertyType = PropertyType.RLM_PROPERTY_TYPE_DECIMAL128, declaration = declaration, + type = propertyType, collectionType = CollectionType.NONE ) fields[name] = schemaProperty modifyAccessor( property = schemaProperty, + type = propertyType, getFunction = getDecimal128, fromRealmValue = null, toPublic = typeAdapterMethodReferences?.toPublic, @@ -677,6 +703,7 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { fields[name] = SchemaProperty( propertyType = PropertyType.RLM_PROPERTY_TYPE_LINKING_OBJECTS, declaration = declaration, + type = propertyType, collectionType = CollectionType.LIST, coreGenericTypes = listOf( CoreType( @@ -692,11 +719,13 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { val schemaProperty = SchemaProperty( propertyType = PropertyType.RLM_PROPERTY_TYPE_TIMESTAMP, declaration = declaration, + type = propertyType, collectionType = CollectionType.NONE ) fields[name] = schemaProperty modifyAccessor( property = schemaProperty, + type = propertyType, getFunction = getInstant, fromRealmValue = null, toPublic = typeAdapterMethodReferences?.toPublic, @@ -710,11 +739,13 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { val schemaProperty = SchemaProperty( propertyType = PropertyType.RLM_PROPERTY_TYPE_OBJECT_ID, declaration = declaration, + type = propertyType, collectionType = CollectionType.NONE ) fields[name] = schemaProperty modifyAccessor( property = schemaProperty, + type = propertyType, getFunction = getObjectId, fromRealmValue = null, toPublic = typeAdapterMethodReferences?.toPublic, @@ -728,11 +759,13 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { var schemaProperty = SchemaProperty( propertyType = PropertyType.RLM_PROPERTY_TYPE_OBJECT_ID, declaration = declaration, + type = propertyType, collectionType = CollectionType.NONE ) fields[name] = schemaProperty modifyAccessor( property = schemaProperty, + type = propertyType, getFunction = getObjectId, fromRealmValue = objectIdToRealmObjectId, toPublic = typeAdapterMethodReferences?.toPublic, @@ -746,11 +779,13 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { val schemaProperty = SchemaProperty( propertyType = PropertyType.RLM_PROPERTY_TYPE_UUID, declaration = declaration, + type = propertyType, collectionType = CollectionType.NONE ) fields[name] = schemaProperty modifyAccessor( property = schemaProperty, + type = propertyType, getFunction = getUUID, fromRealmValue = null, toPublic = typeAdapterMethodReferences?.toPublic, @@ -761,26 +796,28 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { } propertyType.isRealmList() -> { logDebug("RealmList property named ${declaration.name} is ${if (nullable) "" else "not "}nullable") - processCollectionField(CollectionType.LIST, fields, name, declaration, typeAdapterMethodReferences) + processCollectionField(CollectionType.LIST, fields, name, declaration, propertyType, typeAdapterMethodReferences) } propertyType.isRealmSet() -> { logDebug("RealmSet property named ${declaration.name} is ${if (nullable) "" else "not "}nullable") - processCollectionField(CollectionType.SET, fields, name, declaration, typeAdapterMethodReferences) + processCollectionField(CollectionType.SET, fields, name, declaration, propertyType, typeAdapterMethodReferences) } propertyType.isRealmDictionary() -> { logDebug("RealmDictionary property named ${declaration.name} is ${if (nullable) "" else "not "}nullable") - processCollectionField(CollectionType.DICTIONARY, fields, name, declaration, typeAdapterMethodReferences) + processCollectionField(CollectionType.DICTIONARY, fields, name, declaration, propertyType, typeAdapterMethodReferences) } propertyType.isSubtypeOfClass(embeddedRealmObjectInterface) -> { logDebug("Object property named ${declaration.name} is embedded and ${if (nullable) "" else "not "}nullable") val schemaProperty = SchemaProperty( propertyType = PropertyType.RLM_PROPERTY_TYPE_OBJECT, declaration = declaration, + type = propertyType, collectionType = CollectionType.NONE ) fields[name] = schemaProperty modifyAccessor( - schemaProperty, + property = schemaProperty, + type = propertyType, getFunction = getObject, fromRealmValue = null, toPublic = typeAdapterMethodReferences?.toPublic, @@ -798,6 +835,7 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { val schemaProperty = SchemaProperty( propertyType = PropertyType.RLM_PROPERTY_TYPE_OBJECT, declaration = declaration, + type = propertyType, collectionType = CollectionType.NONE ) fields[name] = schemaProperty @@ -807,6 +845,7 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { val schemaProperty = SchemaProperty( propertyType = PropertyType.RLM_PROPERTY_TYPE_OBJECT, declaration = declaration, + type = propertyType, collectionType = CollectionType.NONE ) fields[name] = schemaProperty @@ -814,6 +853,7 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { // conversion so bypass any converters in accessors modifyAccessor( property = schemaProperty, + type = propertyType, getFunction = getObject, fromRealmValue = null, toPublic = typeAdapterMethodReferences?.toPublic, @@ -837,6 +877,7 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { fields: MutableMap, name: String, declaration: IrProperty, + propertyType: IrType, typeAdapterMethodReferences: TypeAdapterMethodReferences?, ) { val type: KotlinType = @@ -862,6 +903,7 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { val schemaProperty = SchemaProperty( propertyType = genericPropertyType, declaration = declaration, + type = propertyType, collectionType = collectionType, coreGenericTypes = listOf(coreGenericTypes) ) @@ -881,6 +923,7 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { // getCollection/setCollection gets/sets raw collections so it bypasses any converters in accessors modifyAccessor( property = schemaProperty, + type = propertyType, getFunction = when (collectionType) { CollectionType.LIST -> getList CollectionType.SET -> getSet @@ -906,6 +949,7 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { @Suppress("LongParameterList", "LongMethod", "ComplexMethod") private fun modifyAccessor( property: SchemaProperty, + type: IrType, getFunction: IrSimpleFunction, fromRealmValue: IrSimpleFunction? = null, toPublic: (IrBuilderWithScope.(IrGetValue, IrFunctionAccessExpression)->IrDeclarationReference)? = null, @@ -914,12 +958,13 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { toRealmValue: IrSimpleFunction? = null, collectionType: CollectionType = CollectionType.NONE ) { + // TODO check this backing field if required val backingField = property.declaration.backingField!! val type: IrType? = when (collectionType) { - CollectionType.NONE -> backingField.type + CollectionType.NONE -> type CollectionType.LIST, CollectionType.SET, - CollectionType.DICTIONARY -> getCollectionElementType(backingField.type) + CollectionType.DICTIONARY -> getCollectionElementType(type) } val getter = property.declaration.getter val setter = property.declaration.setter diff --git a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/IrUtils.kt b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/IrUtils.kt index 3eb1ae88de..9f9dc3a9ad 100644 --- a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/IrUtils.kt +++ b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/IrUtils.kt @@ -410,6 +410,7 @@ private const val NO_ALIAS = "" data class SchemaProperty( val propertyType: PropertyType, val declaration: IrProperty, + val type: IrType, val collectionType: CollectionType = CollectionType.NONE, val coreGenericTypes: List? = null, ) { diff --git a/packages/test-base/src/commonMain/kotlin/io/realm/kotlin/entities/adapters/AllTypes.kt b/packages/test-base/src/commonMain/kotlin/io/realm/kotlin/entities/adapters/AllTypes.kt index 308df35156..867e7fce10 100644 --- a/packages/test-base/src/commonMain/kotlin/io/realm/kotlin/entities/adapters/AllTypes.kt +++ b/packages/test-base/src/commonMain/kotlin/io/realm/kotlin/entities/adapters/AllTypes.kt @@ -80,7 +80,8 @@ class AllTypes : RealmObject { @TypeAdapter(RealmAnyAdapter::class) var nullableRealmAnyField: RealmAny? = null -// var nullableObject: Sample? = null + @TypeAdapter(AllTypesObjectAdapter::class) + var nullableObject: AllTypes? = null // // var stringListField: RealmList = realmListOf() // var byteListField: RealmList = realmListOf() @@ -236,6 +237,7 @@ class AllTypes : RealmObject { if (!nullableBinaryField.contentEquals(other.nullableBinaryField)) return false } else if (other.nullableBinaryField != null) return false if (nullableRealmAnyField != other.nullableRealmAnyField) return false + if (nullableObject != other.nullableObject) return false return true } @@ -262,9 +264,9 @@ class AllTypes : RealmObject { result = 31 * result + (nullableUuidField?.hashCode() ?: 0) result = 31 * result + (nullableBinaryField?.contentHashCode() ?: 0) result = 31 * result + (nullableRealmAnyField?.hashCode() ?: 0) + result = 31 * result + (nullableObject?.hashCode() ?: 0) return result } - } // Passthrough converters @@ -395,6 +397,12 @@ object RealmAnyAdapter : RealmTypeAdapter { override fun toRealm(value: RealmAny?): RealmAny? = value?.let { value.clone() } } +object AllTypesObjectAdapter : RealmTypeAdapter { + override fun fromRealm(realmValue: AllTypes?): AllTypes? = realmValue?.let { AllTypes() } + + override fun toRealm(value: AllTypes?): AllTypes? = value?.let { AllTypes() } +} + internal fun RealmAny.clone() = when(type) { RealmAny.Type.INT -> RealmAny.create(asInt()) RealmAny.Type.BOOL -> RealmAny.create(asBoolean()) diff --git a/packages/test-base/src/jvmTest/kotlin/io/realm/kotlin/test/compiler/TypeAdaptersTests.kt b/packages/test-base/src/jvmTest/kotlin/io/realm/kotlin/test/compiler/TypeAdaptersTests.kt index 4a1a627f37..61b21e86ab 100644 --- a/packages/test-base/src/jvmTest/kotlin/io/realm/kotlin/test/compiler/TypeAdaptersTests.kt +++ b/packages/test-base/src/jvmTest/kotlin/io/realm/kotlin/test/compiler/TypeAdaptersTests.kt @@ -138,26 +138,32 @@ class TypeAdaptersTests { BsonObjectId::class to "BsonObjectId()", RealmUUID::class to "RealmUUID.random()", ByteArray::class to "byteArrayOf(42)", - MutableRealmInt::class to "MutableRealmInt.create(42)" + MutableRealmInt::class to "MutableRealmInt.create(42)", + RealmObject::class to "TestObject2()" ) allFieldTypes .filterNot { type -> // TODO tidy list unsupported types in TypeDescriptor - type.elementType.classifier == RealmObject::class || type.elementType.classifier == Byte::class || type.elementType.classifier == Char::class || type.elementType.classifier == Short::class || type.elementType.classifier == Int::class || type.elementType.classifier == MutableRealmInt::class } + .filter { + it.collectionType == CollectionType.RLM_COLLECTION_TYPE_NONE + } .forEach { type -> val elementType = type.elementType val default = if (!elementType.nullable) defaults[elementType.classifier] ?: error("unmapped default") else null - val kotlinLiteral = type.toKotlinLiteral() - + val kotlinLiteral = if(type.elementType.classifier == RealmObject::class) { + type.toKotlinLiteral().replace("RealmObject", "TestObject2") + } else { + type.toKotlinLiteral() + } println(kotlinLiteral) val result = compileFromSource( @@ -183,6 +189,10 @@ class TypeAdaptersTests { class NonRealmType + class TestObject2: RealmObject { + var name: String = "" + } + class TestObject : RealmObject { @TypeAdapter(adapter = ValidRealmTypeAdapter::class) var userType: UserType = UserType() From 37bfd024167354ec33ef28f9bd910654031960af Mon Sep 17 00:00:00 2001 From: Clemente Date: Mon, 11 Dec 2023 16:47:15 +0100 Subject: [PATCH 11/32] Add collections support --- .../kotlin/internal/RealmObjectCompanion.kt | 1 + .../kotlin/internal/RealmObjectHelper.kt | 127 +++++++++--------- .../internal/schema/CachedClassKeyMap.kt | 9 +- .../compiler/AccessorModifierIrGeneration.kt | 67 +++++---- .../io/realm/kotlin/compiler/Identifiers.kt | 3 + .../io/realm/kotlin/compiler/IrUtils.kt | 5 +- ...RealmModelSyntheticPropertiesGeneration.kt | 108 +++++++++++---- .../kotlin/entities/adapters/AllTypes.kt | 42 +++++- .../kotlin/test/common/TypeAdapterTests.kt | 5 +- .../kotlin/test/compiler/TypeAdaptersTests.kt | 5 +- 10 files changed, 233 insertions(+), 139 deletions(-) diff --git a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmObjectCompanion.kt b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmObjectCompanion.kt index 7f345fdcac..859d388cbf 100644 --- a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmObjectCompanion.kt +++ b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmObjectCompanion.kt @@ -33,6 +33,7 @@ public interface RealmObjectCompanion { public val `io_realm_kotlin_fields`: Map> public val `io_realm_kotlin_primaryKey`: KMutableProperty1<*, *>? public val `io_realm_kotlin_classKind`: RealmClassKind + public val `io_realm_kotlin_useCustomType`: Set public fun `io_realm_kotlin_schema`(): RealmClassImpl public fun `io_realm_kotlin_newInstance`(): Any } diff --git a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmObjectHelper.kt b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmObjectHelper.kt index 8351ee4be2..519d7df9dc 100644 --- a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmObjectHelper.kt +++ b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmObjectHelper.kt @@ -760,70 +760,77 @@ internal object RealmObjectHelper { return@forEach // Property is only visible on disk, ignore. } accessor as KMutableProperty1 - when (property.collectionType) { - CollectionType.RLM_COLLECTION_TYPE_NONE -> when (property.type) { - PropertyType.RLM_PROPERTY_TYPE_OBJECT -> { - val isTargetEmbedded = - target.realmObjectReference!!.owner.schemaMetadata.getOrThrow(property.linkTarget).isEmbeddedRealmObject - if (isTargetEmbedded) { - val value = accessor.get(source) as EmbeddedRealmObject? - setEmbeddedRealmObjectByKey( - target.realmObjectReference!!, - property.key, - value, - updatePolicy, - cache - ) - } else { - val value = accessor.get(source) as RealmObject? - setObjectByKey( - target.realmObjectReference!!, - property.key, - value, - updatePolicy, - cache - ) + + if(property.usesCustomType) { + // Passthrough values when a property uses a custom type adapter, values will be converted automatically. + val getterValue = accessor.get(source) + accessor.set(target, getterValue) + } else { + when (property.collectionType) { + CollectionType.RLM_COLLECTION_TYPE_NONE -> when (property.type) { + PropertyType.RLM_PROPERTY_TYPE_OBJECT -> { + val isTargetEmbedded = + target.realmObjectReference!!.owner.schemaMetadata.getOrThrow(property.linkTarget).isEmbeddedRealmObject + if (isTargetEmbedded) { + val value = accessor.get(source) as EmbeddedRealmObject? + setEmbeddedRealmObjectByKey( + target.realmObjectReference!!, + property.key, + value, + updatePolicy, + cache + ) + } else { + val value = accessor.get(source) as RealmObject? + setObjectByKey( + target.realmObjectReference!!, + property.key, + value, + updatePolicy, + cache + ) + } + } + else -> { + val getterValue = accessor.get(source) + accessor.set(target, getterValue) } } - else -> { - val getterValue = accessor.get(source) - accessor.set(target, getterValue) + CollectionType.RLM_COLLECTION_TYPE_LIST -> { + // We cannot use setList as that requires the type, so we need to retrieve the + // existing list, wipe it and insert new elements + @Suppress("UNCHECKED_CAST") + (accessor.get(target) as ManagedRealmList) + .run { + clear() + val elements = accessor.get(source) as RealmList<*> + operator.insertAll(size, elements, updatePolicy, cache) + } } + CollectionType.RLM_COLLECTION_TYPE_SET -> { + // We cannot use setSet as that requires the type, so we need to retrieve the + // existing set, wipe it and insert new elements + @Suppress("UNCHECKED_CAST") + (accessor.get(target) as ManagedRealmSet) + .run { + clear() + val elements = accessor.get(source) as RealmSet<*> + operator.addAll(elements, updatePolicy, cache) + } + } + CollectionType.RLM_COLLECTION_TYPE_DICTIONARY -> { + // We cannot use setDictionary as that requires the type, so we need to retrieve + // the existing dictionary, wipe it and insert new elements + @Suppress("UNCHECKED_CAST") + (accessor.get(target) as ManagedRealmDictionary) + .run { + clear() + val elements = accessor.get(source) as RealmDictionary<*> + operator.putAll(elements, updatePolicy, cache) + } + } + else -> TODO("Collection type ${property.collectionType} is not supported") } - CollectionType.RLM_COLLECTION_TYPE_LIST -> { - // We cannot use setList as that requires the type, so we need to retrieve the - // existing list, wipe it and insert new elements - @Suppress("UNCHECKED_CAST") - (accessor.get(target) as ManagedRealmList) - .run { - clear() - val elements = accessor.get(source) as RealmList<*> - operator.insertAll(size, elements, updatePolicy, cache) - } - } - CollectionType.RLM_COLLECTION_TYPE_SET -> { - // We cannot use setSet as that requires the type, so we need to retrieve the - // existing set, wipe it and insert new elements - @Suppress("UNCHECKED_CAST") - (accessor.get(target) as ManagedRealmSet) - .run { - clear() - val elements = accessor.get(source) as RealmSet<*> - operator.addAll(elements, updatePolicy, cache) - } - } - CollectionType.RLM_COLLECTION_TYPE_DICTIONARY -> { - // We cannot use setDictionary as that requires the type, so we need to retrieve - // the existing dictionary, wipe it and insert new elements - @Suppress("UNCHECKED_CAST") - (accessor.get(target) as ManagedRealmDictionary) - .run { - clear() - val elements = accessor.get(source) as RealmDictionary<*> - operator.putAll(elements, updatePolicy, cache) - } - } - else -> TODO("Collection type ${property.collectionType} is not supported") } } } diff --git a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/schema/CachedClassKeyMap.kt b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/schema/CachedClassKeyMap.kt index 7da918259f..17dd0cb8ce 100644 --- a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/schema/CachedClassKeyMap.kt +++ b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/schema/CachedClassKeyMap.kt @@ -75,6 +75,7 @@ public interface PropertyMetadata { public val linkTarget: String public val linkOriginPropertyName: String public val isComputed: Boolean + public val usesCustomType: Boolean /** * Returns `true` if this property has been defined by the user, `false` is returned * if this property is only found in the on-disk schema. @@ -146,8 +147,9 @@ public class CachedClassMetadata( ).let { interopProperties -> properties = interopProperties.map { propertyInfo: PropertyInfo -> CachedPropertyMetadata( - propertyInfo, - companion?.io_realm_kotlin_fields?.get(propertyInfo.name) + propertyInfo = propertyInfo, + accessor = companion?.io_realm_kotlin_fields?.get(propertyInfo.name), + usesCustomType = companion?.io_realm_kotlin_useCustomType?.contains(propertyInfo.name) ?: false, ) } } @@ -168,7 +170,8 @@ public class CachedClassMetadata( public class CachedPropertyMetadata( propertyInfo: PropertyInfo, - override val accessor: KProperty1? = null + override val accessor: KProperty1? = null, + override val usesCustomType: Boolean, ) : PropertyMetadata { override val name: String = propertyInfo.name override val publicName: String = propertyInfo.publicName diff --git a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/AccessorModifierIrGeneration.kt b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/AccessorModifierIrGeneration.kt index 7d32340d16..b54c43d1f2 100644 --- a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/AccessorModifierIrGeneration.kt +++ b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/AccessorModifierIrGeneration.kt @@ -93,7 +93,6 @@ import org.jetbrains.kotlin.ir.interpreter.getAnnotation import org.jetbrains.kotlin.ir.types.IrSimpleType import org.jetbrains.kotlin.ir.types.IrType import org.jetbrains.kotlin.ir.types.IrTypeArgument -import org.jetbrains.kotlin.ir.types.classFqName import org.jetbrains.kotlin.ir.types.getClass import org.jetbrains.kotlin.ir.types.impl.IrAbstractSimpleType import org.jetbrains.kotlin.ir.types.impl.originalKotlinType @@ -111,7 +110,6 @@ import org.jetbrains.kotlin.ir.types.isString import org.jetbrains.kotlin.ir.types.isSubtypeOfClass import org.jetbrains.kotlin.ir.types.makeNotNull import org.jetbrains.kotlin.ir.types.superTypes -import org.jetbrains.kotlin.ir.types.toKotlinType import org.jetbrains.kotlin.ir.types.typeOrNull import org.jetbrains.kotlin.ir.util.classId import org.jetbrains.kotlin.ir.util.defaultType @@ -272,7 +270,7 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { return declaration } - val propertyTypeRaw = declaration.backingField!!.type + var propertyTypeRaw = declaration.backingField!!.type var propertyType = propertyTypeRaw.makeNotNull() var nullable = propertyTypeRaw.isNullable() val excludeProperty = @@ -315,14 +313,15 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { } // Replace the property type with the one from the type adapter - realmType.typeOrNull.let { - if(it != null) { - propertyType = it.makeNotNull() + realmType.typeOrNull.let { actualType -> + if(actualType != null) { + propertyTypeRaw = actualType + propertyType = actualType.makeNotNull() if(propertyType.isChar() || propertyType.isByte() || propertyType.isShort() || propertyType.isInt() || propertyType.isMutableRealmInteger()) { // TODO improve messaging logError("Unsupported Realm storage type. Use `Long` instead", declaration.locationOf()) } - nullable = it.isNullable() + nullable = actualType.isNullable() } else { logError("Could not retrieve the storage type.") } @@ -389,7 +388,7 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { val schemaProperty = SchemaProperty( propertyType = PropertyType.RLM_PROPERTY_TYPE_INT, declaration = declaration, - type = propertyType, + computedType = propertyTypeRaw, collectionType = CollectionType.NONE ) fields[name] = schemaProperty @@ -420,7 +419,7 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { } val schemaProperty = SchemaProperty( propertyType = PropertyType.RLM_PROPERTY_TYPE_MIXED, - type = propertyType, + computedType = propertyTypeRaw, declaration = declaration, collectionType = CollectionType.NONE ) @@ -442,7 +441,7 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { val schemaProperty = SchemaProperty( propertyType = PropertyType.RLM_PROPERTY_TYPE_BINARY, declaration = declaration, - type = propertyType, + computedType = propertyTypeRaw, collectionType = CollectionType.NONE ) fields[name] = schemaProperty @@ -462,7 +461,7 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { val schemaProperty = SchemaProperty( propertyType = PropertyType.RLM_PROPERTY_TYPE_STRING, declaration = declaration, - type = propertyType, + computedType = propertyTypeRaw, collectionType = CollectionType.NONE ) fields[name] = schemaProperty @@ -482,7 +481,7 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { val schemaProperty = SchemaProperty( propertyType = PropertyType.RLM_PROPERTY_TYPE_INT, declaration = declaration, - type = propertyType, + computedType = propertyTypeRaw, collectionType = CollectionType.NONE ) fields[name] = schemaProperty @@ -506,7 +505,7 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { val schemaProperty = SchemaProperty( propertyType = PropertyType.RLM_PROPERTY_TYPE_INT, declaration = declaration, - type = propertyType, + computedType = propertyTypeRaw, collectionType = CollectionType.NONE ) fields[name] = schemaProperty @@ -530,7 +529,7 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { val schemaProperty = SchemaProperty( propertyType = PropertyType.RLM_PROPERTY_TYPE_INT, declaration = declaration, - type = propertyType, + computedType = propertyTypeRaw, collectionType = CollectionType.NONE ) fields[name] = schemaProperty @@ -554,7 +553,7 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { val schemaProperty = SchemaProperty( propertyType = PropertyType.RLM_PROPERTY_TYPE_INT, declaration = declaration, - type = propertyType, + computedType = propertyTypeRaw, collectionType = CollectionType.NONE ) fields[name] = schemaProperty @@ -578,7 +577,7 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { val schemaProperty = SchemaProperty( propertyType = PropertyType.RLM_PROPERTY_TYPE_INT, declaration = declaration, - type = propertyType, + computedType = propertyTypeRaw, collectionType = CollectionType.NONE ) fields[name] = schemaProperty @@ -598,7 +597,7 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { val schemaProperty = SchemaProperty( propertyType = PropertyType.RLM_PROPERTY_TYPE_BOOL, declaration = declaration, - type = propertyType, + computedType = propertyTypeRaw, collectionType = CollectionType.NONE ) fields[name] = schemaProperty @@ -618,7 +617,7 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { val schemaProperty = SchemaProperty( propertyType = PropertyType.RLM_PROPERTY_TYPE_FLOAT, declaration = declaration, - type = propertyType, + computedType = propertyTypeRaw, collectionType = CollectionType.NONE ) fields[name] = schemaProperty @@ -638,7 +637,7 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { val schemaProperty = SchemaProperty( propertyType = PropertyType.RLM_PROPERTY_TYPE_DOUBLE, declaration = declaration, - type = propertyType, + computedType = propertyTypeRaw, collectionType = CollectionType.NONE ) fields[name] = schemaProperty @@ -658,7 +657,7 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { val schemaProperty = SchemaProperty( propertyType = PropertyType.RLM_PROPERTY_TYPE_DECIMAL128, declaration = declaration, - type = propertyType, + computedType = propertyTypeRaw, collectionType = CollectionType.NONE ) fields[name] = schemaProperty @@ -703,7 +702,7 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { fields[name] = SchemaProperty( propertyType = PropertyType.RLM_PROPERTY_TYPE_LINKING_OBJECTS, declaration = declaration, - type = propertyType, + computedType = propertyTypeRaw, collectionType = CollectionType.LIST, coreGenericTypes = listOf( CoreType( @@ -719,7 +718,7 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { val schemaProperty = SchemaProperty( propertyType = PropertyType.RLM_PROPERTY_TYPE_TIMESTAMP, declaration = declaration, - type = propertyType, + computedType = propertyTypeRaw, collectionType = CollectionType.NONE ) fields[name] = schemaProperty @@ -739,7 +738,7 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { val schemaProperty = SchemaProperty( propertyType = PropertyType.RLM_PROPERTY_TYPE_OBJECT_ID, declaration = declaration, - type = propertyType, + computedType = propertyTypeRaw, collectionType = CollectionType.NONE ) fields[name] = schemaProperty @@ -759,7 +758,7 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { var schemaProperty = SchemaProperty( propertyType = PropertyType.RLM_PROPERTY_TYPE_OBJECT_ID, declaration = declaration, - type = propertyType, + computedType = propertyTypeRaw, collectionType = CollectionType.NONE ) fields[name] = schemaProperty @@ -779,7 +778,7 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { val schemaProperty = SchemaProperty( propertyType = PropertyType.RLM_PROPERTY_TYPE_UUID, declaration = declaration, - type = propertyType, + computedType = propertyTypeRaw, collectionType = CollectionType.NONE ) fields[name] = schemaProperty @@ -796,22 +795,22 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { } propertyType.isRealmList() -> { logDebug("RealmList property named ${declaration.name} is ${if (nullable) "" else "not "}nullable") - processCollectionField(CollectionType.LIST, fields, name, declaration, propertyType, typeAdapterMethodReferences) + processCollectionField(CollectionType.LIST, fields, name, declaration, propertyTypeRaw, typeAdapterMethodReferences) } propertyType.isRealmSet() -> { logDebug("RealmSet property named ${declaration.name} is ${if (nullable) "" else "not "}nullable") - processCollectionField(CollectionType.SET, fields, name, declaration, propertyType, typeAdapterMethodReferences) + processCollectionField(CollectionType.SET, fields, name, declaration, propertyTypeRaw, typeAdapterMethodReferences) } propertyType.isRealmDictionary() -> { logDebug("RealmDictionary property named ${declaration.name} is ${if (nullable) "" else "not "}nullable") - processCollectionField(CollectionType.DICTIONARY, fields, name, declaration, propertyType, typeAdapterMethodReferences) + processCollectionField(CollectionType.DICTIONARY, fields, name, declaration, propertyTypeRaw, typeAdapterMethodReferences) } propertyType.isSubtypeOfClass(embeddedRealmObjectInterface) -> { logDebug("Object property named ${declaration.name} is embedded and ${if (nullable) "" else "not "}nullable") val schemaProperty = SchemaProperty( propertyType = PropertyType.RLM_PROPERTY_TYPE_OBJECT, declaration = declaration, - type = propertyType, + computedType = propertyTypeRaw, collectionType = CollectionType.NONE ) fields[name] = schemaProperty @@ -835,7 +834,7 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { val schemaProperty = SchemaProperty( propertyType = PropertyType.RLM_PROPERTY_TYPE_OBJECT, declaration = declaration, - type = propertyType, + computedType = propertyTypeRaw, collectionType = CollectionType.NONE ) fields[name] = schemaProperty @@ -845,7 +844,7 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { val schemaProperty = SchemaProperty( propertyType = PropertyType.RLM_PROPERTY_TYPE_OBJECT, declaration = declaration, - type = propertyType, + computedType = propertyTypeRaw, collectionType = CollectionType.NONE ) fields[name] = schemaProperty @@ -877,7 +876,7 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { fields: MutableMap, name: String, declaration: IrProperty, - propertyType: IrType, + propertyTypeRaw: IrType, typeAdapterMethodReferences: TypeAdapterMethodReferences?, ) { val type: KotlinType = @@ -903,7 +902,7 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { val schemaProperty = SchemaProperty( propertyType = genericPropertyType, declaration = declaration, - type = propertyType, + computedType = propertyTypeRaw, collectionType = collectionType, coreGenericTypes = listOf(coreGenericTypes) ) @@ -923,7 +922,7 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { // getCollection/setCollection gets/sets raw collections so it bypasses any converters in accessors modifyAccessor( property = schemaProperty, - type = propertyType, + type = propertyTypeRaw, getFunction = when (collectionType) { CollectionType.LIST -> getList CollectionType.SET -> getSet diff --git a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/Identifiers.kt b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/Identifiers.kt index e4df3d9104..54a2ea2748 100644 --- a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/Identifiers.kt +++ b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/Identifiers.kt @@ -36,6 +36,8 @@ internal object Names { Name.identifier("${REALM_SYNTHETIC_PROPERTY_PREFIX}className") val REALM_OBJECT_COMPANION_FIELDS_MEMBER: Name = Name.identifier("${REALM_SYNTHETIC_PROPERTY_PREFIX}fields") + val REALM_OBJECT_COMPANION_USE_CUSTOM_TYPE_MEMBER: Name = + Name.identifier("${REALM_SYNTHETIC_PROPERTY_PREFIX}useCustomType") val REALM_OBJECT_COMPANION_PRIMARY_KEY_MEMBER: Name = Name.identifier("${REALM_SYNTHETIC_PROPERTY_PREFIX}primaryKey") val REALM_OBJECT_COMPANION_CLASS_KIND: Name = @@ -129,6 +131,7 @@ object ClassIds { // External visible interface of Realm objects val KOTLIN_COLLECTIONS_SET = ClassId(FqNames.PACKAGE_KOTLIN_COLLECTIONS, Name.identifier("Set")) + val KOTLIN_COLLECTIONS_SETOF = CallableId(FqNames.PACKAGE_KOTLIN_COLLECTIONS, Name.identifier("setOf")) val KOTLIN_COLLECTIONS_LIST = ClassId(FqNames.PACKAGE_KOTLIN_COLLECTIONS, Name.identifier("List")) val KOTLIN_COLLECTIONS_LISTOF = CallableId(FqNames.PACKAGE_KOTLIN_COLLECTIONS, Name.identifier("listOf")) val KOTLIN_COLLECTIONS_MAP = ClassId(FqNames.PACKAGE_KOTLIN_COLLECTIONS, Name.identifier("Map")) diff --git a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/IrUtils.kt b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/IrUtils.kt index 9f9dc3a9ad..1a9f907863 100644 --- a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/IrUtils.kt +++ b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/IrUtils.kt @@ -26,7 +26,6 @@ import io.realm.kotlin.compiler.FqNames.PACKAGE_TYPES import io.realm.kotlin.compiler.Names.ASYMMETRIC_REALM_OBJECT import io.realm.kotlin.compiler.Names.EMBEDDED_REALM_OBJECT import io.realm.kotlin.compiler.Names.REALM_OBJECT -import io.realm.kotlin.compiler.ClassIds.TYPE_ADAPTER_ANNOTATION import org.jetbrains.kotlin.backend.common.extensions.IrPluginContext import org.jetbrains.kotlin.backend.common.lower.DeclarationIrBuilder import org.jetbrains.kotlin.cli.common.messages.CompilerMessageLocationWithRange @@ -88,7 +87,6 @@ import org.jetbrains.kotlin.ir.expressions.impl.IrVarargImpl import org.jetbrains.kotlin.ir.expressions.impl.IrWhenImpl import org.jetbrains.kotlin.ir.interpreter.getAnnotation import org.jetbrains.kotlin.ir.symbols.IrClassSymbol -import org.jetbrains.kotlin.ir.symbols.IrClassifierSymbol import org.jetbrains.kotlin.ir.symbols.IrConstructorSymbol import org.jetbrains.kotlin.ir.symbols.IrSimpleFunctionSymbol import org.jetbrains.kotlin.ir.symbols.IrSymbol @@ -123,7 +121,6 @@ import org.jetbrains.kotlin.resolve.DescriptorUtils import org.jetbrains.kotlin.types.KotlinType import java.lang.reflect.Field import java.util.function.Predicate -import kotlin.reflect.KClass // Somehow addSetter was removed from the IrProperty in https://github.com/JetBrains/kotlin/commit/d1dc938a5d7331ba43fcbb8ce53c3e17ef76a22a#diff-2726c3747ace0a1c93ad82365cf3ff18L114 // Remove this extension when this will be re-introduced? see https://kotlinlang.slack.com/archives/C7L3JB43G/p1600888883006300 @@ -410,7 +407,7 @@ private const val NO_ALIAS = "" data class SchemaProperty( val propertyType: PropertyType, val declaration: IrProperty, - val type: IrType, + val computedType: IrType, val collectionType: CollectionType = CollectionType.NONE, val coreGenericTypes: List? = null, ) { diff --git a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/RealmModelSyntheticPropertiesGeneration.kt b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/RealmModelSyntheticPropertiesGeneration.kt index db43326fcf..635003463b 100644 --- a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/RealmModelSyntheticPropertiesGeneration.kt +++ b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/RealmModelSyntheticPropertiesGeneration.kt @@ -24,6 +24,7 @@ import io.realm.kotlin.compiler.ClassIds.INDEX_ANNOTATION import io.realm.kotlin.compiler.ClassIds.KBSON_OBJECT_ID import io.realm.kotlin.compiler.ClassIds.KOTLIN_COLLECTIONS_MAP import io.realm.kotlin.compiler.ClassIds.KOTLIN_COLLECTIONS_MAPOF +import io.realm.kotlin.compiler.ClassIds.KOTLIN_COLLECTIONS_SET import io.realm.kotlin.compiler.ClassIds.KOTLIN_PAIR import io.realm.kotlin.compiler.ClassIds.OBJECT_REFERENCE_CLASS import io.realm.kotlin.compiler.ClassIds.PRIMARY_KEY_ANNOTATION @@ -49,6 +50,7 @@ import io.realm.kotlin.compiler.Names.PROPERTY_TYPE_OBJECT import io.realm.kotlin.compiler.Names.REALM_OBJECT_COMPANION_CLASS_KIND import io.realm.kotlin.compiler.Names.REALM_OBJECT_COMPANION_CLASS_MEMBER import io.realm.kotlin.compiler.Names.REALM_OBJECT_COMPANION_CLASS_NAME_MEMBER +import io.realm.kotlin.compiler.Names.REALM_OBJECT_COMPANION_USE_CUSTOM_TYPE_MEMBER import io.realm.kotlin.compiler.Names.REALM_OBJECT_COMPANION_FIELDS_MEMBER import io.realm.kotlin.compiler.Names.REALM_OBJECT_COMPANION_NEW_INSTANCE_METHOD import io.realm.kotlin.compiler.Names.REALM_OBJECT_COMPANION_PRIMARY_KEY_MEMBER @@ -106,7 +108,6 @@ import org.jetbrains.kotlin.ir.util.defaultType import org.jetbrains.kotlin.ir.util.functions import org.jetbrains.kotlin.ir.util.getPropertyGetter import org.jetbrains.kotlin.ir.util.getPropertySetter -import org.jetbrains.kotlin.ir.util.hasAnnotation import org.jetbrains.kotlin.ir.util.isVararg import org.jetbrains.kotlin.ir.util.parentAsClass import org.jetbrains.kotlin.name.Name @@ -159,6 +160,7 @@ class RealmModelSyntheticPropertiesGeneration(private val pluginContext: IrPlugi pluginContext.lookupClassOrThrow(ClassIds.KOTLIN_REFLECT_KPROPERTY1) private val mapClass: IrClass = pluginContext.lookupClassOrThrow(KOTLIN_COLLECTIONS_MAP) + private val setClass: IrClass = pluginContext.lookupClassOrThrow(KOTLIN_COLLECTIONS_SET) private val pairClass: IrClass = pluginContext.lookupClassOrThrow(KOTLIN_PAIR) private val pairCtor = pluginContext.lookupConstructorInClass(KOTLIN_PAIR) private val realmObjectMutablePropertyType = kMutableProperty1Class.typeWith( @@ -174,10 +176,20 @@ class RealmModelSyntheticPropertiesGeneration(private val pluginContext: IrPlugi val parameters = it.owner.valueParameters parameters.size == 1 && parameters.first().isVararg } + private val setOf = pluginContext.referenceFunctions(ClassIds.KOTLIN_COLLECTIONS_SETOF) + .first { + val parameters = it.owner.valueParameters + parameters.size == 1 && parameters.first().isVararg + } + private val companionFieldsType = mapClass.typeWith( pluginContext.irBuiltIns.stringType, realmObjectMutablePropertyType ) + + private val companionCustomTypesType = setClass.typeWith( + pluginContext.irBuiltIns.stringType + ) @Suppress("UnusedPrivateMember") private val companionComputedFieldsType = mapClass.typeWith( pluginContext.irBuiltIns.stringType, @@ -290,6 +302,44 @@ class RealmModelSyntheticPropertiesGeneration(private val pluginContext: IrPlugi IrConstImpl.string(startOffset, endOffset, pluginContext.irBuiltIns.stringType, className) } + // Add `public val `io_realm_kotlin_useCustomType`: Set` property. + companion.addValueProperty( + pluginContext, + realmObjectCompanionInterface, + REALM_OBJECT_COMPANION_USE_CUSTOM_TYPE_MEMBER, + companionCustomTypesType, + ) { startOffset, endOffset -> + IrCallImpl( + startOffset = startOffset, endOffset = endOffset, + type = companionCustomTypesType, + symbol = setOf, + typeArgumentsCount = 1, + valueArgumentsCount = 1, + origin = null, + superQualifierSymbol = null + ).apply { + putTypeArgument(index = 0, type = pluginContext.irBuiltIns.stringType) + putValueArgument( + index = 0, + valueArgument = IrVarargImpl( + UNDEFINED_OFFSET, + UNDEFINED_OFFSET, + pluginContext.irBuiltIns.arrayClass.typeWith(pluginContext.irBuiltIns.stringType), + type, + // Generate list of properties: List>> + properties!!.entries.map { + IrConstImpl.string( + startOffset, + endOffset, + pluginContext.irBuiltIns.stringType, + it.value.persistedName + ) + }, + ) + ) + } + } + // Add `public val `io_realm_kotlin_fields`: Map>` property. companion.addValueProperty( pluginContext, @@ -500,24 +550,24 @@ class RealmModelSyntheticPropertiesGeneration(private val pluginContext: IrPlugi buildListOf( pluginContext, startOffset, endOffset, propertyClass.defaultType, fields.map { entry -> - val value = entry.value + val schemaProperty = entry.value // Extract type based on whether the field is a: // 1 - primitive type, in which case it is extracted as is // 2 - collection type, in which case the collection type(s) // specified in value.genericTypes should be used as type - val type: IrEnumEntry = when (val primitiveType = getType(value.propertyType)) { + val type: IrEnumEntry = when (val primitiveType = getType(schemaProperty.propertyType)) { null -> // Primitive type is null for collections - when (value.collectionType) { + when (schemaProperty.collectionType) { CollectionType.LIST, CollectionType.SET -> // Extract generic type as mentioned - getType(getCollectionType(value.coreGenericTypes)) - ?: error("Unknown type ${value.propertyType} - should be a valid type for collections.") + getType(getCollectionType(schemaProperty.coreGenericTypes)) + ?: error("Unknown type ${schemaProperty.propertyType} - should be a valid type for collections.") CollectionType.DICTIONARY -> error("Dictionaries not available yet.") else -> - error("Unknown type ${value.propertyType}.") + error("Unknown type ${schemaProperty.propertyType}.") } else -> // Primitive type is non-null primitiveType @@ -525,40 +575,40 @@ class RealmModelSyntheticPropertiesGeneration(private val pluginContext: IrPlugi val objectType: IrEnumEntry = propertyTypes.firstOrNull { it.name == PROPERTY_TYPE_OBJECT - } ?: error("Unknown type ${value.propertyType}") + } ?: error("Unknown type ${schemaProperty.propertyType}") val linkingObjectType: IrEnumEntry = propertyTypes.firstOrNull { it.name == PROPERTY_TYPE_LINKING_OBJECTS - } ?: error("Unknown type ${value.propertyType}") + } ?: error("Unknown type ${schemaProperty.propertyType}") - val property: IrProperty = value.declaration + val property: IrProperty = schemaProperty.declaration val backingField: IrField = property.backingField ?: fatalError("Property without backing field or type.") // Nullability applies to the generic type in collections - val nullable = if (value.collectionType == CollectionType.NONE) { - backingField.type.isNullable() + val nullable = if (schemaProperty.collectionType == CollectionType.NONE) { + schemaProperty.computedType.isNullable() } else { - value.coreGenericTypes?.get(0)?.nullable + schemaProperty.coreGenericTypes?.get(0)?.nullable ?: fatalError("Missing generic type while processing a collection field.") } val primaryKey = backingField.hasAnnotation(PRIMARY_KEY_ANNOTATION) - if (primaryKey && validPrimaryKeyTypes.find { it.classFqName == backingField.type.classFqName } == null) { + if (primaryKey && validPrimaryKeyTypes.find { it.classFqName == schemaProperty.computedType.classFqName } == null) { logError( - "Primary key ${property.name} is of type ${backingField.type.classId?.shortClassName} but must be of type ${validPrimaryKeyTypes.map { it.classId?.shortClassName }}", + "Primary key ${property.name} is of type ${schemaProperty.computedType.classId?.shortClassName} but must be of type ${validPrimaryKeyTypes.map { it.classId?.shortClassName }}", property.locationOf() ) } val isIndexed = backingField.hasAnnotation(INDEX_ANNOTATION) - if (isIndexed && indexableTypes.find { it.classFqName == backingField.type.classFqName } == null) { + if (isIndexed && indexableTypes.find { it.classFqName == schemaProperty.computedType.classFqName } == null) { logError( - "Indexed key ${property.name} is of type ${backingField.type.classId?.shortClassName} but must be of type ${indexableTypes.map { it.classId?.shortClassName }}", + "Indexed key ${property.name} is of type ${schemaProperty.computedType.classId?.shortClassName} but must be of type ${indexableTypes.map { it.classId?.shortClassName }}", property.locationOf() ) } val isFullTextIndexed = backingField.hasAnnotation(FULLTEXT_ANNOTATION) - if (isFullTextIndexed && fullTextIndexableTypes.find { it.classFqName == backingField.type.classFqName } == null) { + if (isFullTextIndexed && fullTextIndexableTypes.find { it.classFqName == schemaProperty.computedType.classFqName } == null) { logError( - "Full-text key ${property.name} is of type ${backingField.type.classId?.shortClassName} but must be of type ${fullTextIndexableTypes.map { it.classId?.shortClassName }}", + "Full-text key ${property.name} is of type ${schemaProperty.computedType.classId?.shortClassName} but must be of type ${fullTextIndexableTypes.map { it.classId?.shortClassName }}", property.locationOf() ) } @@ -578,8 +628,8 @@ class RealmModelSyntheticPropertiesGeneration(private val pluginContext: IrPlugi } val location = property.locationOf() - val persistedName = value.persistedName - val publicName = value.publicName + val persistedName = schemaProperty.persistedName + val publicName = schemaProperty.publicName // Ensure that the names are valid and do not conflict with prior persisted or public names ensureValidName(persistedName, persistedAndPublicNameToLocation, location) @@ -596,15 +646,15 @@ class RealmModelSyntheticPropertiesGeneration(private val pluginContext: IrPlugi when (type) { objectType -> { // Collections of type RealmObject require the type parameter be retrieved from the generic argument - when (value.collectionType) { + when (schemaProperty.collectionType) { CollectionType.NONE -> { - backingField.type + schemaProperty.computedType } CollectionType.LIST, CollectionType.SET, CollectionType.DICTIONARY -> { - getCollectionElementType(backingField.type) - ?: error("Could not get collection type from ${backingField.type}") + getCollectionElementType(schemaProperty.computedType) + ?: error("Could not get collection type from ${schemaProperty.computedType}") } } } @@ -632,7 +682,7 @@ class RealmModelSyntheticPropertiesGeneration(private val pluginContext: IrPlugi // Collection type: remember to specify it correctly here - the // type of the contents itself is specified as "type" above! - val collectionTypeSymbol = when (value.collectionType) { + val collectionTypeSymbol = when (schemaProperty.collectionType) { CollectionType.NONE -> PROPERTY_COLLECTION_TYPE_NONE CollectionType.LIST -> PROPERTY_COLLECTION_TYPE_LIST CollectionType.SET -> PROPERTY_COLLECTION_TYPE_SET @@ -655,12 +705,12 @@ class RealmModelSyntheticPropertiesGeneration(private val pluginContext: IrPlugi // Collections of type RealmObject require the type parameter be retrieved from the generic argument when (collectionTypeSymbol) { PROPERTY_COLLECTION_TYPE_NONE -> - backingField.type + schemaProperty.computedType PROPERTY_COLLECTION_TYPE_LIST, PROPERTY_COLLECTION_TYPE_SET, PROPERTY_COLLECTION_TYPE_DICTIONARY -> - getCollectionElementType(backingField.type) - ?: error("Could not get collection type from ${backingField.type}") + getCollectionElementType(schemaProperty.computedType) + ?: error("Could not get collection type from ${schemaProperty.computedType}") else -> error("Unsupported collection type '$collectionTypeSymbol' for field ${entry.key}") } diff --git a/packages/test-base/src/commonMain/kotlin/io/realm/kotlin/entities/adapters/AllTypes.kt b/packages/test-base/src/commonMain/kotlin/io/realm/kotlin/entities/adapters/AllTypes.kt index 867e7fce10..ed6de75148 100644 --- a/packages/test-base/src/commonMain/kotlin/io/realm/kotlin/entities/adapters/AllTypes.kt +++ b/packages/test-base/src/commonMain/kotlin/io/realm/kotlin/entities/adapters/AllTypes.kt @@ -2,10 +2,16 @@ package io.realm.kotlin.entities.adapters import io.realm.kotlin.ext.asBsonObjectId import io.realm.kotlin.ext.asRealmObject +import io.realm.kotlin.ext.realmDictionaryOf +import io.realm.kotlin.ext.realmListOf +import io.realm.kotlin.ext.realmSetOf import io.realm.kotlin.types.ObjectId import io.realm.kotlin.types.RealmAny +import io.realm.kotlin.types.RealmDictionary import io.realm.kotlin.types.RealmInstant +import io.realm.kotlin.types.RealmList import io.realm.kotlin.types.RealmObject +import io.realm.kotlin.types.RealmSet import io.realm.kotlin.types.RealmTypeAdapter import io.realm.kotlin.types.RealmUUID import io.realm.kotlin.types.annotations.TypeAdapter @@ -82,8 +88,9 @@ class AllTypes : RealmObject { @TypeAdapter(AllTypesObjectAdapter::class) var nullableObject: AllTypes? = null -// -// var stringListField: RealmList = realmListOf() + + @TypeAdapter(StringRealmListAdapter::class) + var stringListField: RealmList = realmListOf() // var byteListField: RealmList = realmListOf() // var charListField: RealmList = realmListOf() // var shortListField: RealmList = realmListOf() @@ -117,7 +124,8 @@ class AllTypes : RealmObject { // var nullableDecimal128ListField: RealmList = realmListOf() // var nullableRealmAnyListField: RealmList = realmListOf() // -// var stringSetField: RealmSet = realmSetOf() +@TypeAdapter(StringRealmSetAdapter::class) + var stringSetField: RealmSet = realmSetOf() // var byteSetField: RealmSet = realmSetOf() // var charSetField: RealmSet = realmSetOf() // var shortSetField: RealmSet = realmSetOf() @@ -151,7 +159,9 @@ class AllTypes : RealmObject { // var nullableDecimal128SetField: RealmSet = realmSetOf() // var nullableRealmAnySetField: RealmSet = realmSetOf() // -// var stringDictionaryField: RealmDictionary = realmDictionaryOf() + + @TypeAdapter(StringRealmDictionaryAdapter::class) + var stringDictionaryField: RealmDictionary = realmDictionaryOf() // var byteDictionaryField: RealmDictionary = realmDictionaryOf() // var charDictionaryField: RealmDictionary = realmDictionaryOf() // var shortDictionaryField: RealmDictionary = realmDictionaryOf() @@ -238,6 +248,9 @@ class AllTypes : RealmObject { } else if (other.nullableBinaryField != null) return false if (nullableRealmAnyField != other.nullableRealmAnyField) return false if (nullableObject != other.nullableObject) return false + if (stringListField != other.stringListField) return false + if (stringSetField != other.stringSetField) return false + if (stringDictionaryField != other.stringDictionaryField) return false return true } @@ -265,6 +278,9 @@ class AllTypes : RealmObject { result = 31 * result + (nullableBinaryField?.contentHashCode() ?: 0) result = 31 * result + (nullableRealmAnyField?.hashCode() ?: 0) result = 31 * result + (nullableObject?.hashCode() ?: 0) + result = 31 * result + stringListField.hashCode() + result = 31 * result + stringSetField.hashCode() + result = 31 * result + stringDictionaryField.hashCode() return result } } @@ -403,6 +419,24 @@ object AllTypesObjectAdapter : RealmTypeAdapter { override fun toRealm(value: AllTypes?): AllTypes? = value?.let { AllTypes() } } +object StringRealmListAdapter : RealmTypeAdapter, RealmList> { + override fun fromRealm(realmValue: RealmList): RealmList = realmListOf().apply { addAll(realmValue) } + + override fun toRealm(value: RealmList): RealmList = realmListOf().apply { addAll(value) } +} + +object StringRealmSetAdapter : RealmTypeAdapter, RealmSet> { + override fun fromRealm(realmValue: RealmSet): RealmSet = realmSetOf().apply { addAll(realmValue) } + + override fun toRealm(value: RealmSet): RealmSet = realmSetOf().apply { addAll(value) } +} + +object StringRealmDictionaryAdapter : RealmTypeAdapter, RealmDictionary> { + override fun fromRealm(realmValue: RealmDictionary): RealmDictionary = realmDictionaryOf().apply { putAll(realmValue) } + + override fun toRealm(value: RealmDictionary): RealmDictionary = realmDictionaryOf().apply { putAll(value) } +} + internal fun RealmAny.clone() = when(type) { RealmAny.Type.INT -> RealmAny.create(asInt()) RealmAny.Type.BOOL -> RealmAny.create(asBoolean()) diff --git a/packages/test-base/src/commonTest/kotlin/io/realm/kotlin/test/common/TypeAdapterTests.kt b/packages/test-base/src/commonTest/kotlin/io/realm/kotlin/test/common/TypeAdapterTests.kt index 9c047b0dd6..a789bb9037 100644 --- a/packages/test-base/src/commonTest/kotlin/io/realm/kotlin/test/common/TypeAdapterTests.kt +++ b/packages/test-base/src/commonTest/kotlin/io/realm/kotlin/test/common/TypeAdapterTests.kt @@ -22,6 +22,7 @@ import io.realm.kotlin.entities.adapters.RealmInstantBsonDateTimeAdapterInstance import io.realm.kotlin.entities.adapters.UsingInstancedAdapter //import io.realm.kotlin.entities.adapters.UsingInstancedAdapter import io.realm.kotlin.entities.adapters.UsingSingletonAdapter +import io.realm.kotlin.ext.realmListOf import io.realm.kotlin.test.platform.PlatformUtils import org.mongodb.kbson.BsonDateTime import kotlin.test.AfterTest @@ -107,7 +108,9 @@ class TypeAdapterTests { @Test fun allTypes() { - val unmanagedObject = AllTypes() + val unmanagedObject = AllTypes().apply { + this.stringListField = realmListOf("hello", "world", "www") + } val managedObject = realm.writeBlocking { copyToRealm(unmanagedObject) diff --git a/packages/test-base/src/jvmTest/kotlin/io/realm/kotlin/test/compiler/TypeAdaptersTests.kt b/packages/test-base/src/jvmTest/kotlin/io/realm/kotlin/test/compiler/TypeAdaptersTests.kt index 61b21e86ab..f511baa4cc 100644 --- a/packages/test-base/src/jvmTest/kotlin/io/realm/kotlin/test/compiler/TypeAdaptersTests.kt +++ b/packages/test-base/src/jvmTest/kotlin/io/realm/kotlin/test/compiler/TypeAdaptersTests.kt @@ -37,7 +37,7 @@ import kotlin.test.assertTrue * These tests should validate: * - [x] Adapter with a non-realm type should fail * - [x] Adapter annotation on unsupported types: delegate, function etc - * - [ ] Adapter on wrong type + * - [ ] Adapter not matching public type * - [x] Adapters type supportness * - [ ] Adapters type unsupportness * - [ ] Instanced and singleton adapters @@ -151,9 +151,6 @@ class TypeAdaptersTests { type.elementType.classifier == Int::class || type.elementType.classifier == MutableRealmInt::class } - .filter { - it.collectionType == CollectionType.RLM_COLLECTION_TYPE_NONE - } .forEach { type -> val elementType = type.elementType val default = if (!elementType.nullable) defaults[elementType.classifier] From 9c8ba57ded76cf42dc78af24df9d4242af0ab643 Mon Sep 17 00:00:00 2001 From: Clemente Date: Mon, 11 Dec 2023 23:32:42 +0100 Subject: [PATCH 12/32] Add type check for unsupported types --- .../compiler/AccessorModifierIrGeneration.kt | 80 +++++++++++++---- .../io/realm/kotlin/compiler/Identifiers.kt | 1 + .../io/realm/kotlin/compiler/IrUtils.kt | 4 + .../compiler/RealmModelLoweringExtension.kt | 20 +++++ .../realm/kotlin/test/util/TypeDescriptor.kt | 3 + .../kotlin/test/compiler/TypeAdaptersTests.kt | 87 +++++++++++++++---- 6 files changed, 165 insertions(+), 30 deletions(-) diff --git a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/AccessorModifierIrGeneration.kt b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/AccessorModifierIrGeneration.kt index b54c43d1f2..24091bccf5 100644 --- a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/AccessorModifierIrGeneration.kt +++ b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/AccessorModifierIrGeneration.kt @@ -91,10 +91,12 @@ import org.jetbrains.kotlin.ir.expressions.IrStatementOrigin import org.jetbrains.kotlin.ir.expressions.impl.IrSetFieldImpl import org.jetbrains.kotlin.ir.interpreter.getAnnotation import org.jetbrains.kotlin.ir.types.IrSimpleType +import org.jetbrains.kotlin.ir.types.IrStarProjection import org.jetbrains.kotlin.ir.types.IrType import org.jetbrains.kotlin.ir.types.IrTypeArgument import org.jetbrains.kotlin.ir.types.getClass import org.jetbrains.kotlin.ir.types.impl.IrAbstractSimpleType +import org.jetbrains.kotlin.ir.types.impl.IrSimpleTypeImpl import org.jetbrains.kotlin.ir.types.impl.originalKotlinType import org.jetbrains.kotlin.ir.types.isBoolean import org.jetbrains.kotlin.ir.types.isByte @@ -143,6 +145,10 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { private val realmEmbeddedBacklinksClass: IrClass = pluginContext.lookupClassOrThrow(REALM_EMBEDDED_BACKLINKS) private val realmObjectInterface = pluginContext.lookupClassOrThrow(REALM_OBJECT_INTERFACE).symbol private val embeddedRealmObjectInterface = pluginContext.lookupClassOrThrow(EMBEDDED_OBJECT_INTERFACE).symbol + // Attempt to find the interface for asymmetric objects. + // The class will normally only be on the classpath for library-sync builds, not + // library-base builds. + private val asymmetricRealmObjectInterface: IrClass? = pluginContext.referenceClass(ASYMMETRIC_OBJECT_INTERFACE)?.owner private val objectIdClass: IrClass = pluginContext.lookupClassOrThrow(KBSON_OBJECT_ID) private val decimal128Class: IrClass = pluginContext.lookupClassOrThrow(KBSON_DECIMAL128) @@ -248,11 +254,6 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { objectReferenceProperty = irClass.lookupProperty(OBJECT_REFERENCE) objectReferenceType = objectReferenceProperty.backingField!!.type - // Attempt to find the interface for asymmetric objects. - // The class will normally only be on the classpath for library-sync builds, not - // library-base builds. - val asymmetricRealmObjectInterface: IrClass? = pluginContext.referenceClass(ASYMMETRIC_OBJECT_INTERFACE)?.owner - irClass.transformChildrenVoid(object : IrElementTransformerVoid() { @Suppress("LongMethod") override fun visitProperty(declaration: IrProperty): IrStatement { @@ -306,7 +307,14 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { // TODO find correct super type adapter type, might be multiple ones because inheritance val (realmType: IrTypeArgument, userType) = - (adapterClassReference.symbol.superTypes().first() as IrSimpleType) + adapterClassReference.symbol + .superTypes() + .first { + it.classId == ClassIds.REALM_TYPE_ADAPTER_INTERFACE + } + .let { + it as IrSimpleType + } .arguments .let { arguments -> arguments[0] to arguments[1] @@ -317,9 +325,9 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { if(actualType != null) { propertyTypeRaw = actualType propertyType = actualType.makeNotNull() - if(propertyType.isChar() || propertyType.isByte() || propertyType.isShort() || propertyType.isInt() || propertyType.isMutableRealmInteger()) { + if(!propertyType.isPersistedPrimitiveType()) { // TODO improve messaging - logError("Unsupported Realm storage type. Use `Long` instead", declaration.locationOf()) + logError("Unsupported Realm storage type. Use a valid type` instead", declaration.locationOf()) } nullable = actualType.isNullable() } else { @@ -879,23 +887,29 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { propertyTypeRaw: IrType, typeAdapterMethodReferences: TypeAdapterMethodReferences?, ) { - val type: KotlinType = - typeAdapterMethodReferences?.propertyType?.originalKotlinType - ?: declaration.symbol.owner.toIrBasedDescriptor().type + val type: IrType = + typeAdapterMethodReferences?.propertyType + ?: declaration.backingField!!.type + + val collectionGenericType = (type as IrSimpleTypeImpl).arguments[0] - if (type.arguments[0] is StarProjectionImpl) { + if(typeAdapterMethodReferences != null && !collectionGenericType.typeOrNull!!.makeNotNull().isPersistedPrimitiveType()) { + // TODO improve messaging + logError("Unsupported Realm storage type. Use a valid type instead", declaration.locationOf()) + } + + if (collectionGenericType is IrStarProjection) { logError( "Error in field ${declaration.name} - ${collectionType.description} cannot use a '*' projection.", declaration.locationOf() ) return } - val collectionGenericType = type.arguments[0].type - val coreGenericTypes = getCollectionGenericCoreType(collectionType, declaration, type) + val coreGenericTypes = getCollectionGenericCoreType(collectionType, declaration, type.kotlinType!!) // Only process field if we got valid generics if (coreGenericTypes != null) { - val genericPropertyType = getPropertyTypeFromKotlinType(collectionGenericType) + val genericPropertyType = getPropertyTypeFromKotlinType(collectionGenericType.typeOrNull!!.toIrBasedKotlinType()) // Only process if (genericPropertyType != null) { @@ -1208,6 +1222,42 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { return propertyClassId == mutableRealmIntegerClassId } + fun IrType.isPersistedPrimitiveType(): Boolean = isRealmAny() || + isByteArray() || + isString() || +// isLinkingObject() || +// isEmbeddedLinkingObject() || +// isPersistedPrimitiveType() || +// isMutableRealmInteger() || +// isByte() || +// isChar() || +// isShort() || +// isInt() || + isLong() || + isBoolean() || + isFloat() || + isDouble() || + isDecimal128() || + // isEmbeddedLinkingObject() || + // isLinkingObject() || + isRealmList() || + isRealmSet() || + isRealmDictionary() || + isRealmInstant() || + isObjectId() || + isRealmObjectId() || + isRealmUUID() || + isRealmList() || + isRealmSet() || + isRealmDictionary() || + isSubtypeOfClass(embeddedRealmObjectInterface) || + asymmetricRealmObjectInterface?.let { + isSubtypeOfClass( + asymmetricRealmObjectInterface.symbol + ) + } ?: false || + isSubtypeOfClass(realmObjectInterface) + @Suppress("ReturnCount", "LongMethod") private fun getCollectionGenericCoreType( collectionType: CollectionType, diff --git a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/Identifiers.kt b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/Identifiers.kt index 54a2ea2748..9b26251888 100644 --- a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/Identifiers.kt +++ b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/Identifiers.kt @@ -126,6 +126,7 @@ object ClassIds { val TYPED_REALM_OBJECT_INTERFACE = ClassId(FqNames.PACKAGE_TYPES, Name.identifier("TypedRealmObject")) val EMBEDDED_OBJECT_INTERFACE = ClassId(FqNames.PACKAGE_TYPES, Name.identifier("EmbeddedRealmObject")) val ASYMMETRIC_OBJECT_INTERFACE = ClassId(FqNames.PACKAGE_TYPES, Name.identifier("AsymmetricRealmObject")) + val REALM_TYPE_ADAPTER_INTERFACE = ClassId(FqNames.PACKAGE_TYPES, Name.identifier("RealmTypeAdapter")) val CLASS_APP_CONFIGURATION = ClassId(FqNames.PACKAGE_MONGODB, Name.identifier("AppConfiguration")) diff --git a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/IrUtils.kt b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/IrUtils.kt index 1a9f907863..a5df88590a 100644 --- a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/IrUtils.kt +++ b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/IrUtils.kt @@ -22,6 +22,7 @@ import io.realm.kotlin.compiler.ClassIds.EMBEDDED_OBJECT_INTERFACE import io.realm.kotlin.compiler.ClassIds.KOTLIN_COLLECTIONS_LISTOF import io.realm.kotlin.compiler.ClassIds.PERSISTED_NAME_ANNOTATION import io.realm.kotlin.compiler.ClassIds.REALM_OBJECT_INTERFACE +import io.realm.kotlin.compiler.ClassIds.REALM_TYPE_ADAPTER_INTERFACE import io.realm.kotlin.compiler.FqNames.PACKAGE_TYPES import io.realm.kotlin.compiler.Names.ASYMMETRIC_REALM_OBJECT import io.realm.kotlin.compiler.Names.EMBEDDED_REALM_OBJECT @@ -261,6 +262,9 @@ val IrClass.isEmbeddedRealmObject: Boolean val IrClass.isAsymmetricRealmObject: Boolean get() = superTypes.any { it.classId == ASYMMETRIC_OBJECT_INTERFACE } +val IrClass.isRealmTypeAdapter: Boolean + get() = superTypes.any { it.classId == REALM_TYPE_ADAPTER_INTERFACE } + val IrType.classId: ClassId? get() = this.getClass()?.classId diff --git a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/RealmModelLoweringExtension.kt b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/RealmModelLoweringExtension.kt index 7aac109667..8748f79f1c 100644 --- a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/RealmModelLoweringExtension.kt +++ b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/RealmModelLoweringExtension.kt @@ -19,6 +19,7 @@ package io.realm.kotlin.compiler import io.realm.kotlin.compiler.ClassIds.MODEL_OBJECT_ANNOTATION import io.realm.kotlin.compiler.ClassIds.REALM_MODEL_COMPANION import io.realm.kotlin.compiler.ClassIds.REALM_OBJECT_INTERNAL_INTERFACE +import io.realm.kotlin.compiler.ClassIds.REALM_TYPE_ADAPTER_INTERFACE import org.jetbrains.kotlin.backend.common.ClassLoweringPass import org.jetbrains.kotlin.backend.common.extensions.IrGenerationExtension import org.jetbrains.kotlin.backend.common.extensions.IrPluginContext @@ -31,8 +32,11 @@ import org.jetbrains.kotlin.ir.declarations.IrModuleFragment import org.jetbrains.kotlin.ir.expressions.impl.IrClassReferenceImpl import org.jetbrains.kotlin.ir.expressions.impl.IrConstructorCallImpl import org.jetbrains.kotlin.ir.symbols.IrClassSymbol +import org.jetbrains.kotlin.ir.types.IrSimpleType import org.jetbrains.kotlin.ir.types.defaultType import org.jetbrains.kotlin.ir.types.starProjectedType +import org.jetbrains.kotlin.ir.types.superTypes +import org.jetbrains.kotlin.ir.types.typeOrNull import org.jetbrains.kotlin.ir.util.companionObject import org.jetbrains.kotlin.ir.util.defaultType import org.jetbrains.kotlin.ir.util.isAnonymousObject @@ -59,6 +63,22 @@ private class RealmModelLowering(private val pluginContext: IrPluginContext) : C override fun lower(irFile: IrFile) = runOnFilePostfix(irFile) override fun lower(irClass: IrClass) { + if (irClass.isRealmTypeAdapter) { + // Validate that the R type parameter is a valid RealmType +// irClass.symbol +// .superTypes() +// .first { +// it.classId == REALM_TYPE_ADAPTER_INTERFACE +// } +// .let { +// it as IrSimpleType +// } +// .arguments +// .let { arguments -> +// arguments[0].typeOrNull!!.isPersistedPrimitiveType() +// } + } + if (irClass.isBaseRealmObject) { // Throw error with classes that we do not support if (irClass.isData) { diff --git a/packages/test-base/src/commonMain/kotlin/io/realm/kotlin/test/util/TypeDescriptor.kt b/packages/test-base/src/commonMain/kotlin/io/realm/kotlin/test/util/TypeDescriptor.kt index 10cae98b2c..2e0bb38511 100644 --- a/packages/test-base/src/commonMain/kotlin/io/realm/kotlin/test/util/TypeDescriptor.kt +++ b/packages/test-base/src/commonMain/kotlin/io/realm/kotlin/test/util/TypeDescriptor.kt @@ -365,6 +365,9 @@ object TypeDescriptor { allSingularFieldTypes + allListFieldTypes + allSetFieldTypes + allDictionaryFieldTypes val allPrimaryKeyFieldTypes = allFieldTypes.filter { it.isPrimaryKeySupported } + val unsupportedRealmTypeAdaptersClassifiers = + setOf(Byte::class, Char::class, Short::class, Int::class, MutableRealmInt::class) + // Realm field type represents the type of a given user specified field in the RealmObject data class RealmFieldType( val collectionType: CollectionType, diff --git a/packages/test-base/src/jvmTest/kotlin/io/realm/kotlin/test/compiler/TypeAdaptersTests.kt b/packages/test-base/src/jvmTest/kotlin/io/realm/kotlin/test/compiler/TypeAdaptersTests.kt index f511baa4cc..dd1d80a0f6 100644 --- a/packages/test-base/src/jvmTest/kotlin/io/realm/kotlin/test/compiler/TypeAdaptersTests.kt +++ b/packages/test-base/src/jvmTest/kotlin/io/realm/kotlin/test/compiler/TypeAdaptersTests.kt @@ -21,6 +21,7 @@ import com.tschuchort.compiletesting.SourceFile import io.realm.kotlin.internal.interop.CollectionType import io.realm.kotlin.test.util.Compiler.compileFromSource import io.realm.kotlin.test.util.TypeDescriptor.allFieldTypes +import io.realm.kotlin.test.util.TypeDescriptor.unsupportedRealmTypeAdaptersClassifiers import io.realm.kotlin.types.MutableRealmInt import io.realm.kotlin.types.ObjectId import io.realm.kotlin.types.RealmInstant @@ -39,7 +40,7 @@ import kotlin.test.assertTrue * - [x] Adapter annotation on unsupported types: delegate, function etc * - [ ] Adapter not matching public type * - [x] Adapters type supportness - * - [ ] Adapters type unsupportness + * - [x] Adapters type unsupportness * - [ ] Instanced and singleton adapters * - [ ] Other annotations Ignore, Index etc */ @@ -124,10 +125,6 @@ class TypeAdaptersTests { fun `type adapters supportness`() { val defaults = mapOf( Boolean::class to true, - Byte::class to "1", - Char::class to "\'c\'", - Short::class to "1", - Int::class to "1", Long::class to "1", Float::class to "1.4f", Double::class to "1.4", @@ -138,18 +135,12 @@ class TypeAdaptersTests { BsonObjectId::class to "BsonObjectId()", RealmUUID::class to "RealmUUID.random()", ByteArray::class to "byteArrayOf(42)", - MutableRealmInt::class to "MutableRealmInt.create(42)", - RealmObject::class to "TestObject2()" + RealmObject::class to "TestObject2()", ) allFieldTypes .filterNot { type -> - // TODO tidy list unsupported types in TypeDescriptor - type.elementType.classifier == Byte::class || - type.elementType.classifier == Char::class || - type.elementType.classifier == Short::class || - type.elementType.classifier == Int::class || - type.elementType.classifier == MutableRealmInt::class + type.elementType.classifier in unsupportedRealmTypeAdaptersClassifiers } .forEach { type -> val elementType = type.elementType @@ -161,7 +152,6 @@ class TypeAdaptersTests { } else { type.toKotlinLiteral() } - println(kotlinLiteral) val result = compileFromSource( plugins = listOf(io.realm.kotlin.compiler.Registrar()), @@ -204,8 +194,75 @@ class TypeAdaptersTests { ) ) assertEquals(KotlinCompilation.ExitCode.OK, result.exitCode, result.messages) -// assertTrue(result.messages.contains("Invalid type parameter, only Realm types are supported"), result.messages) } + } + + @Test + fun `type adapters unsupportness`() { + val defaults = mapOf( + Byte::class to "1", + Char::class to "\'c\'", + Short::class to "1", + Int::class to "1", + MutableRealmInt::class to "MutableRealmInt.create(42)", + ) + allFieldTypes + .filter { type -> + type.elementType.classifier in unsupportedRealmTypeAdaptersClassifiers + } + .forEach { type -> + val elementType = type.elementType + val default = if (!elementType.nullable) defaults[elementType.classifier] + ?: error("unmapped default") else null + + val kotlinLiteral = if(type.elementType.classifier == RealmObject::class) { + type.toKotlinLiteral().replace("RealmObject", "TestObject2") + } else { + type.toKotlinLiteral() + } + + val result = compileFromSource( + plugins = listOf(io.realm.kotlin.compiler.Registrar()), + source = SourceFile.kotlin( + "typeadapter_supportness_$kotlinLiteral.kt", + """ + import io.realm.kotlin.types.RealmAny + import io.realm.kotlin.types.RealmDictionary + import io.realm.kotlin.types.RealmList + import io.realm.kotlin.types.RealmSet + import io.realm.kotlin.types.RealmInstant + import io.realm.kotlin.types.MutableRealmInt + import io.realm.kotlin.types.RealmObject + import io.realm.kotlin.types.RealmTypeAdapter + import io.realm.kotlin.types.RealmUUID + import io.realm.kotlin.types.annotations.TypeAdapter + import io.realm.kotlin.types.ObjectId + import org.mongodb.kbson.BsonDecimal128 + import org.mongodb.kbson.BsonObjectId + + class UserType + + class NonRealmType + + class TestObject2: RealmObject { + var name: String = "" + } + + class TestObject : RealmObject { + @TypeAdapter(adapter = ValidRealmTypeAdapter::class) + var userType: UserType = UserType() + } + + object ValidRealmTypeAdapter : RealmTypeAdapter<$kotlinLiteral, UserType> { + override fun fromRealm(realmValue: $kotlinLiteral): UserType = TODO() + + override fun toRealm(value: UserType): $kotlinLiteral = TODO() + } + """.trimIndent() + ) + ) + assertEquals(KotlinCompilation.ExitCode.COMPILATION_ERROR, result.exitCode, result.messages) + } } } From da058770a1322534c94b66f8e54133539c61d374 Mon Sep 17 00:00:00 2001 From: Clemente Date: Tue, 12 Dec 2023 00:17:17 +0100 Subject: [PATCH 13/32] Add check on type adapter valid realm types --- .../compiler/AccessorModifierIrGeneration.kt | 265 +------------- .../compiler/RealmModelLoweringExtension.kt | 39 ++- .../kotlin/compiler/RealmPluginContext.kt | 327 ++++++++++++++++++ .../kotlin/test/compiler/TypeAdaptersTests.kt | 11 +- 4 files changed, 358 insertions(+), 284 deletions(-) create mode 100644 packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/RealmPluginContext.kt diff --git a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/AccessorModifierIrGeneration.kt b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/AccessorModifierIrGeneration.kt index 24091bccf5..7ee7149ff4 100644 --- a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/AccessorModifierIrGeneration.kt +++ b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/AccessorModifierIrGeneration.kt @@ -16,52 +16,13 @@ package io.realm.kotlin.compiler -import io.realm.kotlin.compiler.ClassIds.ASYMMETRIC_OBJECT_INTERFACE -import io.realm.kotlin.compiler.ClassIds.EMBEDDED_OBJECT_INTERFACE import io.realm.kotlin.compiler.ClassIds.IGNORE_ANNOTATION -import io.realm.kotlin.compiler.ClassIds.KBSON_DECIMAL128 -import io.realm.kotlin.compiler.ClassIds.KBSON_OBJECT_ID -import io.realm.kotlin.compiler.ClassIds.REALM_ANY -import io.realm.kotlin.compiler.ClassIds.REALM_BACKLINKS -import io.realm.kotlin.compiler.ClassIds.REALM_DICTIONARY -import io.realm.kotlin.compiler.ClassIds.REALM_EMBEDDED_BACKLINKS -import io.realm.kotlin.compiler.ClassIds.REALM_INSTANT -import io.realm.kotlin.compiler.ClassIds.REALM_LIST -import io.realm.kotlin.compiler.ClassIds.REALM_MUTABLE_INTEGER -import io.realm.kotlin.compiler.ClassIds.REALM_OBJECT_HELPER -import io.realm.kotlin.compiler.ClassIds.REALM_OBJECT_ID -import io.realm.kotlin.compiler.ClassIds.REALM_OBJECT_INTERFACE -import io.realm.kotlin.compiler.ClassIds.REALM_SET -import io.realm.kotlin.compiler.ClassIds.REALM_UUID import io.realm.kotlin.compiler.ClassIds.TRANSIENT_ANNOTATION import io.realm.kotlin.compiler.ClassIds.TYPE_ADAPTER_ANNOTATION import io.realm.kotlin.compiler.Names.OBJECT_REFERENCE -import io.realm.kotlin.compiler.Names.REALM_ACCESSOR_HELPER_GET_BOOLEAN -import io.realm.kotlin.compiler.Names.REALM_ACCESSOR_HELPER_GET_BYTE_ARRAY -import io.realm.kotlin.compiler.Names.REALM_ACCESSOR_HELPER_GET_DECIMAL128 -import io.realm.kotlin.compiler.Names.REALM_ACCESSOR_HELPER_GET_DOUBLE -import io.realm.kotlin.compiler.Names.REALM_ACCESSOR_HELPER_GET_FLOAT -import io.realm.kotlin.compiler.Names.REALM_ACCESSOR_HELPER_GET_INSTANT -import io.realm.kotlin.compiler.Names.REALM_ACCESSOR_HELPER_GET_LONG -import io.realm.kotlin.compiler.Names.REALM_ACCESSOR_HELPER_GET_OBJECT_ID -import io.realm.kotlin.compiler.Names.REALM_ACCESSOR_HELPER_GET_REALM_ANY -import io.realm.kotlin.compiler.Names.REALM_ACCESSOR_HELPER_GET_STRING -import io.realm.kotlin.compiler.Names.REALM_ACCESSOR_HELPER_GET_UUID -import io.realm.kotlin.compiler.Names.REALM_ACCESSOR_HELPER_SET_VALUE -import io.realm.kotlin.compiler.Names.REALM_OBJECT_HELPER_GET_DICTIONARY -import io.realm.kotlin.compiler.Names.REALM_OBJECT_HELPER_GET_LIST -import io.realm.kotlin.compiler.Names.REALM_OBJECT_HELPER_GET_MUTABLE_INT -import io.realm.kotlin.compiler.Names.REALM_OBJECT_HELPER_GET_OBJECT -import io.realm.kotlin.compiler.Names.REALM_OBJECT_HELPER_GET_SET -import io.realm.kotlin.compiler.Names.REALM_OBJECT_HELPER_SET_DICTIONARY -import io.realm.kotlin.compiler.Names.REALM_OBJECT_HELPER_SET_EMBEDDED_REALM_OBJECT -import io.realm.kotlin.compiler.Names.REALM_OBJECT_HELPER_SET_LIST -import io.realm.kotlin.compiler.Names.REALM_OBJECT_HELPER_SET_OBJECT -import io.realm.kotlin.compiler.Names.REALM_OBJECT_HELPER_SET_SET import io.realm.kotlin.compiler.Names.REALM_SYNTHETIC_PROPERTY_PREFIX import io.realm.kotlin.compiler.Names.REALM_TYPE_ADAPTER_FROM_REALM import io.realm.kotlin.compiler.Names.REALM_TYPE_ADAPTER_TO_REALM -import org.jetbrains.kotlin.backend.common.extensions.IrPluginContext import org.jetbrains.kotlin.descriptors.ClassKind import org.jetbrains.kotlin.ir.IrStatement import org.jetbrains.kotlin.ir.builders.IrBlockBuilder @@ -80,7 +41,6 @@ import org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin import org.jetbrains.kotlin.ir.declarations.IrProperty import org.jetbrains.kotlin.ir.declarations.IrSimpleFunction import org.jetbrains.kotlin.ir.declarations.IrValueParameter -import org.jetbrains.kotlin.ir.descriptors.toIrBasedDescriptor import org.jetbrains.kotlin.ir.descriptors.toIrBasedKotlinType import org.jetbrains.kotlin.ir.expressions.IrCall import org.jetbrains.kotlin.ir.expressions.IrClassReference @@ -97,7 +57,6 @@ import org.jetbrains.kotlin.ir.types.IrTypeArgument import org.jetbrains.kotlin.ir.types.getClass import org.jetbrains.kotlin.ir.types.impl.IrAbstractSimpleType import org.jetbrains.kotlin.ir.types.impl.IrSimpleTypeImpl -import org.jetbrains.kotlin.ir.types.impl.originalKotlinType import org.jetbrains.kotlin.ir.types.isBoolean import org.jetbrains.kotlin.ir.types.isByte import org.jetbrains.kotlin.ir.types.isByteArray @@ -113,18 +72,13 @@ import org.jetbrains.kotlin.ir.types.isSubtypeOfClass import org.jetbrains.kotlin.ir.types.makeNotNull import org.jetbrains.kotlin.ir.types.superTypes import org.jetbrains.kotlin.ir.types.typeOrNull -import org.jetbrains.kotlin.ir.util.classId import org.jetbrains.kotlin.ir.util.defaultType import org.jetbrains.kotlin.ir.util.parentAsClass import org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid import org.jetbrains.kotlin.ir.visitors.transformChildrenVoid -import org.jetbrains.kotlin.name.CallableId import org.jetbrains.kotlin.name.ClassId -import org.jetbrains.kotlin.name.FqName -import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.resolve.descriptorUtil.classId import org.jetbrains.kotlin.types.KotlinType -import org.jetbrains.kotlin.types.StarProjectionImpl import org.jetbrains.kotlin.types.isNullable import org.jetbrains.kotlin.types.typeUtil.supertypes import kotlin.IllegalStateException @@ -134,106 +88,7 @@ import kotlin.collections.set * Modifies the IR tree to transform getter/setter to call the C-Interop layer to retrieve read the managed values from the Realm * It also collect the schema information while processing the class properties. */ -class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { - - private val realmObjectHelper: IrClass = pluginContext.lookupClassOrThrow(REALM_OBJECT_HELPER) - private val realmListClass: IrClass = pluginContext.lookupClassOrThrow(REALM_LIST) - private val realmSetClass: IrClass = pluginContext.lookupClassOrThrow(REALM_SET) - private val realmDictionaryClass: IrClass = pluginContext.lookupClassOrThrow(REALM_DICTIONARY) - private val realmInstantClass: IrClass = pluginContext.lookupClassOrThrow(REALM_INSTANT) - private val realmBacklinksClass: IrClass = pluginContext.lookupClassOrThrow(REALM_BACKLINKS) - private val realmEmbeddedBacklinksClass: IrClass = pluginContext.lookupClassOrThrow(REALM_EMBEDDED_BACKLINKS) - private val realmObjectInterface = pluginContext.lookupClassOrThrow(REALM_OBJECT_INTERFACE).symbol - private val embeddedRealmObjectInterface = pluginContext.lookupClassOrThrow(EMBEDDED_OBJECT_INTERFACE).symbol - // Attempt to find the interface for asymmetric objects. - // The class will normally only be on the classpath for library-sync builds, not - // library-base builds. - private val asymmetricRealmObjectInterface: IrClass? = pluginContext.referenceClass(ASYMMETRIC_OBJECT_INTERFACE)?.owner - - private val objectIdClass: IrClass = pluginContext.lookupClassOrThrow(KBSON_OBJECT_ID) - private val decimal128Class: IrClass = pluginContext.lookupClassOrThrow(KBSON_DECIMAL128) - private val realmObjectIdClass: IrClass = pluginContext.lookupClassOrThrow(REALM_OBJECT_ID) - private val realmUUIDClass: IrClass = pluginContext.lookupClassOrThrow(REALM_UUID) - private val mutableRealmIntegerClass: IrClass = pluginContext.lookupClassOrThrow(REALM_MUTABLE_INTEGER) - private val realmAnyClass: IrClass = pluginContext.lookupClassOrThrow(REALM_ANY) - - // Primitive (Core) type getters - private val getString: IrSimpleFunction = - realmObjectHelper.lookupFunction(REALM_ACCESSOR_HELPER_GET_STRING) - private val getLong: IrSimpleFunction = - realmObjectHelper.lookupFunction(REALM_ACCESSOR_HELPER_GET_LONG) - private val getBoolean: IrSimpleFunction = - realmObjectHelper.lookupFunction(REALM_ACCESSOR_HELPER_GET_BOOLEAN) - private val getFloat: IrSimpleFunction = - realmObjectHelper.lookupFunction(REALM_ACCESSOR_HELPER_GET_FLOAT) - private val getDouble: IrSimpleFunction = - realmObjectHelper.lookupFunction(REALM_ACCESSOR_HELPER_GET_DOUBLE) - private val getDecimal128: IrSimpleFunction = - realmObjectHelper.lookupFunction(REALM_ACCESSOR_HELPER_GET_DECIMAL128) - private val getInstant: IrSimpleFunction = - realmObjectHelper.lookupFunction(REALM_ACCESSOR_HELPER_GET_INSTANT) - private val getObjectId: IrSimpleFunction = - realmObjectHelper.lookupFunction(REALM_ACCESSOR_HELPER_GET_OBJECT_ID) - private val getUUID: IrSimpleFunction = - realmObjectHelper.lookupFunction(REALM_ACCESSOR_HELPER_GET_UUID) - private val getByteArray: IrSimpleFunction = - realmObjectHelper.lookupFunction(REALM_ACCESSOR_HELPER_GET_BYTE_ARRAY) - private val getMutableInt: IrSimpleFunction = - realmObjectHelper.lookupFunction(REALM_OBJECT_HELPER_GET_MUTABLE_INT) - private val getRealmAny: IrSimpleFunction = - realmObjectHelper.lookupFunction(REALM_ACCESSOR_HELPER_GET_REALM_ANY) - private val getObject: IrSimpleFunction = - realmObjectHelper.lookupFunction(REALM_OBJECT_HELPER_GET_OBJECT) - - // Primitive (Core) type setters - private val setValue: IrSimpleFunction = - realmObjectHelper.lookupFunction(REALM_ACCESSOR_HELPER_SET_VALUE) - private val setObject: IrSimpleFunction = - realmObjectHelper.lookupFunction(REALM_OBJECT_HELPER_SET_OBJECT) - private val setEmbeddedRealmObject: IrSimpleFunction = - realmObjectHelper.lookupFunction(REALM_OBJECT_HELPER_SET_EMBEDDED_REALM_OBJECT) - - // Getters and setters for collections - private val getList: IrSimpleFunction = - realmObjectHelper.lookupFunction(REALM_OBJECT_HELPER_GET_LIST) - private val setList: IrSimpleFunction = - realmObjectHelper.lookupFunction(REALM_OBJECT_HELPER_SET_LIST) - private val getSet: IrSimpleFunction = - realmObjectHelper.lookupFunction(REALM_OBJECT_HELPER_GET_SET) - private val setSet: IrSimpleFunction = - realmObjectHelper.lookupFunction(REALM_OBJECT_HELPER_SET_SET) - private val getDictionary: IrSimpleFunction = - realmObjectHelper.lookupFunction(REALM_OBJECT_HELPER_GET_DICTIONARY) - private val setDictionary: IrSimpleFunction = - realmObjectHelper.lookupFunction(REALM_OBJECT_HELPER_SET_DICTIONARY) - - // Top level SDK->Core converters - private val byteToLong: IrSimpleFunction = - pluginContext.referenceFunctions(CallableId(FqName("io.realm.kotlin.internal"), Name.identifier("byteToLong"))).first().owner - private val charToLong: IrSimpleFunction = - pluginContext.referenceFunctions(CallableId(FqName("io.realm.kotlin.internal"), Name.identifier("charToLong"))).first().owner - private val shortToLong: IrSimpleFunction = - pluginContext.referenceFunctions(CallableId(FqName("io.realm.kotlin.internal"), Name.identifier("shortToLong"))).first().owner - private val intToLong: IrSimpleFunction = - pluginContext.referenceFunctions(CallableId(FqName("io.realm.kotlin.internal"), Name.identifier("intToLong"))).first().owner - - // Top level Core->SDK converters - private val longToByte: IrSimpleFunction = - pluginContext.referenceFunctions(CallableId(FqName("io.realm.kotlin.internal"), Name.identifier("longToByte"))).first().owner - private val longToChar: IrSimpleFunction = - pluginContext.referenceFunctions(CallableId(FqName("io.realm.kotlin.internal"), Name.identifier("longToChar"))).first().owner - private val longToShort: IrSimpleFunction = - pluginContext.referenceFunctions(CallableId(FqName("io.realm.kotlin.internal"), Name.identifier("longToShort"))).first().owner - private val longToInt: IrSimpleFunction = - pluginContext.referenceFunctions(CallableId(FqName("io.realm.kotlin.internal"), Name.identifier("longToInt"))).first().owner - private val objectIdToRealmObjectId: IrSimpleFunction = - pluginContext.referenceFunctions(CallableId(FqName("io.realm.kotlin.internal"), Name.identifier("objectIdToRealmObjectId"))).first().owner - - private val providedAdapterFromRealm: IrSimpleFunction = - pluginContext.referenceFunctions(CallableId(FqName("io.realm.kotlin.internal"), Name.identifier("fromRealm"))).first().owner - - private val providedAdapterToRealm: IrSimpleFunction = - pluginContext.referenceFunctions(CallableId(FqName("io.realm.kotlin.internal"), Name.identifier("toRealm"))).first().owner +class AccessorModifierIrGeneration(realmPluginContext: RealmPluginContext): RealmPluginContext by realmPluginContext { private lateinit var objectReferenceProperty: IrProperty private lateinit var objectReferenceType: IrType @@ -325,7 +180,7 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { if(actualType != null) { propertyTypeRaw = actualType propertyType = actualType.makeNotNull() - if(!propertyType.isPersistedPrimitiveType()) { + if(!propertyType.isValidPersistedType()) { // TODO improve messaging logError("Unsupported Realm storage type. Use a valid type` instead", declaration.locationOf()) } @@ -893,7 +748,7 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { val collectionGenericType = (type as IrSimpleTypeImpl).arguments[0] - if(typeAdapterMethodReferences != null && !collectionGenericType.typeOrNull!!.makeNotNull().isPersistedPrimitiveType()) { + if(typeAdapterMethodReferences != null && !collectionGenericType.typeOrNull!!.makeNotNull().isValidPersistedType()) { // TODO improve messaging logError("Unsupported Realm storage type. Use a valid type instead", declaration.locationOf()) } @@ -1144,120 +999,6 @@ class AccessorModifierIrGeneration(private val pluginContext: IrPluginContext) { } } - private fun IrType.isRealmList(): Boolean { - val propertyClassId: ClassId = this.classIdOrFail() - val realmListClassId: ClassId? = realmListClass.classId - return propertyClassId == realmListClassId - } - - private fun IrType.isRealmSet(): Boolean { - val propertyClassId: ClassId = this.classIdOrFail() - val realmSetClassId: ClassId? = realmSetClass.classId - return propertyClassId == realmSetClassId - } - - private fun IrType.isRealmDictionary(): Boolean { - val propertyClassId: ClassId = this.classIdOrFail() - val realmDictionaryClassId: ClassId? = realmDictionaryClass.classId - return propertyClassId == realmDictionaryClassId - } - - private fun IrType.isRealmInstant(): Boolean { - val propertyClassId: ClassId = this.classIdOrFail() - val realmInstantClassId: ClassId? = realmInstantClass.classId - return propertyClassId == realmInstantClassId - } - - private fun IrType.isLinkingObject(): Boolean { - val propertyClassId: ClassId = this.classIdOrFail() - val realmBacklinksClassId: ClassId? = realmBacklinksClass.classId - return propertyClassId == realmBacklinksClassId - } - - private fun IrType.isEmbeddedLinkingObject(): Boolean { - val propertyClassId: ClassId = this.classIdOrFail() - val realmEmbeddedBacklinksClassId: ClassId? = realmEmbeddedBacklinksClass.classId - return propertyClassId == realmEmbeddedBacklinksClassId - } - - private fun IrType.isDecimal128(): Boolean { - val propertyClassId: ClassId = this.classIdOrFail() - val objectIdClassId: ClassId? = decimal128Class.classId - return propertyClassId == objectIdClassId - } - - private fun IrType.isObjectId(): Boolean { - val propertyClassId: ClassId = this.classIdOrFail() - val objectIdClassId: ClassId? = objectIdClass.classId - return propertyClassId == objectIdClassId - } - - private fun IrType.isRealmObjectId(): Boolean { - val propertyClassId: ClassId = this.classIdOrFail() - val objectIdClassId: ClassId? = realmObjectIdClass.classId - return propertyClassId == objectIdClassId - } - - private fun IrType.hasSameClassId(other: IrType): Boolean { - val propertyClassId: ClassId = this.classIdOrFail() - val otherClassId = other.classIdOrFail() - return propertyClassId == otherClassId - } - - private fun IrType.isRealmUUID(): Boolean { - val propertyClassId: ClassId = this.classIdOrFail() - val realmUUIDClassId: ClassId? = realmUUIDClass.classId - return propertyClassId == realmUUIDClassId - } - - fun IrType.isMutableRealmInteger(): Boolean { - val propertyClassId: ClassId = this.classIdOrFail() - val mutableRealmIntegerClassId: ClassId? = mutableRealmIntegerClass.classId - return propertyClassId == mutableRealmIntegerClassId - } - - fun IrType.isRealmAny(): Boolean { - val propertyClassId: ClassId = this.classIdOrFail() - val mutableRealmIntegerClassId: ClassId? = realmAnyClass.classId - return propertyClassId == mutableRealmIntegerClassId - } - - fun IrType.isPersistedPrimitiveType(): Boolean = isRealmAny() || - isByteArray() || - isString() || -// isLinkingObject() || -// isEmbeddedLinkingObject() || -// isPersistedPrimitiveType() || -// isMutableRealmInteger() || -// isByte() || -// isChar() || -// isShort() || -// isInt() || - isLong() || - isBoolean() || - isFloat() || - isDouble() || - isDecimal128() || - // isEmbeddedLinkingObject() || - // isLinkingObject() || - isRealmList() || - isRealmSet() || - isRealmDictionary() || - isRealmInstant() || - isObjectId() || - isRealmObjectId() || - isRealmUUID() || - isRealmList() || - isRealmSet() || - isRealmDictionary() || - isSubtypeOfClass(embeddedRealmObjectInterface) || - asymmetricRealmObjectInterface?.let { - isSubtypeOfClass( - asymmetricRealmObjectInterface.symbol - ) - } ?: false || - isSubtypeOfClass(realmObjectInterface) - @Suppress("ReturnCount", "LongMethod") private fun getCollectionGenericCoreType( collectionType: CollectionType, diff --git a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/RealmModelLoweringExtension.kt b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/RealmModelLoweringExtension.kt index 8748f79f1c..bfe4c8564e 100644 --- a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/RealmModelLoweringExtension.kt +++ b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/RealmModelLoweringExtension.kt @@ -33,7 +33,9 @@ import org.jetbrains.kotlin.ir.expressions.impl.IrClassReferenceImpl import org.jetbrains.kotlin.ir.expressions.impl.IrConstructorCallImpl import org.jetbrains.kotlin.ir.symbols.IrClassSymbol import org.jetbrains.kotlin.ir.types.IrSimpleType +import org.jetbrains.kotlin.ir.types.classFqName import org.jetbrains.kotlin.ir.types.defaultType +import org.jetbrains.kotlin.ir.types.makeNotNull import org.jetbrains.kotlin.ir.types.starProjectedType import org.jetbrains.kotlin.ir.types.superTypes import org.jetbrains.kotlin.ir.types.typeOrNull @@ -63,20 +65,29 @@ private class RealmModelLowering(private val pluginContext: IrPluginContext) : C override fun lower(irFile: IrFile) = runOnFilePostfix(irFile) override fun lower(irClass: IrClass) { + val realmPluginContext by lazy { RealmPluginContextImpl(pluginContext) } + if (irClass.isRealmTypeAdapter) { - // Validate that the R type parameter is a valid RealmType -// irClass.symbol -// .superTypes() -// .first { -// it.classId == REALM_TYPE_ADAPTER_INTERFACE -// } -// .let { -// it as IrSimpleType -// } -// .arguments -// .let { arguments -> -// arguments[0].typeOrNull!!.isPersistedPrimitiveType() -// } + with(realmPluginContext) { + // Validate that the R type parameter on a RealmTypeAdapter is a valid persisted type + val realmType = irClass.symbol + .superTypes() + .first { + it.classId == REALM_TYPE_ADAPTER_INTERFACE + } + .let { + it as IrSimpleType + } + .arguments + .let { arguments -> + arguments[0].typeOrNull!! + } + + if(!realmType.makeNotNull().isValidPersistedType()) { + // TODO better name please + logError("Invalid type parameter '${realmType.classFqName}', only Realm types are supported") + } + } } if (irClass.isBaseRealmObject) { @@ -125,7 +136,7 @@ private class RealmModelLowering(private val pluginContext: IrPluginContext) : C generator.addRealmObjectInternalProperties(irClass) // Modify properties accessor to generate custom getter/setter - AccessorModifierIrGeneration(pluginContext).modifyPropertiesAndCollectSchema(irClass) + AccessorModifierIrGeneration(realmPluginContext).modifyPropertiesAndCollectSchema(irClass) // Add custom toString, equals and hashCode methods val methodGenerator = RealmModelDefaultMethodGeneration(pluginContext) diff --git a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/RealmPluginContext.kt b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/RealmPluginContext.kt new file mode 100644 index 0000000000..e49c8cda9a --- /dev/null +++ b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/RealmPluginContext.kt @@ -0,0 +1,327 @@ +package io.realm.kotlin.compiler + +import org.jetbrains.kotlin.backend.common.extensions.IrPluginContext +import org.jetbrains.kotlin.ir.declarations.IrClass +import org.jetbrains.kotlin.ir.declarations.IrSimpleFunction +import org.jetbrains.kotlin.ir.symbols.IrClassSymbol +import org.jetbrains.kotlin.ir.types.IrType +import org.jetbrains.kotlin.ir.types.isBoolean +import org.jetbrains.kotlin.ir.types.isByteArray +import org.jetbrains.kotlin.ir.types.isDouble +import org.jetbrains.kotlin.ir.types.isFloat +import org.jetbrains.kotlin.ir.types.isLong +import org.jetbrains.kotlin.ir.types.isString +import org.jetbrains.kotlin.ir.types.isSubtypeOfClass +import org.jetbrains.kotlin.ir.util.classId +import org.jetbrains.kotlin.name.CallableId +import org.jetbrains.kotlin.name.ClassId +import org.jetbrains.kotlin.name.FqName +import org.jetbrains.kotlin.name.Name + + +interface RealmPluginContext { + val pluginContext: IrPluginContext + val realmObjectHelper: IrClass + val realmListClass: IrClass + val realmSetClass: IrClass + val realmDictionaryClass: IrClass + val realmInstantClass: IrClass + val realmBacklinksClass: IrClass + val realmEmbeddedBacklinksClass: IrClass + val realmObjectInterface: IrClassSymbol + val embeddedRealmObjectInterface: IrClassSymbol + + // Attempt to find the interface for asymmetric objects. + // The class will normally only be on the classpath for library-sync builds, not + // library-base builds. + val asymmetricRealmObjectInterface: IrClass? + + val objectIdClass: IrClass + val decimal128Class: IrClass + val realmObjectIdClass: IrClass + val realmUUIDClass: IrClass + val mutableRealmIntegerClass: IrClass + val realmAnyClass: IrClass + + // Primitive (Core) type getters + val getString: IrSimpleFunction + val getLong: IrSimpleFunction + val getBoolean: IrSimpleFunction + val getFloat: IrSimpleFunction + val getDouble: IrSimpleFunction + val getDecimal128: IrSimpleFunction + val getInstant: IrSimpleFunction + val getObjectId: IrSimpleFunction + val getUUID: IrSimpleFunction + val getByteArray: IrSimpleFunction + val getMutableInt: IrSimpleFunction + val getRealmAny: IrSimpleFunction + val getObject: IrSimpleFunction + + // Primitive (Core) type setters + val setValue: IrSimpleFunction + val setObject: IrSimpleFunction + val setEmbeddedRealmObject: IrSimpleFunction + + // Getters and setters for collections + val getList: IrSimpleFunction + val setList: IrSimpleFunction + val getSet: IrSimpleFunction + val setSet: IrSimpleFunction + val getDictionary: IrSimpleFunction + val setDictionary: IrSimpleFunction + + // Top level SDK->Core converters + val byteToLong: IrSimpleFunction + val charToLong: IrSimpleFunction + val shortToLong: IrSimpleFunction + val intToLong: IrSimpleFunction + + // Top level Core->SDK converters + val longToByte: IrSimpleFunction + val longToChar: IrSimpleFunction + val longToShort: IrSimpleFunction + val longToInt: IrSimpleFunction + val objectIdToRealmObjectId: IrSimpleFunction + + val providedAdapterFromRealm: IrSimpleFunction + val providedAdapterToRealm: IrSimpleFunction + + + fun IrType.isRealmList(): Boolean { + val propertyClassId: ClassId = this.classIdOrFail() + val realmListClassId: ClassId? = realmListClass.classId + return propertyClassId == realmListClassId + } + + fun IrType.isRealmSet(): Boolean { + val propertyClassId: ClassId = this.classIdOrFail() + val realmSetClassId: ClassId? = realmSetClass.classId + return propertyClassId == realmSetClassId + } + + fun IrType.isRealmDictionary(): Boolean { + val propertyClassId: ClassId = this.classIdOrFail() + val realmDictionaryClassId: ClassId? = realmDictionaryClass.classId + return propertyClassId == realmDictionaryClassId + } + + fun IrType.isRealmInstant(): Boolean { + val propertyClassId: ClassId = this.classIdOrFail() + val realmInstantClassId: ClassId? = realmInstantClass.classId + return propertyClassId == realmInstantClassId + } + + fun IrType.isLinkingObject(): Boolean { + val propertyClassId: ClassId = this.classIdOrFail() + val realmBacklinksClassId: ClassId? = realmBacklinksClass.classId + return propertyClassId == realmBacklinksClassId + } + + fun IrType.isEmbeddedLinkingObject(): Boolean { + val propertyClassId: ClassId = this.classIdOrFail() + val realmEmbeddedBacklinksClassId: ClassId? = realmEmbeddedBacklinksClass.classId + return propertyClassId == realmEmbeddedBacklinksClassId + } + + fun IrType.isDecimal128(): Boolean { + val propertyClassId: ClassId = this.classIdOrFail() + val objectIdClassId: ClassId? = decimal128Class.classId + return propertyClassId == objectIdClassId + } + + fun IrType.isObjectId(): Boolean { + val propertyClassId: ClassId = this.classIdOrFail() + val objectIdClassId: ClassId? = objectIdClass.classId + return propertyClassId == objectIdClassId + } + + fun IrType.isRealmObjectId(): Boolean { + val propertyClassId: ClassId = this.classIdOrFail() + val objectIdClassId: ClassId? = realmObjectIdClass.classId + return propertyClassId == objectIdClassId + } + + fun IrType.hasSameClassId(other: IrType): Boolean { + val propertyClassId: ClassId = this.classIdOrFail() + val otherClassId = other.classIdOrFail() + return propertyClassId == otherClassId + } + + fun IrType.isRealmUUID(): Boolean { + val propertyClassId: ClassId = this.classIdOrFail() + val realmUUIDClassId: ClassId? = realmUUIDClass.classId + return propertyClassId == realmUUIDClassId + } + + fun IrType.isMutableRealmInteger(): Boolean { + val propertyClassId: ClassId = this.classIdOrFail() + val mutableRealmIntegerClassId: ClassId? = mutableRealmIntegerClass.classId + return propertyClassId == mutableRealmIntegerClassId + } + + fun IrType.isRealmAny(): Boolean { + val propertyClassId: ClassId = this.classIdOrFail() + val mutableRealmIntegerClassId: ClassId? = realmAnyClass.classId + return propertyClassId == mutableRealmIntegerClassId + } + + fun IrType.isValidPersistedType(): Boolean = isRealmAny() || + isByteArray() || + isString() || +// isLinkingObject() || +// isEmbeddedLinkingObject() || +// isPersistedPrimitiveType() || +// isMutableRealmInteger() || +// isByte() || +// isChar() || +// isShort() || +// isInt() || + isLong() || + isBoolean() || + isFloat() || + isDouble() || + isDecimal128() || + // isEmbeddedLinkingObject() || + // isLinkingObject() || + isRealmList() || + isRealmSet() || + isRealmDictionary() || + isRealmInstant() || + isObjectId() || + isRealmObjectId() || + isRealmUUID() || + isRealmList() || + isRealmSet() || + isRealmDictionary() || + isSubtypeOfClass(embeddedRealmObjectInterface) || + asymmetricRealmObjectInterface?.let { isSubtypeOfClass(it.symbol) } ?: false || + isSubtypeOfClass(realmObjectInterface) +} + +class RealmPluginContextImpl(override val pluginContext: IrPluginContext): RealmPluginContext { + override val realmObjectHelper: IrClass = pluginContext.lookupClassOrThrow(ClassIds.REALM_OBJECT_HELPER) + override val realmListClass: IrClass = pluginContext.lookupClassOrThrow(ClassIds.REALM_LIST) + override val realmSetClass: IrClass = pluginContext.lookupClassOrThrow(ClassIds.REALM_SET) + override val realmDictionaryClass: IrClass = pluginContext.lookupClassOrThrow(ClassIds.REALM_DICTIONARY) + override val realmInstantClass: IrClass = pluginContext.lookupClassOrThrow(ClassIds.REALM_INSTANT) + override val realmBacklinksClass: IrClass = pluginContext.lookupClassOrThrow(ClassIds.REALM_BACKLINKS) + override val realmEmbeddedBacklinksClass: IrClass = + pluginContext.lookupClassOrThrow(ClassIds.REALM_EMBEDDED_BACKLINKS) + override val realmObjectInterface = + pluginContext.lookupClassOrThrow(ClassIds.REALM_OBJECT_INTERFACE).symbol + override val embeddedRealmObjectInterface = + pluginContext.lookupClassOrThrow(ClassIds.EMBEDDED_OBJECT_INTERFACE).symbol + + // Attempt to find the interface for asymmetric objects. + // The class will normally only be on the classpath for library-sync builds, not + // library-base builds. + override val asymmetricRealmObjectInterface: IrClass? = + pluginContext.referenceClass(ClassIds.ASYMMETRIC_OBJECT_INTERFACE)?.owner + + override val objectIdClass: IrClass = pluginContext.lookupClassOrThrow(ClassIds.KBSON_OBJECT_ID) + override val decimal128Class: IrClass = pluginContext.lookupClassOrThrow(ClassIds.KBSON_DECIMAL128) + override val realmObjectIdClass: IrClass = pluginContext.lookupClassOrThrow(ClassIds.REALM_OBJECT_ID) + override val realmUUIDClass: IrClass = pluginContext.lookupClassOrThrow(ClassIds.REALM_UUID) + override val mutableRealmIntegerClass: IrClass = + pluginContext.lookupClassOrThrow(ClassIds.REALM_MUTABLE_INTEGER) + override val realmAnyClass: IrClass = pluginContext.lookupClassOrThrow(ClassIds.REALM_ANY) + + // Primitive (Core) type getters + override val getString: IrSimpleFunction = + realmObjectHelper.lookupFunction(Names.REALM_ACCESSOR_HELPER_GET_STRING) + override val getLong: IrSimpleFunction = + realmObjectHelper.lookupFunction(Names.REALM_ACCESSOR_HELPER_GET_LONG) + override val getBoolean: IrSimpleFunction = + realmObjectHelper.lookupFunction(Names.REALM_ACCESSOR_HELPER_GET_BOOLEAN) + override val getFloat: IrSimpleFunction = + realmObjectHelper.lookupFunction(Names.REALM_ACCESSOR_HELPER_GET_FLOAT) + override val getDouble: IrSimpleFunction = + realmObjectHelper.lookupFunction(Names.REALM_ACCESSOR_HELPER_GET_DOUBLE) + override val getDecimal128: IrSimpleFunction = + realmObjectHelper.lookupFunction(Names.REALM_ACCESSOR_HELPER_GET_DECIMAL128) + override val getInstant: IrSimpleFunction = + realmObjectHelper.lookupFunction(Names.REALM_ACCESSOR_HELPER_GET_INSTANT) + override val getObjectId: IrSimpleFunction = + realmObjectHelper.lookupFunction(Names.REALM_ACCESSOR_HELPER_GET_OBJECT_ID) + override val getUUID: IrSimpleFunction = + realmObjectHelper.lookupFunction(Names.REALM_ACCESSOR_HELPER_GET_UUID) + override val getByteArray: IrSimpleFunction = + realmObjectHelper.lookupFunction(Names.REALM_ACCESSOR_HELPER_GET_BYTE_ARRAY) + override val getMutableInt: IrSimpleFunction = + realmObjectHelper.lookupFunction(Names.REALM_OBJECT_HELPER_GET_MUTABLE_INT) + override val getRealmAny: IrSimpleFunction = + realmObjectHelper.lookupFunction(Names.REALM_ACCESSOR_HELPER_GET_REALM_ANY) + override val getObject: IrSimpleFunction = + realmObjectHelper.lookupFunction(Names.REALM_OBJECT_HELPER_GET_OBJECT) + + // Primitive (Core) type setters + override val setValue: IrSimpleFunction = + realmObjectHelper.lookupFunction(Names.REALM_ACCESSOR_HELPER_SET_VALUE) + override val setObject: IrSimpleFunction = + realmObjectHelper.lookupFunction(Names.REALM_OBJECT_HELPER_SET_OBJECT) + override val setEmbeddedRealmObject: IrSimpleFunction = + realmObjectHelper.lookupFunction(Names.REALM_OBJECT_HELPER_SET_EMBEDDED_REALM_OBJECT) + + // Getters and setters for collections + override val getList: IrSimpleFunction = + realmObjectHelper.lookupFunction(Names.REALM_OBJECT_HELPER_GET_LIST) + override val setList: IrSimpleFunction = + realmObjectHelper.lookupFunction(Names.REALM_OBJECT_HELPER_SET_LIST) + override val getSet: IrSimpleFunction = + realmObjectHelper.lookupFunction(Names.REALM_OBJECT_HELPER_GET_SET) + override val setSet: IrSimpleFunction = + realmObjectHelper.lookupFunction(Names.REALM_OBJECT_HELPER_SET_SET) + override val getDictionary: IrSimpleFunction = + realmObjectHelper.lookupFunction(Names.REALM_OBJECT_HELPER_GET_DICTIONARY) + override val setDictionary: IrSimpleFunction = + realmObjectHelper.lookupFunction(Names.REALM_OBJECT_HELPER_SET_DICTIONARY) + + // Top level SDK->Core converters + override val byteToLong: IrSimpleFunction = + pluginContext.referenceFunctions( + CallableId( + FqName("io.realm.kotlin.internal"), + Name.identifier("byteToLong") + ) + ).first().owner + override val charToLong: IrSimpleFunction = + pluginContext.referenceFunctions( + CallableId( + FqName("io.realm.kotlin.internal"), + Name.identifier("charToLong") + ) + ).first().owner + override val shortToLong: IrSimpleFunction = + pluginContext.referenceFunctions( + CallableId( + FqName("io.realm.kotlin.internal"), + Name.identifier("shortToLong") + ) + ).first().owner + override val intToLong: IrSimpleFunction = + pluginContext.referenceFunctions( + CallableId( + FqName("io.realm.kotlin.internal"), + Name.identifier("intToLong") + ) + ).first().owner + + // Top level Core->SDK converters + override val longToByte: IrSimpleFunction = + pluginContext.referenceFunctions(CallableId(FqName("io.realm.kotlin.internal"), Name.identifier("longToByte"))).first().owner + override val longToChar: IrSimpleFunction = + pluginContext.referenceFunctions(CallableId(FqName("io.realm.kotlin.internal"), Name.identifier("longToChar"))).first().owner + override val longToShort: IrSimpleFunction = + pluginContext.referenceFunctions(CallableId(FqName("io.realm.kotlin.internal"), Name.identifier("longToShort"))).first().owner + override val longToInt: IrSimpleFunction = + pluginContext.referenceFunctions(CallableId(FqName("io.realm.kotlin.internal"), Name.identifier("longToInt"))).first().owner + override val objectIdToRealmObjectId: IrSimpleFunction = + pluginContext.referenceFunctions(CallableId(FqName("io.realm.kotlin.internal"), Name.identifier("objectIdToRealmObjectId"))).first().owner + + override val providedAdapterFromRealm: IrSimpleFunction = + pluginContext.referenceFunctions(CallableId(FqName("io.realm.kotlin.internal"), Name.identifier("fromRealm"))).first().owner + + override val providedAdapterToRealm: IrSimpleFunction = + pluginContext.referenceFunctions(CallableId(FqName("io.realm.kotlin.internal"), Name.identifier("toRealm"))).first().owner +} \ No newline at end of file diff --git a/packages/test-base/src/jvmTest/kotlin/io/realm/kotlin/test/compiler/TypeAdaptersTests.kt b/packages/test-base/src/jvmTest/kotlin/io/realm/kotlin/test/compiler/TypeAdaptersTests.kt index dd1d80a0f6..624f21c0e2 100644 --- a/packages/test-base/src/jvmTest/kotlin/io/realm/kotlin/test/compiler/TypeAdaptersTests.kt +++ b/packages/test-base/src/jvmTest/kotlin/io/realm/kotlin/test/compiler/TypeAdaptersTests.kt @@ -38,11 +38,11 @@ import kotlin.test.assertTrue * These tests should validate: * - [x] Adapter with a non-realm type should fail * - [x] Adapter annotation on unsupported types: delegate, function etc - * - [ ] Adapter not matching public type * - [x] Adapters type supportness * - [x] Adapters type unsupportness - * - [ ] Instanced and singleton adapters * - [ ] Other annotations Ignore, Index etc + * - [ ] Adapter not matching public type + * - [ ] Instanced and singleton adapters */ class TypeAdaptersTests { // TODO: Can we make it fail when declaring type adapters rather than when we apply them? @@ -59,14 +59,9 @@ class TypeAdaptersTests { import io.realm.kotlin.types.annotations.TypeAdapter class UserType - + class NonRealmType - class TestObject : RealmObject { - @TypeAdapter(adapter = UnsupportedRealmTypeParameter::class) - var userType: UserType = UserType() - } - object UnsupportedRealmTypeParameter : RealmTypeAdapter { override fun fromRealm(realmValue: NonRealmType): UserType = TODO() From 9b97c1391612ad82bc82c1c56aed8e64f048f492 Mon Sep 17 00:00:00 2001 From: Clemente Date: Tue, 12 Dec 2023 00:42:19 +0100 Subject: [PATCH 14/32] More testing --- .../compiler/AccessorModifierIrGeneration.kt | 14 +++- .../kotlin/compiler/RealmPluginContext.kt | 1 + .../kotlin/test/compiler/TypeAdaptersTests.kt | 79 ++++++++++++++----- 3 files changed, 73 insertions(+), 21 deletions(-) diff --git a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/AccessorModifierIrGeneration.kt b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/AccessorModifierIrGeneration.kt index 7ee7149ff4..1862d7826c 100644 --- a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/AccessorModifierIrGeneration.kt +++ b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/AccessorModifierIrGeneration.kt @@ -155,13 +155,17 @@ class AccessorModifierIrGeneration(realmPluginContext: RealmPluginContext): Real val typeAdapterMethodReferences = if(declaration.hasAnnotation(TYPE_ADAPTER_ANNOTATION)) { logDebug("Object property named ${declaration.name} is an adapted type.") + if(declaration.isDelegated) { + logError("Type adapters do not support delegated properties") + } + val adapterClassReference = declaration.getAnnotation(TYPE_ADAPTER_ANNOTATION.asSingleFqName()) .getValueArgument(0)!! as IrClassReference val adapterClass: IrClass = adapterClassReference.classType.getClass()!! // TODO find correct super type adapter type, might be multiple ones because inheritance - val (realmType: IrTypeArgument, userType) = + val (realmType, userType) = adapterClassReference.symbol .superTypes() .first { @@ -172,11 +176,15 @@ class AccessorModifierIrGeneration(realmPluginContext: RealmPluginContext): Real } .arguments .let { arguments -> - arguments[0] to arguments[1] + arguments[0].typeOrNull!! to arguments[1].typeOrNull!! } + if(propertyType.classId != userType.classId) { + // TODO improve messaging + logError("Not matching types") + } // Replace the property type with the one from the type adapter - realmType.typeOrNull.let { actualType -> + realmType.let { actualType -> if(actualType != null) { propertyTypeRaw = actualType propertyType = actualType.makeNotNull() diff --git a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/RealmPluginContext.kt b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/RealmPluginContext.kt index e49c8cda9a..f54e5ad60d 100644 --- a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/RealmPluginContext.kt +++ b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/RealmPluginContext.kt @@ -166,6 +166,7 @@ interface RealmPluginContext { return propertyClassId == mutableRealmIntegerClassId } + // TODO Clean up fun IrType.isValidPersistedType(): Boolean = isRealmAny() || isByteArray() || isString() || diff --git a/packages/test-base/src/jvmTest/kotlin/io/realm/kotlin/test/compiler/TypeAdaptersTests.kt b/packages/test-base/src/jvmTest/kotlin/io/realm/kotlin/test/compiler/TypeAdaptersTests.kt index 624f21c0e2..c241ae57d6 100644 --- a/packages/test-base/src/jvmTest/kotlin/io/realm/kotlin/test/compiler/TypeAdaptersTests.kt +++ b/packages/test-base/src/jvmTest/kotlin/io/realm/kotlin/test/compiler/TypeAdaptersTests.kt @@ -18,7 +18,6 @@ package io.realm.kotlin.test.compiler import com.tschuchort.compiletesting.KotlinCompilation import com.tschuchort.compiletesting.SourceFile -import io.realm.kotlin.internal.interop.CollectionType import io.realm.kotlin.test.util.Compiler.compileFromSource import io.realm.kotlin.test.util.TypeDescriptor.allFieldTypes import io.realm.kotlin.test.util.TypeDescriptor.unsupportedRealmTypeAdaptersClassifiers @@ -40,41 +39,85 @@ import kotlin.test.assertTrue * - [x] Adapter annotation on unsupported types: delegate, function etc * - [x] Adapters type supportness * - [x] Adapters type unsupportness + * - [x] Adapter not matching public type + * - [x] Instanced and singleton adapters * - [ ] Other annotations Ignore, Index etc - * - [ ] Adapter not matching public type - * - [ ] Instanced and singleton adapters */ class TypeAdaptersTests { + + private val typeAdapterTypes = listOf("object", "class") // TODO: Can we make it fail when declaring type adapters rather than when we apply them? @Test - fun `adapters don't support R-types that are not Realm types`() { - val result = compileFromSource( - plugins = listOf(io.realm.kotlin.compiler.Registrar()), - source = SourceFile.kotlin( - "typeAdapter_unsupported_type.kt", - """ + fun `invalid R-type unsupported persisted type`() { + typeAdapterTypes.forEach { type -> + val result = compileFromSource( + plugins = listOf(io.realm.kotlin.compiler.Registrar()), + source = SourceFile.kotlin( + "typeAdapter_unsupported_type.kt", + """ import io.realm.kotlin.types.RealmInstant import io.realm.kotlin.types.RealmObject import io.realm.kotlin.types.RealmTypeAdapter import io.realm.kotlin.types.annotations.TypeAdapter class UserType - + class NonRealmType - object UnsupportedRealmTypeParameter : RealmTypeAdapter { + $type UnsupportedRealmTypeParameter : RealmTypeAdapter { override fun fromRealm(realmValue: NonRealmType): UserType = TODO() override fun toRealm(value: UserType): NonRealmType = TODO() } """.trimIndent() + ) ) - ) - assertEquals(KotlinCompilation.ExitCode.COMPILATION_ERROR, result.exitCode, result.messages) - assertTrue( - result.messages.contains("Invalid type parameter 'NonRealmType', only Realm types are supported"), - result.messages - ) + assertEquals(KotlinCompilation.ExitCode.COMPILATION_ERROR, result.exitCode, result.messages) + assertTrue( + result.messages.contains("Invalid type parameter 'NonRealmType', only Realm types are supported"), + result.messages + ) + } + } + + + @Test + fun `invalid U-type non-matching user-defined type`() { + typeAdapterTypes.forEach { type -> + val result = compileFromSource( + plugins = listOf(io.realm.kotlin.compiler.Registrar()), + source = SourceFile.kotlin( + "typeAdapter_unsupported_type.kt", + """ + import io.realm.kotlin.types.RealmInstant + import io.realm.kotlin.types.RealmObject + import io.realm.kotlin.types.RealmTypeAdapter + import io.realm.kotlin.types.annotations.TypeAdapter + + class UserType + + class OtherUserType + + class TestObject : RealmObject { + @TypeAdapter(adapter = UserTypeAdapter::class) + var userType: OtherUserType = OtherUserType() + } + + $type UserTypeAdapter : RealmTypeAdapter { + override fun fromRealm(realmValue: String): UserType = TODO() + + override fun toRealm(value: UserType): String = TODO() + } + """.trimIndent() + ) + ) + assertEquals( + KotlinCompilation.ExitCode.COMPILATION_ERROR, + result.exitCode, + result.messages + ) + assertTrue(result.messages.contains("Not matching types"), result.messages) + } } @Test @@ -111,7 +154,7 @@ class TypeAdaptersTests { ) assertEquals(KotlinCompilation.ExitCode.COMPILATION_ERROR, result.exitCode, result.messages) assertTrue( - result.messages.contains("Invalid type parameter, only Realm types are supported"), + result.messages.contains("Type adapters do not support delegated properties"), result.messages ) } From e9fd266b4ad481a865ac83addf572fe5d2df05c0 Mon Sep 17 00:00:00 2001 From: Clemente Date: Tue, 12 Dec 2023 00:50:07 +0100 Subject: [PATCH 15/32] Test with other annotations --- .../kotlin/test/compiler/TypeAdaptersTests.kt | 49 ++++++++++++++----- 1 file changed, 37 insertions(+), 12 deletions(-) diff --git a/packages/test-base/src/jvmTest/kotlin/io/realm/kotlin/test/compiler/TypeAdaptersTests.kt b/packages/test-base/src/jvmTest/kotlin/io/realm/kotlin/test/compiler/TypeAdaptersTests.kt index c241ae57d6..e30699687e 100644 --- a/packages/test-base/src/jvmTest/kotlin/io/realm/kotlin/test/compiler/TypeAdaptersTests.kt +++ b/packages/test-base/src/jvmTest/kotlin/io/realm/kotlin/test/compiler/TypeAdaptersTests.kt @@ -41,11 +41,12 @@ import kotlin.test.assertTrue * - [x] Adapters type unsupportness * - [x] Adapter not matching public type * - [x] Instanced and singleton adapters - * - [ ] Other annotations Ignore, Index etc + * - [] Other annotations Ignore, Index etc */ class TypeAdaptersTests { private val typeAdapterTypes = listOf("object", "class") + // TODO: Can we make it fail when declaring type adapters rather than when we apply them? @Test fun `invalid R-type unsupported persisted type`() { @@ -72,7 +73,11 @@ class TypeAdaptersTests { """.trimIndent() ) ) - assertEquals(KotlinCompilation.ExitCode.COMPILATION_ERROR, result.exitCode, result.messages) + assertEquals( + KotlinCompilation.ExitCode.COMPILATION_ERROR, + result.exitCode, + result.messages + ) assertTrue( result.messages.contains("Invalid type parameter 'NonRealmType', only Realm types are supported"), result.messages @@ -185,17 +190,27 @@ class TypeAdaptersTests { val default = if (!elementType.nullable) defaults[elementType.classifier] ?: error("unmapped default") else null - val kotlinLiteral = if(type.elementType.classifier == RealmObject::class) { + val kotlinLiteral = if (type.elementType.classifier == RealmObject::class) { type.toKotlinLiteral().replace("RealmObject", "TestObject2") } else { type.toKotlinLiteral() } - val result = compileFromSource( - plugins = listOf(io.realm.kotlin.compiler.Registrar()), - source = SourceFile.kotlin( - "typeadapter_supportness_$kotlinLiteral.kt", - """ + val additionalAnnotations = mutableSetOf( + "", + """@PersistedName("testing")""" + ).apply { + if (type.isIndexingSupported) add("@Index") + if (type.isPrimaryKeySupported) add("@PrimaryKey") + if (type.isFullTextSupported) add("@FullText") + } + + additionalAnnotations.forEach { annotation -> + val result = compileFromSource( + plugins = listOf(io.realm.kotlin.compiler.Registrar()), + source = SourceFile.kotlin( + "typeadapter_supportness_$kotlinLiteral.kt", + """ import io.realm.kotlin.types.RealmAny import io.realm.kotlin.types.RealmDictionary import io.realm.kotlin.types.RealmList @@ -205,6 +220,10 @@ class TypeAdaptersTests { import io.realm.kotlin.types.RealmObject import io.realm.kotlin.types.RealmTypeAdapter import io.realm.kotlin.types.RealmUUID + import io.realm.kotlin.types.annotations.FullText + import io.realm.kotlin.types.annotations.Index + import io.realm.kotlin.types.annotations.PersistedName + import io.realm.kotlin.types.annotations.PrimaryKey import io.realm.kotlin.types.annotations.TypeAdapter import io.realm.kotlin.types.ObjectId import org.mongodb.kbson.BsonDecimal128 @@ -219,6 +238,7 @@ class TypeAdaptersTests { } class TestObject : RealmObject { + $annotation @TypeAdapter(adapter = ValidRealmTypeAdapter::class) var userType: UserType = UserType() } @@ -229,9 +249,10 @@ class TypeAdaptersTests { override fun toRealm(value: UserType): $kotlinLiteral = TODO() } """.trimIndent() + ) ) - ) - assertEquals(KotlinCompilation.ExitCode.OK, result.exitCode, result.messages) + assertEquals(KotlinCompilation.ExitCode.OK, result.exitCode, result.messages) + } } } @@ -254,7 +275,7 @@ class TypeAdaptersTests { val default = if (!elementType.nullable) defaults[elementType.classifier] ?: error("unmapped default") else null - val kotlinLiteral = if(type.elementType.classifier == RealmObject::class) { + val kotlinLiteral = if (type.elementType.classifier == RealmObject::class) { type.toKotlinLiteral().replace("RealmObject", "TestObject2") } else { type.toKotlinLiteral() @@ -300,7 +321,11 @@ class TypeAdaptersTests { """.trimIndent() ) ) - assertEquals(KotlinCompilation.ExitCode.COMPILATION_ERROR, result.exitCode, result.messages) + assertEquals( + KotlinCompilation.ExitCode.COMPILATION_ERROR, + result.exitCode, + result.messages + ) } } } From 45b1ebec671fa1c407693251f3ddfbe47e0b0fbb Mon Sep 17 00:00:00 2001 From: Clemente Date: Tue, 12 Dec 2023 23:20:27 +0100 Subject: [PATCH 16/32] Add compiler tests for using the annotation on type parameters --- .../kotlin/internal/RealmObjectHelper.kt | 7 +- .../kotlin/types/annotations/TypeAdapter.kt | 2 +- .../compiler/AccessorModifierIrGeneration.kt | 197 +++++++++--------- .../kotlin/entities/adapters/AllTypes.kt | 93 ++++++--- .../kotlin/test/compiler/TypeAdaptersTests.kt | 84 ++++++++ 5 files changed, 252 insertions(+), 131 deletions(-) diff --git a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmObjectHelper.kt b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmObjectHelper.kt index 519d7df9dc..9e9b81dfb3 100644 --- a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmObjectHelper.kt +++ b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmObjectHelper.kt @@ -63,6 +63,7 @@ import io.realm.kotlin.types.RealmInstant import io.realm.kotlin.types.RealmList import io.realm.kotlin.types.RealmObject import io.realm.kotlin.types.RealmSet +import io.realm.kotlin.types.RealmTypeAdapter import io.realm.kotlin.types.RealmUUID import io.realm.kotlin.types.TypedRealmObject import org.mongodb.kbson.BsonObjectId @@ -366,7 +367,8 @@ internal object RealmObjectHelper { @Suppress("unused") // Called from generated code internal inline fun getList( obj: RealmObjectReference, - propertyName: String + propertyName: String, + typeAdapter: RealmTypeAdapter? = null, ): ManagedRealmList { val elementType: KClass = R::class val realmObjectCompanion = elementType.realmObjectCompanionOrNull() @@ -667,7 +669,8 @@ internal object RealmObjectHelper { col: String, list: RealmList, updatePolicy: UpdatePolicy = UpdatePolicy.ALL, - cache: UnmanagedToManagedObjectCache = mutableMapOf() + cache: UnmanagedToManagedObjectCache = mutableMapOf(), + typeAdapter: RealmTypeAdapter? = null, ) { val existingList = getList(obj, col) if (list !is ManagedRealmList || !RealmInterop.realm_equals( diff --git a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/types/annotations/TypeAdapter.kt b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/types/annotations/TypeAdapter.kt index ff38cd015a..9ecdce8a3b 100644 --- a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/types/annotations/TypeAdapter.kt +++ b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/types/annotations/TypeAdapter.kt @@ -20,7 +20,7 @@ import io.realm.kotlin.types.RealmTypeAdapter import kotlin.reflect.KClass @Retention(AnnotationRetention.SOURCE) -@Target(AnnotationTarget.PROPERTY, AnnotationTarget.CLASS) +@Target(AnnotationTarget.PROPERTY, AnnotationTarget.CLASS, AnnotationTarget.TYPE) @MustBeDocumented /** * TODO diff --git a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/AccessorModifierIrGeneration.kt b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/AccessorModifierIrGeneration.kt index 1862d7826c..65df8cf4f9 100644 --- a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/AccessorModifierIrGeneration.kt +++ b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/AccessorModifierIrGeneration.kt @@ -44,6 +44,7 @@ import org.jetbrains.kotlin.ir.declarations.IrValueParameter import org.jetbrains.kotlin.ir.descriptors.toIrBasedKotlinType import org.jetbrains.kotlin.ir.expressions.IrCall import org.jetbrains.kotlin.ir.expressions.IrClassReference +import org.jetbrains.kotlin.ir.expressions.IrConstructorCall import org.jetbrains.kotlin.ir.expressions.IrDeclarationReference import org.jetbrains.kotlin.ir.expressions.IrFunctionAccessExpression import org.jetbrains.kotlin.ir.expressions.IrGetValue @@ -54,6 +55,7 @@ import org.jetbrains.kotlin.ir.types.IrSimpleType import org.jetbrains.kotlin.ir.types.IrStarProjection import org.jetbrains.kotlin.ir.types.IrType import org.jetbrains.kotlin.ir.types.IrTypeArgument +import org.jetbrains.kotlin.ir.types.classFqName import org.jetbrains.kotlin.ir.types.getClass import org.jetbrains.kotlin.ir.types.impl.IrAbstractSimpleType import org.jetbrains.kotlin.ir.types.impl.IrSimpleTypeImpl @@ -68,11 +70,13 @@ import org.jetbrains.kotlin.ir.types.isLong import org.jetbrains.kotlin.ir.types.isNullable import org.jetbrains.kotlin.ir.types.isShort import org.jetbrains.kotlin.ir.types.isString +import org.jetbrains.kotlin.ir.types.isSubtypeOf import org.jetbrains.kotlin.ir.types.isSubtypeOfClass import org.jetbrains.kotlin.ir.types.makeNotNull import org.jetbrains.kotlin.ir.types.superTypes import org.jetbrains.kotlin.ir.types.typeOrNull import org.jetbrains.kotlin.ir.util.defaultType +import org.jetbrains.kotlin.ir.util.findAnnotation import org.jetbrains.kotlin.ir.util.parentAsClass import org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid import org.jetbrains.kotlin.ir.visitors.transformChildrenVoid @@ -99,6 +103,26 @@ class AccessorModifierIrGeneration(realmPluginContext: RealmPluginContext): Real val fromPublic: (IrBuilderWithScope.(IrGetValue, IrGetValue)->IrDeclarationReference), ) + fun IrConstructorCall.getTypeAdapterTypes(): Triple = + (getValueArgument(0)!! as IrClassReference).let { adapterClassReference -> + adapterClassReference.symbol + .superTypes() + .first { + it.classId == ClassIds.REALM_TYPE_ADAPTER_INTERFACE + } + .let { + it as IrSimpleType + } + .arguments + .let { arguments -> + Triple( + adapterClassReference, + arguments[0].typeOrNull!!, + arguments[1].typeOrNull!! + ) + } + } + fun modifyPropertiesAndCollectSchema(irClass: IrClass) { logDebug("Processing class ${irClass.name}") val fields = SchemaCollector.properties @@ -159,45 +183,23 @@ class AccessorModifierIrGeneration(realmPluginContext: RealmPluginContext): Real logError("Type adapters do not support delegated properties") } - val adapterClassReference = - declaration.getAnnotation(TYPE_ADAPTER_ANNOTATION.asSingleFqName()) - .getValueArgument(0)!! as IrClassReference + val (adapterClassReference, realmType, userType) = declaration + .getAnnotation(TYPE_ADAPTER_ANNOTATION.asSingleFqName()) + .getTypeAdapterTypes() + val adapterClass: IrClass = adapterClassReference.classType.getClass()!! - // TODO find correct super type adapter type, might be multiple ones because inheritance - val (realmType, userType) = - adapterClassReference.symbol - .superTypes() - .first { - it.classId == ClassIds.REALM_TYPE_ADAPTER_INTERFACE - } - .let { - it as IrSimpleType - } - .arguments - .let { arguments -> - arguments[0].typeOrNull!! to arguments[1].typeOrNull!! - } if(propertyType.classId != userType.classId) { // TODO improve messaging - logError("Not matching types") + logError("Not matching types 1") } // Replace the property type with the one from the type adapter - realmType.let { actualType -> - if(actualType != null) { - propertyTypeRaw = actualType - propertyType = actualType.makeNotNull() - if(!propertyType.isValidPersistedType()) { - // TODO improve messaging - logError("Unsupported Realm storage type. Use a valid type` instead", declaration.locationOf()) - } - nullable = actualType.isNullable() - } else { - logError("Could not retrieve the storage type.") - } - } + propertyTypeRaw = realmType + propertyType = realmType.makeNotNull() + nullable = realmType.isNullable() + // Generate the conversion calls based on whether the adapter is singleton or not. when (adapterClass.kind) { ClassKind.CLASS -> { TypeAdapterMethodReferences( @@ -750,18 +752,9 @@ class AccessorModifierIrGeneration(realmPluginContext: RealmPluginContext): Real propertyTypeRaw: IrType, typeAdapterMethodReferences: TypeAdapterMethodReferences?, ) { - val type: IrType = - typeAdapterMethodReferences?.propertyType - ?: declaration.backingField!!.type + val collectionTypeArgument = (propertyTypeRaw as IrSimpleTypeImpl).arguments[0] - val collectionGenericType = (type as IrSimpleTypeImpl).arguments[0] - - if(typeAdapterMethodReferences != null && !collectionGenericType.typeOrNull!!.makeNotNull().isValidPersistedType()) { - // TODO improve messaging - logError("Unsupported Realm storage type. Use a valid type instead", declaration.locationOf()) - } - - if (collectionGenericType is IrStarProjection) { + if (collectionTypeArgument is IrStarProjection) { logError( "Error in field ${declaration.name} - ${collectionType.description} cannot use a '*' projection.", declaration.locationOf() @@ -769,10 +762,37 @@ class AccessorModifierIrGeneration(realmPluginContext: RealmPluginContext): Real return } - val coreGenericTypes = getCollectionGenericCoreType(collectionType, declaration, type.kotlinType!!) + var collectionIrType = collectionTypeArgument.typeOrNull!! + + // if not null the type would need to be adapted + val typeAdapterAnnotation = collectionIrType + .annotations + .findAnnotation(TYPE_ADAPTER_ANNOTATION.asSingleFqName()) + + typeAdapterAnnotation?.let { + val (adapterClassReference, realmType, userType) = it.getTypeAdapterTypes() + + val adapterClass: IrClass = adapterClassReference.classType.getClass()!! + + if(collectionIrType.classId != userType.classId) { + // TODO improve messaging + logError("Not matching types ${collectionIrType.classFqName} ${userType.classFqName}") + } + + // Replace the property type with the one from the type adapter + collectionIrType = realmType + } + + val coreGenericTypes = getCollectionGenericCoreType( + collectionType = collectionType, + declaration = declaration, + descriptorType = propertyTypeRaw, + collectionGenericType = collectionIrType, + ) + // Only process field if we got valid generics if (coreGenericTypes != null) { - val genericPropertyType = getPropertyTypeFromKotlinType(collectionGenericType.typeOrNull!!.toIrBasedKotlinType()) + val genericPropertyType = getPropertyTypeFromKotlinType(collectionIrType) // Only process if (genericPropertyType != null) { @@ -1011,15 +1031,14 @@ class AccessorModifierIrGeneration(realmPluginContext: RealmPluginContext): Real private fun getCollectionGenericCoreType( collectionType: CollectionType, declaration: IrProperty, - descriptorType: KotlinType, + descriptorType: IrType, + collectionGenericType: IrType, ): CoreType? { // Check first if the generic is a subclass of RealmObject - val collectionGenericType: KotlinType = descriptorType.arguments[0].type - - val supertypes = collectionGenericType.constructor.supertypes - val isEmbedded = inheritsFromRealmObject(supertypes, RealmObjectType.EMBEDDED) + val isRealmObject = collectionGenericType.isSubtypeOfClass(realmObjectInterface) + val isEmbedded = collectionGenericType.isSubtypeOfClass(embeddedRealmObjectInterface) - if (inheritsFromRealmObject(supertypes)) { + if (isRealmObject || isEmbedded) { // No embedded objects for sets if (collectionType == CollectionType.SET && isEmbedded) { logError( @@ -1064,18 +1083,17 @@ class AccessorModifierIrGeneration(realmPluginContext: RealmPluginContext): Real // If not a RealmObject, check whether the collection itself is nullable - if so, throw error if (descriptorType.isNullable()) { logError( - "Error in field ${declaration.name} - a ${collectionType.description} field cannot be marked as nullable.", + "Error in field ${declaration.name} - a ${collectionType.description} field cannot be marked as nullable. ${descriptorType.classFqName}", declaration.locationOf() ) return null } // Otherwise just return the matching core type present in the declaration - val genericPropertyType: PropertyType? = getPropertyTypeFromKotlinType(collectionGenericType) + val genericPropertyType: PropertyType? = getPropertyTypeFromKotlinType(collectionGenericType.makeNotNull()) return if (genericPropertyType == null) { logError( - "Unsupported type for ${collectionType.description}: '${collectionGenericType.getKotlinTypeFqNameCompat(true) - }'", + "Unsupported type for ${collectionType.description}: '${collectionGenericType.classFqName}'", declaration.locationOf() ) null @@ -1095,51 +1113,32 @@ class AccessorModifierIrGeneration(realmPluginContext: RealmPluginContext): Real // TODO do the lookup only once @Suppress("ComplexMethod") - private fun getPropertyTypeFromKotlinType(type: KotlinType): PropertyType? { - return type.constructor.declarationDescriptor - ?.name - ?.let { identifier -> - when (identifier.toString()) { - "Byte" -> PropertyType.RLM_PROPERTY_TYPE_INT - "Char" -> PropertyType.RLM_PROPERTY_TYPE_INT - "Short" -> PropertyType.RLM_PROPERTY_TYPE_INT - "Int" -> PropertyType.RLM_PROPERTY_TYPE_INT - "Long" -> PropertyType.RLM_PROPERTY_TYPE_INT - "Boolean" -> PropertyType.RLM_PROPERTY_TYPE_BOOL - "Float" -> PropertyType.RLM_PROPERTY_TYPE_FLOAT - "Double" -> PropertyType.RLM_PROPERTY_TYPE_DOUBLE - "String" -> PropertyType.RLM_PROPERTY_TYPE_STRING - "RealmInstant" -> PropertyType.RLM_PROPERTY_TYPE_TIMESTAMP - "ObjectId" -> PropertyType.RLM_PROPERTY_TYPE_OBJECT_ID - "BsonObjectId" -> PropertyType.RLM_PROPERTY_TYPE_OBJECT_ID - "BsonDecimal128" -> PropertyType.RLM_PROPERTY_TYPE_DECIMAL128 - "RealmUUID" -> PropertyType.RLM_PROPERTY_TYPE_UUID - "ByteArray" -> PropertyType.RLM_PROPERTY_TYPE_BINARY - "RealmAny" -> PropertyType.RLM_PROPERTY_TYPE_MIXED - else -> - if (inheritsFromRealmObject(type.supertypes())) { - PropertyType.RLM_PROPERTY_TYPE_OBJECT - } else { - null - } + private fun getPropertyTypeFromKotlinType(type: IrType): PropertyType? = + when { + type.isByte() -> PropertyType.RLM_PROPERTY_TYPE_INT + type.isChar() -> PropertyType.RLM_PROPERTY_TYPE_INT + type.isShort() -> PropertyType.RLM_PROPERTY_TYPE_INT + type.isInt() -> PropertyType.RLM_PROPERTY_TYPE_INT + type.isLong() -> PropertyType.RLM_PROPERTY_TYPE_INT + type.isBoolean() -> PropertyType.RLM_PROPERTY_TYPE_BOOL + type.isFloat() -> PropertyType.RLM_PROPERTY_TYPE_FLOAT + type.isDouble() -> PropertyType.RLM_PROPERTY_TYPE_DOUBLE + type.isString() -> PropertyType.RLM_PROPERTY_TYPE_STRING + type.isRealmInstant() -> PropertyType.RLM_PROPERTY_TYPE_TIMESTAMP + type.isObjectId() -> PropertyType.RLM_PROPERTY_TYPE_OBJECT_ID + type.isRealmObjectId() -> PropertyType.RLM_PROPERTY_TYPE_OBJECT_ID + type.isDecimal128() -> PropertyType.RLM_PROPERTY_TYPE_DECIMAL128 + type.isRealmUUID() -> PropertyType.RLM_PROPERTY_TYPE_UUID + type.isByteArray() -> PropertyType.RLM_PROPERTY_TYPE_BINARY + type.isRealmAny() -> PropertyType.RLM_PROPERTY_TYPE_MIXED + else -> + if ( + type.isSubtypeOfClass(realmObjectInterface) || + type.isSubtypeOfClass(embeddedRealmObjectInterface) + ) { + PropertyType.RLM_PROPERTY_TYPE_OBJECT + } else { + null } - } - } - - // Check if the class in question inherits from RealmObject, EmbeddedRealmObject or either - private fun inheritsFromRealmObject( - supertypes: Collection, - objectType: RealmObjectType = RealmObjectType.EITHER - ): Boolean = supertypes.any { - val objectFqNames: Set = when (objectType) { - RealmObjectType.OBJECT -> realmObjectInterfaceFqNames - RealmObjectType.EMBEDDED -> realmEmbeddedObjectInterfaceFqNames - RealmObjectType.EITHER -> realmObjectInterfaceFqNames + realmEmbeddedObjectInterfaceFqNames } - it.constructor.declarationDescriptor?.classId in objectFqNames - } -} - -private enum class RealmObjectType { - OBJECT, EMBEDDED, EITHER } diff --git a/packages/test-base/src/commonMain/kotlin/io/realm/kotlin/entities/adapters/AllTypes.kt b/packages/test-base/src/commonMain/kotlin/io/realm/kotlin/entities/adapters/AllTypes.kt index ed6de75148..fdfd189c9c 100644 --- a/packages/test-base/src/commonMain/kotlin/io/realm/kotlin/entities/adapters/AllTypes.kt +++ b/packages/test-base/src/commonMain/kotlin/io/realm/kotlin/entities/adapters/AllTypes.kt @@ -91,7 +91,8 @@ class AllTypes : RealmObject { @TypeAdapter(StringRealmListAdapter::class) var stringListField: RealmList = realmListOf() -// var byteListField: RealmList = realmListOf() + + // var byteListField: RealmList = realmListOf() // var charListField: RealmList = realmListOf() // var shortListField: RealmList = realmListOf() // var intListField: RealmList = realmListOf() @@ -124,7 +125,7 @@ class AllTypes : RealmObject { // var nullableDecimal128ListField: RealmList = realmListOf() // var nullableRealmAnyListField: RealmList = realmListOf() // -@TypeAdapter(StringRealmSetAdapter::class) + @TypeAdapter(StringRealmSetAdapter::class) var stringSetField: RealmSet = realmSetOf() // var byteSetField: RealmSet = realmSetOf() // var charSetField: RealmSet = realmSetOf() @@ -162,7 +163,8 @@ class AllTypes : RealmObject { @TypeAdapter(StringRealmDictionaryAdapter::class) var stringDictionaryField: RealmDictionary = realmDictionaryOf() -// var byteDictionaryField: RealmDictionary = realmDictionaryOf() + + // var byteDictionaryField: RealmDictionary = realmDictionaryOf() // var charDictionaryField: RealmDictionary = realmDictionaryOf() // var shortDictionaryField: RealmDictionary = realmDictionaryOf() // var intDictionaryField: RealmDictionary = realmDictionaryOf() @@ -212,6 +214,7 @@ class AllTypes : RealmObject { // fun stringFieldSetter(s: String) { // stringField = s // } + var adaptedStringListField: RealmList<@TypeAdapter(StringAdapter::class) String> = realmListOf() companion object { // Empty object required by SampleTests @@ -251,6 +254,7 @@ class AllTypes : RealmObject { if (stringListField != other.stringListField) return false if (stringSetField != other.stringSetField) return false if (stringDictionaryField != other.stringDictionaryField) return false + if (adaptedStringListField != other.adaptedStringListField) return false return true } @@ -281,8 +285,10 @@ class AllTypes : RealmObject { result = 31 * result + stringListField.hashCode() result = 31 * result + stringSetField.hashCode() result = 31 * result + stringDictionaryField.hashCode() + result = 31 * result + adaptedStringListField.hashCode() return result } + } // Passthrough converters @@ -311,25 +317,32 @@ object DoubleAdapter : RealmTypeAdapter { } object Decimal128Adapter : RealmTypeAdapter { - override fun fromRealm(realmValue: Decimal128): Decimal128 = Decimal128.fromIEEE754BIDEncoding(realmValue.high, realmValue.low) + override fun fromRealm(realmValue: Decimal128): Decimal128 = + Decimal128.fromIEEE754BIDEncoding(realmValue.high, realmValue.low) - override fun toRealm(value: Decimal128): Decimal128 = Decimal128.fromIEEE754BIDEncoding(value.high, value.low) + override fun toRealm(value: Decimal128): Decimal128 = + Decimal128.fromIEEE754BIDEncoding(value.high, value.low) } object TimestampAdapter : RealmTypeAdapter { - override fun fromRealm(realmValue: RealmInstant): RealmInstant = RealmInstant.from(realmValue.epochSeconds, realmValue.nanosecondsOfSecond) + override fun fromRealm(realmValue: RealmInstant): RealmInstant = + RealmInstant.from(realmValue.epochSeconds, realmValue.nanosecondsOfSecond) - override fun toRealm(value: RealmInstant): RealmInstant = RealmInstant.from(value.epochSeconds, value.nanosecondsOfSecond) + override fun toRealm(value: RealmInstant): RealmInstant = + RealmInstant.from(value.epochSeconds, value.nanosecondsOfSecond) } object ObjectIdAdapter : RealmTypeAdapter { - override fun fromRealm(realmValue: ObjectId): ObjectId = ObjectId.from(realmValue.asBsonObjectId().toHexString()) + override fun fromRealm(realmValue: ObjectId): ObjectId = + ObjectId.from(realmValue.asBsonObjectId().toHexString()) - override fun toRealm(value: ObjectId): ObjectId = ObjectId.from(value.asBsonObjectId().toHexString()) + override fun toRealm(value: ObjectId): ObjectId = + ObjectId.from(value.asBsonObjectId().toHexString()) } object BsonObjectIdAdapter : RealmTypeAdapter { - override fun fromRealm(realmValue: BsonObjectId): BsonObjectId = BsonObjectId(realmValue.toHexString()) + override fun fromRealm(realmValue: BsonObjectId): BsonObjectId = + BsonObjectId(realmValue.toHexString()) override fun toRealm(value: BsonObjectId): BsonObjectId = BsonObjectId(value.toHexString()) } @@ -372,43 +385,58 @@ object NullableDoubleAdapter : RealmTypeAdapter { } object NullableDecimal128Adapter : RealmTypeAdapter { - override fun fromRealm(realmValue: Decimal128?): Decimal128? = realmValue?.let { Decimal128.fromIEEE754BIDEncoding(realmValue.high, realmValue.low) } + override fun fromRealm(realmValue: Decimal128?): Decimal128? = + realmValue?.let { Decimal128.fromIEEE754BIDEncoding(realmValue.high, realmValue.low) } - override fun toRealm(value: Decimal128?): Decimal128? = value?.let { Decimal128.fromIEEE754BIDEncoding(value.high, value.low) } + override fun toRealm(value: Decimal128?): Decimal128? = + value?.let { Decimal128.fromIEEE754BIDEncoding(value.high, value.low) } } object NullableTimestampAdapter : RealmTypeAdapter { - override fun fromRealm(realmValue: RealmInstant?): RealmInstant? = realmValue?.let { RealmInstant.from(realmValue.epochSeconds, realmValue.nanosecondsOfSecond) } + override fun fromRealm(realmValue: RealmInstant?): RealmInstant? = realmValue?.let { + RealmInstant.from( + realmValue.epochSeconds, + realmValue.nanosecondsOfSecond + ) + } - override fun toRealm(value: RealmInstant?): RealmInstant? = value?.let { RealmInstant.from(value.epochSeconds, value.nanosecondsOfSecond) } + override fun toRealm(value: RealmInstant?): RealmInstant? = + value?.let { RealmInstant.from(value.epochSeconds, value.nanosecondsOfSecond) } } object NullableObjectIdAdapter : RealmTypeAdapter { - override fun fromRealm(realmValue: ObjectId?): ObjectId? = realmValue?.let { ObjectId.from(realmValue.asBsonObjectId().toHexString()) } + override fun fromRealm(realmValue: ObjectId?): ObjectId? = + realmValue?.let { ObjectId.from(realmValue.asBsonObjectId().toHexString()) } - override fun toRealm(value: ObjectId?): ObjectId? = value?.let { ObjectId.from(value.asBsonObjectId().toHexString()) } + override fun toRealm(value: ObjectId?): ObjectId? = + value?.let { ObjectId.from(value.asBsonObjectId().toHexString()) } } object NullableBsonObjectIdAdapter : RealmTypeAdapter { - override fun fromRealm(realmValue: BsonObjectId?): BsonObjectId? = realmValue?.let { BsonObjectId(realmValue.toHexString()) } + override fun fromRealm(realmValue: BsonObjectId?): BsonObjectId? = + realmValue?.let { BsonObjectId(realmValue.toHexString()) } - override fun toRealm(value: BsonObjectId?): BsonObjectId? = value?.let { BsonObjectId(value.toHexString()) } + override fun toRealm(value: BsonObjectId?): BsonObjectId? = + value?.let { BsonObjectId(value.toHexString()) } } object NullableUuidAdapter : RealmTypeAdapter { - override fun fromRealm(realmValue: RealmUUID?): RealmUUID? = realmValue?.let { RealmUUID.from(realmValue.bytes) } + override fun fromRealm(realmValue: RealmUUID?): RealmUUID? = + realmValue?.let { RealmUUID.from(realmValue.bytes) } override fun toRealm(value: RealmUUID?): RealmUUID? = value?.let { RealmUUID.from(value.bytes) } } object NullableBinaryAdapter : RealmTypeAdapter { - override fun fromRealm(realmValue: ByteArray?): ByteArray? = realmValue?.let { realmValue.copyOf() } + override fun fromRealm(realmValue: ByteArray?): ByteArray? = + realmValue?.let { realmValue.copyOf() } override fun toRealm(value: ByteArray?): ByteArray? = value?.let { value.copyOf() } } object RealmAnyAdapter : RealmTypeAdapter { - override fun fromRealm(realmValue: RealmAny?): RealmAny? = realmValue?.let { realmValue.clone() } + override fun fromRealm(realmValue: RealmAny?): RealmAny? = + realmValue?.let { realmValue.clone() } override fun toRealm(value: RealmAny?): RealmAny? = value?.let { value.clone() } } @@ -420,24 +448,31 @@ object AllTypesObjectAdapter : RealmTypeAdapter { } object StringRealmListAdapter : RealmTypeAdapter, RealmList> { - override fun fromRealm(realmValue: RealmList): RealmList = realmListOf().apply { addAll(realmValue) } + override fun fromRealm(realmValue: RealmList): RealmList = + realmListOf().apply { addAll(realmValue) } - override fun toRealm(value: RealmList): RealmList = realmListOf().apply { addAll(value) } + override fun toRealm(value: RealmList): RealmList = + realmListOf().apply { addAll(value) } } object StringRealmSetAdapter : RealmTypeAdapter, RealmSet> { - override fun fromRealm(realmValue: RealmSet): RealmSet = realmSetOf().apply { addAll(realmValue) } + override fun fromRealm(realmValue: RealmSet): RealmSet = + realmSetOf().apply { addAll(realmValue) } - override fun toRealm(value: RealmSet): RealmSet = realmSetOf().apply { addAll(value) } + override fun toRealm(value: RealmSet): RealmSet = + realmSetOf().apply { addAll(value) } } -object StringRealmDictionaryAdapter : RealmTypeAdapter, RealmDictionary> { - override fun fromRealm(realmValue: RealmDictionary): RealmDictionary = realmDictionaryOf().apply { putAll(realmValue) } +object StringRealmDictionaryAdapter : + RealmTypeAdapter, RealmDictionary> { + override fun fromRealm(realmValue: RealmDictionary): RealmDictionary = + realmDictionaryOf().apply { putAll(realmValue) } - override fun toRealm(value: RealmDictionary): RealmDictionary = realmDictionaryOf().apply { putAll(value) } + override fun toRealm(value: RealmDictionary): RealmDictionary = + realmDictionaryOf().apply { putAll(value) } } -internal fun RealmAny.clone() = when(type) { +internal fun RealmAny.clone() = when (type) { RealmAny.Type.INT -> RealmAny.create(asInt()) RealmAny.Type.BOOL -> RealmAny.create(asBoolean()) RealmAny.Type.STRING -> RealmAny.create(asString()) diff --git a/packages/test-base/src/jvmTest/kotlin/io/realm/kotlin/test/compiler/TypeAdaptersTests.kt b/packages/test-base/src/jvmTest/kotlin/io/realm/kotlin/test/compiler/TypeAdaptersTests.kt index e30699687e..479670f185 100644 --- a/packages/test-base/src/jvmTest/kotlin/io/realm/kotlin/test/compiler/TypeAdaptersTests.kt +++ b/packages/test-base/src/jvmTest/kotlin/io/realm/kotlin/test/compiler/TypeAdaptersTests.kt @@ -18,6 +18,7 @@ package io.realm.kotlin.test.compiler import com.tschuchort.compiletesting.KotlinCompilation import com.tschuchort.compiletesting.SourceFile +import io.realm.kotlin.internal.interop.CollectionType import io.realm.kotlin.test.util.Compiler.compileFromSource import io.realm.kotlin.test.util.TypeDescriptor.allFieldTypes import io.realm.kotlin.test.util.TypeDescriptor.unsupportedRealmTypeAdaptersClassifiers @@ -42,6 +43,7 @@ import kotlin.test.assertTrue * - [x] Adapter not matching public type * - [x] Instanced and singleton adapters * - [] Other annotations Ignore, Index etc + * TODO: Rename generated file names */ class TypeAdaptersTests { @@ -328,4 +330,86 @@ class TypeAdaptersTests { ) } } + + @Test + fun `apply annotation to type parameter`() { + allFieldTypes + .filterNot { type -> + type.elementType.classifier in unsupportedRealmTypeAdaptersClassifiers + } + .filterNot { type -> + type.collectionType == CollectionType.RLM_COLLECTION_TYPE_NONE + } + .forEach { type -> + val default = when(type.collectionType) { + CollectionType.RLM_COLLECTION_TYPE_NONE -> error("Outside of testing scope") + CollectionType.RLM_COLLECTION_TYPE_LIST -> "RealmList<@TypeAdapter(ValidRealmTypeAdapter::class) UserType> = realmListOf()" + CollectionType.RLM_COLLECTION_TYPE_SET -> "RealmSet<@TypeAdapter(ValidRealmTypeAdapter::class) UserType> = realmSetOf()" + CollectionType.RLM_COLLECTION_TYPE_DICTIONARY -> "RealmDictionary<@TypeAdapter(ValidRealmTypeAdapter::class) UserType> = realmDictionaryOf()" + else -> error("Unmapped type") + } + + val adapterType = when (type.elementType.classifier) { + RealmObject::class -> "TestObject2${if(type.elementType.nullable) "?" else ""}" + else -> type.copy( + collectionType = CollectionType.RLM_COLLECTION_TYPE_NONE + ).toKotlinLiteral() + } + + val additionalAnnotations = mutableSetOf( + "", + """@PersistedName("testing")""" + ) + + additionalAnnotations.forEach { annotation -> + val result = compileFromSource( + plugins = listOf(io.realm.kotlin.compiler.Registrar()), + source = SourceFile.kotlin( + "typeadapter_supportness_$adapterType.kt", + """ + import io.realm.kotlin.ext.realmDictionaryOf + import io.realm.kotlin.ext.realmListOf + import io.realm.kotlin.ext.realmSetOf + import io.realm.kotlin.types.RealmAny + import io.realm.kotlin.types.RealmDictionary + import io.realm.kotlin.types.RealmList + import io.realm.kotlin.types.RealmSet + import io.realm.kotlin.types.RealmInstant + import io.realm.kotlin.types.MutableRealmInt + import io.realm.kotlin.types.RealmObject + import io.realm.kotlin.types.RealmTypeAdapter + import io.realm.kotlin.types.RealmUUID + import io.realm.kotlin.types.annotations.FullText + import io.realm.kotlin.types.annotations.Index + import io.realm.kotlin.types.annotations.PersistedName + import io.realm.kotlin.types.annotations.PrimaryKey + import io.realm.kotlin.types.annotations.TypeAdapter + import io.realm.kotlin.types.ObjectId + import org.mongodb.kbson.BsonDecimal128 + import org.mongodb.kbson.BsonObjectId + + class UserType + + class TestObject2: RealmObject { + var field: String = "" + } + + class TestObject : RealmObject { + $annotation + var userType: $default + } + + object ValidRealmTypeAdapter : RealmTypeAdapter<$adapterType, UserType> { + override fun fromRealm(realmValue: $adapterType): UserType = TODO() + + override fun toRealm(value: UserType): $adapterType = TODO() + } + """.trimIndent() + ) + ) + assertEquals(KotlinCompilation.ExitCode.OK, result.exitCode, result.messages) + } + } + + } } From 4f6cf36256c62d90d1d60538f8e924f66a6469c6 Mon Sep 17 00:00:00 2001 From: Clemente Date: Tue, 19 Dec 2023 18:15:09 +0100 Subject: [PATCH 17/32] Add type parameter adapter for lists --- .../io/realm/kotlin/internal/Converters.kt | 25 ++--- .../kotlin/internal/RealmListInternal.kt | 42 ++++++++ .../kotlin/internal/RealmObjectHelper.kt | 102 ++++++++++-------- .../compiler/AccessorModifierIrGeneration.kt | 70 +++++++++--- .../kotlin/compiler/RealmPluginContext.kt | 5 + 5 files changed, 171 insertions(+), 73 deletions(-) diff --git a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/Converters.kt b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/Converters.kt index 514211ab46..d9057d6654 100644 --- a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/Converters.kt +++ b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/Converters.kt @@ -260,35 +260,28 @@ internal object IntConverter : CoreIntConverter, CompositeConverter() public inline fun intToLong(value: Int?): Long? = value?.toLong() public inline fun longToInt(value: Long?): Int? = value?.toInt() -public inline fun toRealm( +public fun getTypeAdapter( obj: RealmObjectReference, adapterClass: KClass<*>, - userValue: Any?, -): Any? { - val adapter = obj.owner.owner +): RealmTypeAdapter = + obj.owner.owner .configuration .typeAdapterMap.let { adapters -> require(adapters.contains(adapterClass)) {"User provided adaptes don't contains adapter ${adapterClass.simpleName}"} adapters[adapterClass] as RealmTypeAdapter } - return adapter.toRealm(userValue) -} +public inline fun toRealm( + obj: RealmObjectReference, + adapterClass: KClass<*>, + userValue: Any?, +): Any? = getTypeAdapter(obj, adapterClass).toRealm(userValue) public inline fun fromRealm( obj: RealmObjectReference, adapterClass: KClass<*>, realmValue: Any, -): Any? { - val adapter = obj.owner.owner - .configuration - .typeAdapterMap.let { adapters -> - require(adapters.contains(adapterClass)) {"User provided adaptes don't contains adapter ${adapterClass.simpleName}"} - adapters[adapterClass] as RealmTypeAdapter - } - - return adapter.fromRealm(realmValue) -} +): Any? = getTypeAdapter(obj, adapterClass).fromRealm(realmValue) internal object RealmInstantConverter : PassThroughPublicConverter() { override inline fun fromRealmValue(realmValue: RealmValue): RealmInstant? = diff --git a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmListInternal.kt b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmListInternal.kt index 8f1e60a0a7..124dc95291 100644 --- a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmListInternal.kt +++ b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmListInternal.kt @@ -21,6 +21,7 @@ import io.realm.kotlin.Versioned import io.realm.kotlin.internal.RealmValueArgumentConverter.convertToQueryArgs import io.realm.kotlin.internal.interop.Callback import io.realm.kotlin.internal.interop.ClassKey +import io.realm.kotlin.internal.interop.MemTrackingAllocator import io.realm.kotlin.internal.interop.RealmChangesPointer import io.realm.kotlin.internal.interop.RealmInterop import io.realm.kotlin.internal.interop.RealmInterop.realm_list_get @@ -29,6 +30,7 @@ import io.realm.kotlin.internal.interop.RealmKeyPathArrayPointer import io.realm.kotlin.internal.interop.RealmListPointer import io.realm.kotlin.internal.interop.RealmNotificationTokenPointer import io.realm.kotlin.internal.interop.RealmObjectInterop +import io.realm.kotlin.internal.interop.RealmValue import io.realm.kotlin.internal.interop.getterScope import io.realm.kotlin.internal.interop.inputScope import io.realm.kotlin.internal.query.ObjectBoundQuery @@ -41,6 +43,7 @@ import io.realm.kotlin.notifications.internal.UpdatedListImpl import io.realm.kotlin.query.RealmQuery import io.realm.kotlin.types.BaseRealmObject import io.realm.kotlin.types.RealmList +import io.realm.kotlin.types.RealmTypeAdapter import kotlinx.coroutines.channels.ProducerScope import kotlinx.coroutines.flow.Flow import kotlin.reflect.KClass @@ -249,6 +252,45 @@ internal interface ListOperator : CollectionOperator { fun copy(realmReference: RealmReference, nativePointer: RealmListPointer): ListOperator } +internal class TypeAdaptedListOperator( + private val listOperator: ListOperator, + private val typeAdapter: RealmTypeAdapter +): ListOperator { + override val nativePointer: RealmListPointer by listOperator::nativePointer + override val mediator: Mediator by listOperator::mediator + override val realmReference: RealmReference by listOperator::realmReference + override val valueConverter: RealmValueConverter = object : RealmValueConverter { + override fun MemTrackingAllocator.publicToRealmValue(value: E?): RealmValue { + TODO("Not yet implemented") + } + + override fun realmValueToPublic(realmValue: RealmValue): E? { + TODO("Not yet implemented") + } + } + + override fun get(index: Int): E = typeAdapter.fromRealm(listOperator.get(index)) + + override fun copy( + realmReference: RealmReference, + nativePointer: RealmListPointer, + ): ListOperator = TypeAdaptedListOperator(listOperator.copy(realmReference, nativePointer), typeAdapter) + + override fun set( + index: Int, + element: E, + updatePolicy: UpdatePolicy, + cache: UnmanagedToManagedObjectCache, + ): E = typeAdapter.fromRealm(listOperator.set(index, typeAdapter.toRealm(element), updatePolicy, cache)) + + override fun insert( + index: Int, + element: E, + updatePolicy: UpdatePolicy, + cache: UnmanagedToManagedObjectCache, + ) = listOperator.insert(index, typeAdapter.toRealm(element), updatePolicy, cache) +} + internal class PrimitiveListOperator( override val mediator: Mediator, override val realmReference: RealmReference, diff --git a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmObjectHelper.kt b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmObjectHelper.kt index 9e9b81dfb3..974a0befcc 100644 --- a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmObjectHelper.kt +++ b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmObjectHelper.kt @@ -365,26 +365,31 @@ internal object RealmObjectHelper { // Return type should be RealmList but causes compilation errors for native @Suppress("unused") // Called from generated code - internal inline fun getList( + internal inline fun getList( obj: RealmObjectReference, propertyName: String, - typeAdapter: RealmTypeAdapter? = null, - ): ManagedRealmList { - val elementType: KClass = R::class - val realmObjectCompanion = elementType.realmObjectCompanionOrNull() - val operatorType = if (realmObjectCompanion == null) { - if (elementType == RealmAny::class) { - CollectionOperatorType.REALM_ANY - } else { - CollectionOperatorType.PRIMITIVE + typeAdapter: RealmTypeAdapter? = null, + ): ManagedRealmList { + val storeType: KClass = S::class + + val realmObjectCompanion = storeType.realmObjectCompanionOrNull() + val operatorType = when { + realmObjectCompanion == null -> { + if (storeType == RealmAny::class) { + CollectionOperatorType.REALM_ANY + } else { + CollectionOperatorType.PRIMITIVE + } + } + realmObjectCompanion.io_realm_kotlin_classKind == RealmClassKind.EMBEDDED -> { + CollectionOperatorType.EMBEDDED_OBJECT + } + else -> { + CollectionOperatorType.REALM_OBJECT } - } else if (realmObjectCompanion.io_realm_kotlin_classKind == RealmClassKind.EMBEDDED) { - CollectionOperatorType.EMBEDDED_OBJECT - } else { - CollectionOperatorType.REALM_OBJECT } val propertyMetadata = obj.propertyInfoOrThrow(propertyName) - return getListByKey(obj, propertyMetadata, elementType, operatorType) + return getListByKey(obj, propertyMetadata, storeType, operatorType, typeAdapter) } @Suppress("unused") // Called from generated code @@ -399,25 +404,33 @@ internal object RealmObjectHelper { } @Suppress("LongParameterList") - internal fun getListByKey( + internal fun getListByKey( obj: RealmObjectReference, propertyMetadata: PropertyMetadata, - elementType: KClass, + storeType: KClass, operatorType: CollectionOperatorType, + typeAdapter: RealmTypeAdapter?, issueDynamicObject: Boolean = false, - issueDynamicMutableObject: Boolean = false - ): ManagedRealmList { + issueDynamicMutableObject: Boolean = false, + ): ManagedRealmList { val listPtr = RealmInterop.realm_get_list(obj.objectPointer, propertyMetadata.key) - val operator = createListOperator( - listPtr, - elementType, - propertyMetadata, - obj.mediator, - obj.owner, - operatorType, - issueDynamicObject, - issueDynamicMutableObject + + val storageOperator = createListOperator( + listPtr = listPtr, + clazz = storeType, + propertyMetadata = propertyMetadata, + mediator = obj.mediator, + realm = obj.owner, + operatorType = operatorType, + issueDynamicObject = issueDynamicObject, + issueDynamicMutableObject = issueDynamicMutableObject ) + + val operator = when (typeAdapter) { + null -> storageOperator as ListOperator + else -> TypeAdaptedListOperator(storageOperator, typeAdapter) + } + return ManagedRealmList(obj, listPtr, operator) } @@ -430,7 +443,7 @@ internal object RealmObjectHelper { realm: RealmReference, operatorType: CollectionOperatorType, issueDynamicObject: Boolean, - issueDynamicMutableObject: Boolean + issueDynamicMutableObject: Boolean, ): ListOperator { return when (operatorType) { CollectionOperatorType.PRIMITIVE -> PrimitiveListOperator( @@ -472,7 +485,8 @@ internal object RealmObjectHelper { internal inline fun getSet( obj: RealmObjectReference, - propertyName: String + propertyName: String, + typeAdapter: RealmTypeAdapter? = null, ): ManagedRealmSet { val elementType = R::class val realmObjectCompanion = elementType.realmObjectCompanionOrNull() @@ -554,7 +568,8 @@ internal object RealmObjectHelper { internal inline fun getDictionary( obj: RealmObjectReference, - propertyName: String + propertyName: String, + typeAdapter: RealmTypeAdapter? = null, ): ManagedRealmDictionary { val elementType = R::class val realmObjectCompanion = elementType.realmObjectCompanionOrNull() @@ -664,15 +679,15 @@ internal object RealmObjectHelper { } @Suppress("unused") // Called from generated code - internal inline fun setList( + internal inline fun setList( obj: RealmObjectReference, col: String, - list: RealmList, + list: RealmList, + typeAdapter: RealmTypeAdapter? = null, updatePolicy: UpdatePolicy = UpdatePolicy.ALL, cache: UnmanagedToManagedObjectCache = mutableMapOf(), - typeAdapter: RealmTypeAdapter? = null, ) { - val existingList = getList(obj, col) + val existingList = getList(obj, col, typeAdapter) if (list !is ManagedRealmList || !RealmInterop.realm_equals( existingList.nativePointer, list.nativePointer @@ -689,6 +704,7 @@ internal object RealmObjectHelper { obj: RealmObjectReference, col: String, set: RealmSet, + typeAdapter: RealmTypeAdapter? = null, updatePolicy: UpdatePolicy = UpdatePolicy.ALL, cache: UnmanagedToManagedObjectCache = mutableMapOf() ) { @@ -709,6 +725,7 @@ internal object RealmObjectHelper { obj: RealmObjectReference, col: String, dictionary: RealmDictionary, + typeAdapter: RealmTypeAdapter? = null, updatePolicy: UpdatePolicy = UpdatePolicy.ALL, cache: UnmanagedToManagedObjectCache = mutableMapOf() ) { @@ -954,13 +971,14 @@ internal object RealmObjectHelper { else -> CollectionOperatorType.EMBEDDED_OBJECT } @Suppress("UNCHECKED_CAST") - return getListByKey( - obj, - propertyMetadata, - clazz, - operatorType, - true, - issueDynamicMutableObject + return getListByKey( + obj = obj, + propertyMetadata = propertyMetadata, + storeType = clazz, + operatorType = operatorType, + typeAdapter = null, + issueDynamicObject = true, + issueDynamicMutableObject = issueDynamicMutableObject ) as RealmList } diff --git a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/AccessorModifierIrGeneration.kt b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/AccessorModifierIrGeneration.kt index 65df8cf4f9..17236d2626 100644 --- a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/AccessorModifierIrGeneration.kt +++ b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/AccessorModifierIrGeneration.kt @@ -46,6 +46,7 @@ import org.jetbrains.kotlin.ir.expressions.IrCall import org.jetbrains.kotlin.ir.expressions.IrClassReference import org.jetbrains.kotlin.ir.expressions.IrConstructorCall import org.jetbrains.kotlin.ir.expressions.IrDeclarationReference +import org.jetbrains.kotlin.ir.expressions.IrExpression import org.jetbrains.kotlin.ir.expressions.IrFunctionAccessExpression import org.jetbrains.kotlin.ir.expressions.IrGetValue import org.jetbrains.kotlin.ir.expressions.IrStatementOrigin @@ -56,6 +57,7 @@ import org.jetbrains.kotlin.ir.types.IrStarProjection import org.jetbrains.kotlin.ir.types.IrType import org.jetbrains.kotlin.ir.types.IrTypeArgument import org.jetbrains.kotlin.ir.types.classFqName +import org.jetbrains.kotlin.ir.types.classifierOrFail import org.jetbrains.kotlin.ir.types.getClass import org.jetbrains.kotlin.ir.types.impl.IrAbstractSimpleType import org.jetbrains.kotlin.ir.types.impl.IrSimpleTypeImpl @@ -70,7 +72,6 @@ import org.jetbrains.kotlin.ir.types.isLong import org.jetbrains.kotlin.ir.types.isNullable import org.jetbrains.kotlin.ir.types.isShort import org.jetbrains.kotlin.ir.types.isString -import org.jetbrains.kotlin.ir.types.isSubtypeOf import org.jetbrains.kotlin.ir.types.isSubtypeOfClass import org.jetbrains.kotlin.ir.types.makeNotNull import org.jetbrains.kotlin.ir.types.superTypes @@ -80,11 +81,6 @@ import org.jetbrains.kotlin.ir.util.findAnnotation import org.jetbrains.kotlin.ir.util.parentAsClass import org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid import org.jetbrains.kotlin.ir.visitors.transformChildrenVoid -import org.jetbrains.kotlin.name.ClassId -import org.jetbrains.kotlin.resolve.descriptorUtil.classId -import org.jetbrains.kotlin.types.KotlinType -import org.jetbrains.kotlin.types.isNullable -import org.jetbrains.kotlin.types.typeUtil.supertypes import kotlin.IllegalStateException import kotlin.collections.set @@ -103,7 +99,7 @@ class AccessorModifierIrGeneration(realmPluginContext: RealmPluginContext): Real val fromPublic: (IrBuilderWithScope.(IrGetValue, IrGetValue)->IrDeclarationReference), ) - fun IrConstructorCall.getTypeAdapterTypes(): Triple = + fun IrConstructorCall.getTypeAdapterInfo(): Triple = (getValueArgument(0)!! as IrClassReference).let { adapterClassReference -> adapterClassReference.symbol .superTypes() @@ -185,7 +181,7 @@ class AccessorModifierIrGeneration(realmPluginContext: RealmPluginContext): Real val (adapterClassReference, realmType, userType) = declaration .getAnnotation(TYPE_ADAPTER_ANNOTATION.asSingleFqName()) - .getTypeAdapterTypes() + .getTypeAdapterInfo() val adapterClass: IrClass = adapterClassReference.classType.getClass()!! @@ -769,10 +765,13 @@ class AccessorModifierIrGeneration(realmPluginContext: RealmPluginContext): Real .annotations .findAnnotation(TYPE_ADAPTER_ANNOTATION.asSingleFqName()) - typeAdapterAnnotation?.let { - val (adapterClassReference, realmType, userType) = it.getTypeAdapterTypes() + var adapterClassReference: IrClassReference? = null + var collectionAdapterType: (IrBuilderWithScope.(IrGetValue)->IrExpression)? = null + var collectionStoreType: IrType? = null - val adapterClass: IrClass = adapterClassReference.classType.getClass()!! + typeAdapterAnnotation?.let { + val typeAdapterInfo = it.getTypeAdapterInfo() + val (classReference, realmType, userType) = typeAdapterInfo if(collectionIrType.classId != userType.classId) { // TODO improve messaging @@ -781,6 +780,29 @@ class AccessorModifierIrGeneration(realmPluginContext: RealmPluginContext): Real // Replace the property type with the one from the type adapter collectionIrType = realmType + adapterClassReference = classReference + val adapterClass: IrClass = classReference.classType.getClass()!! + + collectionAdapterType = { objectReference -> + // retrieve the actual type adapter + when (adapterClass.kind) { + ClassKind.CLASS -> { + irCall( + callee = getTypeAdapter, + origin = IrStatementOrigin.INVOKE + ).apply { + // pass obj reference + putValueArgument(0, objectReference) + // pass class reference + putValueArgument(1, adapterClassReference) + } + } + ClassKind.OBJECT -> { + irGetObject(adapterClass.symbol) + } + else -> throw IllegalStateException("Unsupported type") + } + } } val coreGenericTypes = getCollectionGenericCoreType( @@ -836,7 +858,9 @@ class AccessorModifierIrGeneration(realmPluginContext: RealmPluginContext): Real }, fromPublic = typeAdapterMethodReferences?.fromPublic, toRealmValue = null, - collectionType = collectionType + collectionType = collectionType, + collectionStoreType = collectionIrType, + collectionAdapterType = collectionAdapterType, ) } } @@ -852,7 +876,9 @@ class AccessorModifierIrGeneration(realmPluginContext: RealmPluginContext): Real setFunction: IrSimpleFunction? = null, fromPublic: (IrBuilderWithScope.(IrGetValue, IrGetValue)->IrDeclarationReference)? = null, toRealmValue: IrSimpleFunction? = null, - collectionType: CollectionType = CollectionType.NONE + collectionType: CollectionType = CollectionType.NONE, + collectionStoreType: IrType? = null, + collectionAdapterType: (IrBuilderWithScope.(IrGetValue)->IrExpression)? = null, ) { // TODO check this backing field if required val backingField = property.declaration.backingField!! @@ -913,8 +939,15 @@ class AccessorModifierIrGeneration(realmPluginContext: RealmPluginContext): Real if (typeArgumentsCount > 0) { putTypeArgument(0, type) } - putValueArgument(0, irGet(objectReferenceType, valueSymbol)) + if (typeArgumentsCount > 1) { + putTypeArgument(1, collectionStoreType) + } + val objectReference = irGet(objectReferenceType, valueSymbol) + putValueArgument(0, objectReference) putValueArgument(1, irString(property.persistedName)) + collectionAdapterType?.let { + putValueArgument(2, it(objectReference)) + } } val storageValue = fromRealmValue?.let { irCall(callee = it).apply { @@ -1001,9 +1034,16 @@ class AccessorModifierIrGeneration(realmPluginContext: RealmPluginContext): Real if (typeArgumentsCount > 0) { putTypeArgument(0, type) } - putValueArgument(0, irGet(objectReferenceType, valueSymbol)) + if (typeArgumentsCount > 1) { + putTypeArgument(1, collectionStoreType) + } + val objectReference = irGet(objectReferenceType, valueSymbol) + putValueArgument(0, objectReference) putValueArgument(1, irString(property.persistedName)) putValueArgument(2, realmValue) + collectionAdapterType?.let { + putValueArgument(3, it(objectReference)) + } } irIfNull( diff --git a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/RealmPluginContext.kt b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/RealmPluginContext.kt index f54e5ad60d..1fb350d9a5 100644 --- a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/RealmPluginContext.kt +++ b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/RealmPluginContext.kt @@ -87,6 +87,8 @@ interface RealmPluginContext { val providedAdapterFromRealm: IrSimpleFunction val providedAdapterToRealm: IrSimpleFunction + val getTypeAdapter: IrSimpleFunction + fun IrType.isRealmList(): Boolean { val propertyClassId: ClassId = this.classIdOrFail() @@ -325,4 +327,7 @@ class RealmPluginContextImpl(override val pluginContext: IrPluginContext): Realm override val providedAdapterToRealm: IrSimpleFunction = pluginContext.referenceFunctions(CallableId(FqName("io.realm.kotlin.internal"), Name.identifier("toRealm"))).first().owner + + override val getTypeAdapter: IrSimpleFunction = + pluginContext.referenceFunctions(CallableId(FqName("io.realm.kotlin.internal"), Name.identifier("getTypeAdapter"))).first().owner } \ No newline at end of file From ad08eb9d69b5f45ef401daba99b0437d613068af Mon Sep 17 00:00:00 2001 From: Clemente Date: Tue, 19 Dec 2023 19:23:30 +0100 Subject: [PATCH 18/32] Add set and dictionary support --- .../realm/kotlin/internal/RealmMapInternal.kt | 48 +++++++++++ .../kotlin/internal/RealmObjectHelper.kt | 82 +++++++++++-------- .../realm/kotlin/internal/RealmSetInternal.kt | 28 +++++++ 3 files changed, 124 insertions(+), 34 deletions(-) diff --git a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmMapInternal.kt b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmMapInternal.kt index b6c8ff5b47..e63d438756 100644 --- a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmMapInternal.kt +++ b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmMapInternal.kt @@ -51,6 +51,7 @@ import io.realm.kotlin.types.BaseRealmObject import io.realm.kotlin.types.RealmAny import io.realm.kotlin.types.RealmDictionary import io.realm.kotlin.types.RealmMap +import io.realm.kotlin.types.RealmTypeAdapter import kotlinx.coroutines.channels.ProducerScope import kotlinx.coroutines.flow.Flow import kotlin.reflect.KClass @@ -286,6 +287,53 @@ internal interface MapOperator : CollectionOperator { fun copy(realmReference: RealmReference, nativePointer: RealmMapPointer): MapOperator } +internal class TypeAdaptedMapOperator( + val mapOperator: MapOperator, + val typeAdapter: RealmTypeAdapter +): MapOperator { + override var modCount: Int by mapOperator::modCount + override val keyConverter: RealmValueConverter by mapOperator::keyConverter + override val nativePointer: RealmMapPointer by mapOperator::nativePointer + + override fun getEntryInternal(position: Int): Pair = mapOperator + .getEntryInternal(position) + .run { + Pair(first, typeAdapter.fromRealm(second)) + } + + override fun copy( + realmReference: RealmReference, + nativePointer: RealmMapPointer, + ): MapOperator = TypeAdaptedMapOperator(mapOperator.copy(realmReference, nativePointer), typeAdapter) + + override fun areValuesEqual(expected: E?, actual: E?): Boolean = mapOperator.areValuesEqual( + expected?.let { typeAdapter.toRealm(it) }, actual?.let { typeAdapter.toRealm(it) }) + + override fun containsValueInternal(value: E): Boolean = mapOperator.containsValueInternal(typeAdapter.toRealm(value)) + + override fun getInternal(key: K): E? = mapOperator.getInternal(key) + ?.let { typeAdapter.fromRealm(it) } + + override fun eraseInternal(key: K): Pair = mapOperator.eraseInternal(key).run { + Pair(first?.let { typeAdapter.fromRealm(it) }, second) + } + + override fun insertInternal( + key: K, + value: E?, + updatePolicy: UpdatePolicy, + cache: UnmanagedToManagedObjectCache, + ): Pair = mapOperator.insertInternal(key, + value?.let { typeAdapter.toRealm(it) }, updatePolicy, cache + ).run { + Pair(first?.let { typeAdapter.fromRealm(it) }, second) + } + + override val mediator: Mediator by mapOperator::mediator + override val realmReference: RealmReference by mapOperator::realmReference + override val valueConverter: RealmValueConverter by lazy { throw IllegalStateException("Unreachable") } +} + internal open class PrimitiveMapOperator constructor( override val mediator: Mediator, override val realmReference: RealmReference, diff --git a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmObjectHelper.kt b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmObjectHelper.kt index 974a0befcc..4c3535f033 100644 --- a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmObjectHelper.kt +++ b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmObjectHelper.kt @@ -483,15 +483,15 @@ internal object RealmObjectHelper { } } - internal inline fun getSet( + internal inline fun getSet( obj: RealmObjectReference, propertyName: String, - typeAdapter: RealmTypeAdapter? = null, - ): ManagedRealmSet { - val elementType = R::class - val realmObjectCompanion = elementType.realmObjectCompanionOrNull() + typeAdapter: RealmTypeAdapter? = null, + ): ManagedRealmSet { + val storeType = S::class + val realmObjectCompanion = storeType.realmObjectCompanionOrNull() val operatorType = if (realmObjectCompanion == null) { - if (elementType == RealmAny::class) { + if (storeType == RealmAny::class) { CollectionOperatorType.REALM_ANY } else { CollectionOperatorType.PRIMITIVE @@ -500,20 +500,21 @@ internal object RealmObjectHelper { CollectionOperatorType.REALM_OBJECT } val propertyMetadata = obj.propertyInfoOrThrow(propertyName) - return getSetByKey(obj, propertyMetadata, elementType, operatorType) + return getSetByKey(obj, propertyMetadata, storeType, operatorType, typeAdapter) } @Suppress("LongParameterList") - internal fun getSetByKey( + internal fun getSetByKey( obj: RealmObjectReference, propertyMetadata: PropertyMetadata, - elementType: KClass, + elementType: KClass, operatorType: CollectionOperatorType, + typeAdapter: RealmTypeAdapter?, issueDynamicObject: Boolean = false, - issueDynamicMutableObject: Boolean = false - ): ManagedRealmSet { + issueDynamicMutableObject: Boolean = false, + ): ManagedRealmSet { val setPtr = RealmInterop.realm_get_set(obj.objectPointer, propertyMetadata.key) - val operator = createSetOperator( + val storageOperator = createSetOperator( setPtr, elementType, propertyMetadata, @@ -523,6 +524,10 @@ internal object RealmObjectHelper { issueDynamicObject, issueDynamicMutableObject, ) + val operator = when (typeAdapter) { + null -> storageOperator as SetOperator + else -> TypeAdaptedSetOperator(storageOperator, typeAdapter) + } return ManagedRealmSet(obj, setPtr, operator) } @@ -566,16 +571,16 @@ internal object RealmObjectHelper { } } - internal inline fun getDictionary( + internal inline fun getDictionary( obj: RealmObjectReference, propertyName: String, - typeAdapter: RealmTypeAdapter? = null, - ): ManagedRealmDictionary { - val elementType = R::class - val realmObjectCompanion = elementType.realmObjectCompanionOrNull() + typeAdapter: RealmTypeAdapter? = null, + ): ManagedRealmDictionary { + val storageType = S::class + val realmObjectCompanion = storageType.realmObjectCompanionOrNull() val propertyMetadata = obj.propertyInfoOrThrow(propertyName) val operatorType = if (realmObjectCompanion == null) { - if (elementType == RealmAny::class) { + if (storageType == RealmAny::class) { CollectionOperatorType.REALM_ANY } else { CollectionOperatorType.PRIMITIVE @@ -585,21 +590,22 @@ internal object RealmObjectHelper { } else { CollectionOperatorType.EMBEDDED_OBJECT } - return getDictionaryByKey(obj, propertyMetadata, elementType, operatorType) + return getDictionaryByKey(obj, propertyMetadata, storageType, operatorType, typeAdapter) } @Suppress("LongParameterList") - internal fun getDictionaryByKey( + internal fun getDictionaryByKey( obj: RealmObjectReference, propertyMetadata: PropertyMetadata, - elementType: KClass, + elementType: KClass, operatorType: CollectionOperatorType, + typeAdapter: RealmTypeAdapter?, issueDynamicObject: Boolean = false, issueDynamicMutableObject: Boolean = false - ): ManagedRealmDictionary { + ): ManagedRealmDictionary { val dictionaryPtr = RealmInterop.realm_get_dictionary(obj.objectPointer, propertyMetadata.key) - val operator = createDictionaryOperator( + val storageOperator = createDictionaryOperator( dictionaryPtr, elementType, propertyMetadata, @@ -609,6 +615,12 @@ internal object RealmObjectHelper { issueDynamicObject, issueDynamicMutableObject, ) + + val operator = when (typeAdapter) { + null -> storageOperator as MapOperator + else -> TypeAdaptedMapOperator(storageOperator, typeAdapter) + } + return ManagedRealmDictionary(obj, dictionaryPtr, operator) } @@ -700,15 +712,15 @@ internal object RealmObjectHelper { } } - internal inline fun setSet( + internal inline fun setSet( obj: RealmObjectReference, col: String, - set: RealmSet, - typeAdapter: RealmTypeAdapter? = null, + set: RealmSet, + typeAdapter: RealmTypeAdapter? = null, updatePolicy: UpdatePolicy = UpdatePolicy.ALL, cache: UnmanagedToManagedObjectCache = mutableMapOf() ) { - val existingSet = getSet(obj, col) + val existingSet = getSet(obj, col, typeAdapter) if (set !is ManagedRealmSet || !RealmInterop.realm_equals( existingSet.nativePointer, set.nativePointer @@ -721,16 +733,16 @@ internal object RealmObjectHelper { } } - internal inline fun setDictionary( + internal inline fun setDictionary( obj: RealmObjectReference, col: String, - dictionary: RealmDictionary, - typeAdapter: RealmTypeAdapter? = null, + dictionary: RealmDictionary, + typeAdapter: RealmTypeAdapter? = null, updatePolicy: UpdatePolicy = UpdatePolicy.ALL, cache: UnmanagedToManagedObjectCache = mutableMapOf() ) { - val existingDictionary = getDictionary(obj, col) - if (dictionary !is ManagedRealmDictionary || !RealmInterop.realm_equals( + val existingDictionary = getDictionary(obj, col, typeAdapter) + if (dictionary !is ManagedRealmDictionary || !RealmInterop.realm_equals( existingDictionary.nativePointer, dictionary.nativePointer ) @@ -1007,11 +1019,12 @@ internal object RealmObjectHelper { else -> throw IllegalStateException("RealmSets do not support Embedded Objects.") } @Suppress("UNCHECKED_CAST") - return getSetByKey( + return getSetByKey( obj, propertyMetadata, clazz, operatorType, + null, true, issueDynamicMutableObject ) as RealmSet @@ -1042,11 +1055,12 @@ internal object RealmObjectHelper { else -> CollectionOperatorType.EMBEDDED_OBJECT } @Suppress("UNCHECKED_CAST") - return getDictionaryByKey( + return getDictionaryByKey( obj, propertyMetadata, clazz, operatorType, + null, true, issueDynamicMutableObject ) as RealmDictionary diff --git a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmSetInternal.kt b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmSetInternal.kt index 57337a8973..20b754bd48 100644 --- a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmSetInternal.kt +++ b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmSetInternal.kt @@ -41,6 +41,7 @@ import io.realm.kotlin.notifications.internal.UpdatedSetImpl import io.realm.kotlin.query.RealmQuery import io.realm.kotlin.types.BaseRealmObject import io.realm.kotlin.types.RealmSet +import io.realm.kotlin.types.RealmTypeAdapter import kotlinx.coroutines.channels.ProducerScope import kotlinx.coroutines.flow.Flow import kotlin.reflect.KClass @@ -303,6 +304,33 @@ internal interface SetOperator : CollectionOperator { fun copy(realmReference: RealmReference, nativePointer: RealmSetPointer): SetOperator } +internal class TypeAdaptedSetOperator( + private val setOperator: SetOperator, + private val typeAdapter: RealmTypeAdapter, +): SetOperator { + override var modCount: Int by setOperator::modCount + override val nativePointer: RealmSetPointer by setOperator::nativePointer + + override val mediator: Mediator by setOperator::mediator + override val realmReference: RealmReference by setOperator::realmReference + override val valueConverter: RealmValueConverter by lazy { throw IllegalStateException("Not available") } + + override fun get(index: Int): E = typeAdapter.fromRealm(setOperator.get(index)) + + override fun copy( + realmReference: RealmReference, + nativePointer: RealmSetPointer, + ): SetOperator = TypeAdaptedSetOperator(setOperator.copy(realmReference, nativePointer), typeAdapter) + + override fun contains(element: E): Boolean = setOperator.contains(typeAdapter.toRealm(element)) + + override fun addInternal( + element: E, + updatePolicy: UpdatePolicy, + cache: UnmanagedToManagedObjectCache, + ): Boolean = setOperator.addInternal(typeAdapter.toRealm(element), updatePolicy, cache) +} + internal class PrimitiveSetOperator( override val mediator: Mediator, override val realmReference: RealmReference, From ab53da921eb12a76e20fbd8e676cda10094bd22b Mon Sep 17 00:00:00 2001 From: Clemente Date: Tue, 19 Dec 2023 23:59:09 +0100 Subject: [PATCH 19/32] Add more tests --- .../io/realm/kotlin/types/RealmTypeAdapter.kt | 8 +++---- .../kotlin/entities/adapters/AllTypes.kt | 21 +++++++++++++++++-- .../kotlin/test/common/TypeAdapterTests.kt | 6 ++++++ 3 files changed, 29 insertions(+), 6 deletions(-) diff --git a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/types/RealmTypeAdapter.kt b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/types/RealmTypeAdapter.kt index 48559a1f76..d762e8e10d 100644 --- a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/types/RealmTypeAdapter.kt +++ b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/types/RealmTypeAdapter.kt @@ -3,13 +3,13 @@ package io.realm.kotlin.types /** * TODO * - * @param R realm type. + * @param S storage type. * @param U user type. */ // TODO Perform some validation on supported R realm-types -public interface RealmTypeAdapter { // where P is a supported realm type +public interface RealmTypeAdapter { // where S is a supported realm type - public fun fromRealm(realmValue: R): U + public fun fromRealm(realmValue: S): U - public fun toRealm(value: U): R + public fun toRealm(value: U): S } diff --git a/packages/test-base/src/commonMain/kotlin/io/realm/kotlin/entities/adapters/AllTypes.kt b/packages/test-base/src/commonMain/kotlin/io/realm/kotlin/entities/adapters/AllTypes.kt index fdfd189c9c..98de24e1c3 100644 --- a/packages/test-base/src/commonMain/kotlin/io/realm/kotlin/entities/adapters/AllTypes.kt +++ b/packages/test-base/src/commonMain/kotlin/io/realm/kotlin/entities/adapters/AllTypes.kt @@ -17,6 +17,7 @@ import io.realm.kotlin.types.RealmUUID import io.realm.kotlin.types.annotations.TypeAdapter import org.mongodb.kbson.BsonDecimal128 import org.mongodb.kbson.BsonObjectId +import org.mongodb.kbson.BsonString import org.mongodb.kbson.Decimal128 @@ -92,7 +93,7 @@ class AllTypes : RealmObject { @TypeAdapter(StringRealmListAdapter::class) var stringListField: RealmList = realmListOf() - // var byteListField: RealmList = realmListOf() +// var byteListField: RealmList = realmListOf() // var charListField: RealmList = realmListOf() // var shortListField: RealmList = realmListOf() // var intListField: RealmList = realmListOf() @@ -214,7 +215,9 @@ class AllTypes : RealmObject { // fun stringFieldSetter(s: String) { // stringField = s // } - var adaptedStringListField: RealmList<@TypeAdapter(StringAdapter::class) String> = realmListOf() + var adaptedStringListField: RealmList = realmListOf() + var adaptedStringSetField: RealmSet = realmSetOf() + var adaptedStringDictionaryField: RealmDictionary = realmDictionaryOf() companion object { // Empty object required by SampleTests @@ -255,6 +258,8 @@ class AllTypes : RealmObject { if (stringSetField != other.stringSetField) return false if (stringDictionaryField != other.stringDictionaryField) return false if (adaptedStringListField != other.adaptedStringListField) return false + if (adaptedStringSetField != other.adaptedStringSetField) return false + if (adaptedStringDictionaryField != other.adaptedStringDictionaryField) return false return true } @@ -286,11 +291,15 @@ class AllTypes : RealmObject { result = 31 * result + stringSetField.hashCode() result = 31 * result + stringDictionaryField.hashCode() result = 31 * result + adaptedStringListField.hashCode() + result = 31 * result + adaptedStringSetField.hashCode() + result = 31 * result + adaptedStringDictionaryField.hashCode() return result } + } +// TODO should we write these type adapters as BsonValue converters? // Passthrough converters object StringAdapter : RealmTypeAdapter { override fun fromRealm(realmValue: String): String = realmValue.toString() @@ -298,6 +307,14 @@ object StringAdapter : RealmTypeAdapter { override fun toRealm(value: String): String = value.toString() } +typealias RealmBsonString = @TypeAdapter(BsonStringAdapter::class) BsonString + +object BsonStringAdapter : RealmTypeAdapter { + override fun fromRealm(realmValue: String): BsonString = BsonString(realmValue) + + override fun toRealm(value: BsonString): String = value.value +} + object BooleanAdapter : RealmTypeAdapter { override fun fromRealm(realmValue: Boolean): Boolean = realmValue.not().not() diff --git a/packages/test-base/src/commonTest/kotlin/io/realm/kotlin/test/common/TypeAdapterTests.kt b/packages/test-base/src/commonTest/kotlin/io/realm/kotlin/test/common/TypeAdapterTests.kt index a789bb9037..5dcf0a82c6 100644 --- a/packages/test-base/src/commonTest/kotlin/io/realm/kotlin/test/common/TypeAdapterTests.kt +++ b/packages/test-base/src/commonTest/kotlin/io/realm/kotlin/test/common/TypeAdapterTests.kt @@ -22,9 +22,12 @@ import io.realm.kotlin.entities.adapters.RealmInstantBsonDateTimeAdapterInstance import io.realm.kotlin.entities.adapters.UsingInstancedAdapter //import io.realm.kotlin.entities.adapters.UsingInstancedAdapter import io.realm.kotlin.entities.adapters.UsingSingletonAdapter +import io.realm.kotlin.ext.realmDictionaryOf import io.realm.kotlin.ext.realmListOf +import io.realm.kotlin.ext.realmSetOf import io.realm.kotlin.test.platform.PlatformUtils import org.mongodb.kbson.BsonDateTime +import org.mongodb.kbson.BsonString import kotlin.test.AfterTest import kotlin.test.BeforeTest import kotlin.test.Test @@ -110,6 +113,9 @@ class TypeAdapterTests { fun allTypes() { val unmanagedObject = AllTypes().apply { this.stringListField = realmListOf("hello", "world", "www") + this.adaptedStringListField = realmListOf(BsonString("hello")) + this.adaptedStringSetField = realmSetOf(BsonString("hello")) + this.adaptedStringDictionaryField = realmDictionaryOf("test" to BsonString("hello")) } val managedObject = realm.writeBlocking { From 148c0ac7eaa7d30825b7053cecf7a093339375ec Mon Sep 17 00:00:00 2001 From: Clemente Date: Wed, 20 Dec 2023 10:07:01 +0100 Subject: [PATCH 20/32] Linting --- .../kotlin/io/realm/kotlin/Configuration.kt | 3 +- .../io/realm/kotlin/RealmConfiguration.kt | 3 +- .../io/realm/kotlin/internal/Converters.kt | 2 +- .../kotlin/internal/RealmListInternal.kt | 2 +- .../realm/kotlin/internal/RealmMapInternal.kt | 8 +-- .../kotlin/internal/RealmObjectHelper.kt | 22 ++++---- .../realm/kotlin/internal/RealmSetInternal.kt | 2 +- .../compiler/AccessorModifierIrGeneration.kt | 28 +++++----- .../io/realm/kotlin/compiler/IrUtils.kt | 52 +++++++++--------- .../compiler/RealmModelLoweringExtension.kt | 3 +- ...RealmModelSyntheticPropertiesGeneration.kt | 2 +- .../kotlin/compiler/RealmPluginContext.kt | 53 +++++++++---------- .../kotlin/entities/adapters/AllTypes.kt | 5 +- .../adapters/UsingInstancedAdapter.kt | 5 +- .../adapters/UsingSingletonAdapter.kt | 5 +- .../test/common/RealmConfigurationTests.kt | 4 +- .../kotlin/test/common/TypeAdapterTests.kt | 2 - .../kotlin/test/compiler/TypeAdaptersTests.kt | 16 +++--- 18 files changed, 107 insertions(+), 110 deletions(-) diff --git a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/Configuration.kt b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/Configuration.kt index 4dcb76aa34..bd4ed2b698 100644 --- a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/Configuration.kt +++ b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/Configuration.kt @@ -50,13 +50,12 @@ public fun interface CompactOnLaunchCallback { public fun shouldCompact(totalBytes: Long, usedBytes: Long): Boolean } - /** * TODO */ public class TypeAdapterBuilder { internal val typeAdapters: MutableList> = mutableListOf() - public fun add(adapter: RealmTypeAdapter<*,*>) { + public fun add(adapter: RealmTypeAdapter<*, *>) { typeAdapters.add(adapter) } } diff --git a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/RealmConfiguration.kt b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/RealmConfiguration.kt index ec16057a01..7b53255c15 100644 --- a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/RealmConfiguration.kt +++ b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/RealmConfiguration.kt @@ -24,7 +24,6 @@ import io.realm.kotlin.log.RealmLog import io.realm.kotlin.log.RealmLogger import io.realm.kotlin.migration.AutomaticSchemaMigration import io.realm.kotlin.migration.RealmMigration -import io.realm.kotlin.types.RealmTypeAdapter import io.realm.kotlin.types.TypedRealmObject import kotlin.reflect.KClass @@ -93,7 +92,7 @@ public interface RealmConfiguration : Configuration { /** * TODO */ - public fun typeAdapters(block: TypeAdapterBuilder.()->Unit): Builder = + public fun typeAdapters(block: TypeAdapterBuilder.() -> Unit): Builder = apply { this.typeAdapters = TypeAdapterBuilder().apply(block).typeAdapters } diff --git a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/Converters.kt b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/Converters.kt index d9057d6654..5371d999a7 100644 --- a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/Converters.kt +++ b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/Converters.kt @@ -267,7 +267,7 @@ public fun getTypeAdapter( obj.owner.owner .configuration .typeAdapterMap.let { adapters -> - require(adapters.contains(adapterClass)) {"User provided adaptes don't contains adapter ${adapterClass.simpleName}"} + require(adapters.contains(adapterClass)) { "User provided adaptes don't contains adapter ${adapterClass.simpleName}" } adapters[adapterClass] as RealmTypeAdapter } diff --git a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmListInternal.kt b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmListInternal.kt index 124dc95291..52114328b1 100644 --- a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmListInternal.kt +++ b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmListInternal.kt @@ -255,7 +255,7 @@ internal interface ListOperator : CollectionOperator { internal class TypeAdaptedListOperator( private val listOperator: ListOperator, private val typeAdapter: RealmTypeAdapter -): ListOperator { +) : ListOperator { override val nativePointer: RealmListPointer by listOperator::nativePointer override val mediator: Mediator by listOperator::mediator override val realmReference: RealmReference by listOperator::realmReference diff --git a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmMapInternal.kt b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmMapInternal.kt index e63d438756..678b9c695c 100644 --- a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmMapInternal.kt +++ b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmMapInternal.kt @@ -290,7 +290,7 @@ internal interface MapOperator : CollectionOperator { internal class TypeAdaptedMapOperator( val mapOperator: MapOperator, val typeAdapter: RealmTypeAdapter -): MapOperator { +) : MapOperator { override var modCount: Int by mapOperator::modCount override val keyConverter: RealmValueConverter by mapOperator::keyConverter override val nativePointer: RealmMapPointer by mapOperator::nativePointer @@ -307,7 +307,8 @@ internal class TypeAdaptedMapOperator( ): MapOperator = TypeAdaptedMapOperator(mapOperator.copy(realmReference, nativePointer), typeAdapter) override fun areValuesEqual(expected: E?, actual: E?): Boolean = mapOperator.areValuesEqual( - expected?.let { typeAdapter.toRealm(it) }, actual?.let { typeAdapter.toRealm(it) }) + expected?.let { typeAdapter.toRealm(it) }, actual?.let { typeAdapter.toRealm(it) } + ) override fun containsValueInternal(value: E): Boolean = mapOperator.containsValueInternal(typeAdapter.toRealm(value)) @@ -323,7 +324,8 @@ internal class TypeAdaptedMapOperator( value: E?, updatePolicy: UpdatePolicy, cache: UnmanagedToManagedObjectCache, - ): Pair = mapOperator.insertInternal(key, + ): Pair = mapOperator.insertInternal( + key, value?.let { typeAdapter.toRealm(it) }, updatePolicy, cache ).run { Pair(first?.let { typeAdapter.fromRealm(it) }, second) diff --git a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmObjectHelper.kt b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmObjectHelper.kt index 4c3535f033..a08ab21104 100644 --- a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmObjectHelper.kt +++ b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmObjectHelper.kt @@ -365,7 +365,7 @@ internal object RealmObjectHelper { // Return type should be RealmList but causes compilation errors for native @Suppress("unused") // Called from generated code - internal inline fun getList( + internal inline fun getList( obj: RealmObjectReference, propertyName: String, typeAdapter: RealmTypeAdapter? = null, @@ -404,7 +404,7 @@ internal object RealmObjectHelper { } @Suppress("LongParameterList") - internal fun getListByKey( + internal fun getListByKey( obj: RealmObjectReference, propertyMetadata: PropertyMetadata, storeType: KClass, @@ -483,7 +483,7 @@ internal object RealmObjectHelper { } } - internal inline fun getSet( + internal inline fun getSet( obj: RealmObjectReference, propertyName: String, typeAdapter: RealmTypeAdapter? = null, @@ -504,7 +504,7 @@ internal object RealmObjectHelper { } @Suppress("LongParameterList") - internal fun getSetByKey( + internal fun getSetByKey( obj: RealmObjectReference, propertyMetadata: PropertyMetadata, elementType: KClass, @@ -571,7 +571,7 @@ internal object RealmObjectHelper { } } - internal inline fun getDictionary( + internal inline fun getDictionary( obj: RealmObjectReference, propertyName: String, typeAdapter: RealmTypeAdapter? = null, @@ -690,8 +690,8 @@ internal object RealmObjectHelper { RealmInterop.realm_set_value(obj.objectPointer, key, transport, false) } - @Suppress("unused") // Called from generated code - internal inline fun setList( + @Suppress("unused", "LongParameterList") // Called from generated code + internal inline fun setList( obj: RealmObjectReference, col: String, list: RealmList, @@ -712,7 +712,8 @@ internal object RealmObjectHelper { } } - internal inline fun setSet( + @Suppress("LongParameterList") + internal inline fun setSet( obj: RealmObjectReference, col: String, set: RealmSet, @@ -733,7 +734,8 @@ internal object RealmObjectHelper { } } - internal inline fun setDictionary( + @Suppress("LongParameterList") + internal inline fun setDictionary( obj: RealmObjectReference, col: String, dictionary: RealmDictionary, @@ -793,7 +795,7 @@ internal object RealmObjectHelper { } accessor as KMutableProperty1 - if(property.usesCustomType) { + if (property.usesCustomType) { // Passthrough values when a property uses a custom type adapter, values will be converted automatically. val getterValue = accessor.get(source) accessor.set(target, getterValue) diff --git a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmSetInternal.kt b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmSetInternal.kt index 20b754bd48..30f0e662ad 100644 --- a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmSetInternal.kt +++ b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmSetInternal.kt @@ -307,7 +307,7 @@ internal interface SetOperator : CollectionOperator { internal class TypeAdaptedSetOperator( private val setOperator: SetOperator, private val typeAdapter: RealmTypeAdapter, -): SetOperator { +) : SetOperator { override var modCount: Int by setOperator::modCount override val nativePointer: RealmSetPointer by setOperator::nativePointer diff --git a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/AccessorModifierIrGeneration.kt b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/AccessorModifierIrGeneration.kt index 17236d2626..32303defdd 100644 --- a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/AccessorModifierIrGeneration.kt +++ b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/AccessorModifierIrGeneration.kt @@ -57,7 +57,6 @@ import org.jetbrains.kotlin.ir.types.IrStarProjection import org.jetbrains.kotlin.ir.types.IrType import org.jetbrains.kotlin.ir.types.IrTypeArgument import org.jetbrains.kotlin.ir.types.classFqName -import org.jetbrains.kotlin.ir.types.classifierOrFail import org.jetbrains.kotlin.ir.types.getClass import org.jetbrains.kotlin.ir.types.impl.IrAbstractSimpleType import org.jetbrains.kotlin.ir.types.impl.IrSimpleTypeImpl @@ -88,15 +87,15 @@ import kotlin.collections.set * Modifies the IR tree to transform getter/setter to call the C-Interop layer to retrieve read the managed values from the Realm * It also collect the schema information while processing the class properties. */ -class AccessorModifierIrGeneration(realmPluginContext: RealmPluginContext): RealmPluginContext by realmPluginContext { +class AccessorModifierIrGeneration(realmPluginContext: RealmPluginContext) : RealmPluginContext by realmPluginContext { private lateinit var objectReferenceProperty: IrProperty private lateinit var objectReferenceType: IrType data class TypeAdapterMethodReferences( val propertyType: IrType, - val toPublic: (IrBuilderWithScope.(IrGetValue, IrFunctionAccessExpression)->IrDeclarationReference), - val fromPublic: (IrBuilderWithScope.(IrGetValue, IrGetValue)->IrDeclarationReference), + val toPublic: (IrBuilderWithScope.(IrGetValue, IrFunctionAccessExpression) -> IrDeclarationReference), + val fromPublic: (IrBuilderWithScope.(IrGetValue, IrGetValue) -> IrDeclarationReference), ) fun IrConstructorCall.getTypeAdapterInfo(): Triple = @@ -172,10 +171,10 @@ class AccessorModifierIrGeneration(realmPluginContext: RealmPluginContext): Real } } - val typeAdapterMethodReferences = if(declaration.hasAnnotation(TYPE_ADAPTER_ANNOTATION)) { + val typeAdapterMethodReferences = if (declaration.hasAnnotation(TYPE_ADAPTER_ANNOTATION)) { logDebug("Object property named ${declaration.name} is an adapted type.") - if(declaration.isDelegated) { + if (declaration.isDelegated) { logError("Type adapters do not support delegated properties") } @@ -185,7 +184,7 @@ class AccessorModifierIrGeneration(realmPluginContext: RealmPluginContext): Real val adapterClass: IrClass = adapterClassReference.classType.getClass()!! - if(propertyType.classId != userType.classId) { + if (propertyType.classId != userType.classId) { // TODO improve messaging logError("Not matching types 1") } @@ -361,7 +360,7 @@ class AccessorModifierIrGeneration(realmPluginContext: RealmPluginContext): Real fromRealmValue = longToByte, toPublic = null, setFunction = setValue, - fromPublic = {_, value -> + fromPublic = { _, value -> irCall(callee = byteToLong).apply { putValueArgument(0, value) } @@ -740,6 +739,7 @@ class AccessorModifierIrGeneration(realmPluginContext: RealmPluginContext): Real }) } + @Suppress("LongParameterList", "LongMethod", "ComplexMethod") private fun processCollectionField( collectionType: CollectionType, fields: MutableMap, @@ -766,14 +766,14 @@ class AccessorModifierIrGeneration(realmPluginContext: RealmPluginContext): Real .findAnnotation(TYPE_ADAPTER_ANNOTATION.asSingleFqName()) var adapterClassReference: IrClassReference? = null - var collectionAdapterType: (IrBuilderWithScope.(IrGetValue)->IrExpression)? = null + var collectionAdapterType: (IrBuilderWithScope.(IrGetValue) -> IrExpression)? = null var collectionStoreType: IrType? = null typeAdapterAnnotation?.let { val typeAdapterInfo = it.getTypeAdapterInfo() val (classReference, realmType, userType) = typeAdapterInfo - if(collectionIrType.classId != userType.classId) { + if (collectionIrType.classId != userType.classId) { // TODO improve messaging logError("Not matching types ${collectionIrType.classFqName} ${userType.classFqName}") } @@ -866,19 +866,19 @@ class AccessorModifierIrGeneration(realmPluginContext: RealmPluginContext): Real } } - @Suppress("LongParameterList", "LongMethod", "ComplexMethod") + @Suppress("LongParameterList", "LongMethod", "ComplexMethod", "MagicNumber") private fun modifyAccessor( property: SchemaProperty, type: IrType, getFunction: IrSimpleFunction, fromRealmValue: IrSimpleFunction? = null, - toPublic: (IrBuilderWithScope.(IrGetValue, IrFunctionAccessExpression)->IrDeclarationReference)? = null, + toPublic: (IrBuilderWithScope.(IrGetValue, IrFunctionAccessExpression) -> IrDeclarationReference)? = null, setFunction: IrSimpleFunction? = null, - fromPublic: (IrBuilderWithScope.(IrGetValue, IrGetValue)->IrDeclarationReference)? = null, + fromPublic: (IrBuilderWithScope.(IrGetValue, IrGetValue) -> IrDeclarationReference)? = null, toRealmValue: IrSimpleFunction? = null, collectionType: CollectionType = CollectionType.NONE, collectionStoreType: IrType? = null, - collectionAdapterType: (IrBuilderWithScope.(IrGetValue)->IrExpression)? = null, + collectionAdapterType: (IrBuilderWithScope.(IrGetValue) -> IrExpression)? = null, ) { // TODO check this backing field if required val backingField = property.declaration.backingField!! diff --git a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/IrUtils.kt b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/IrUtils.kt index a5df88590a..9bb8d33197 100644 --- a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/IrUtils.kt +++ b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/IrUtils.kt @@ -169,11 +169,11 @@ inline fun PsiElement.hasInterface(interfaces: Set): Boolean { .split(",") // Split by commas .filter { !( - it.contains("") || - it.contains("") || - it.contains("") || - it.contains("") - ) + it.contains("") || + it.contains("") || + it.contains("") || + it.contains("") + ) }.joinToString(",") // Re-sanitize again hasRealmObjectAsSuperType = elementNodeText.findAnyOf(interfaces) != null } @@ -221,23 +221,23 @@ val realmObjectClassIds = realmObjectTypes.map { name -> ClassId(PACKAGE_TYPES, @OptIn(SymbolInternals::class) val FirClassSymbol<*>.isBaseRealmObject: Boolean get() = this.classKind == ClassKind.CLASS && - this.fir.superTypeRefs.any { typeRef -> - when (typeRef) { - // In SUPERTYPES stage - is FirUserTypeRef -> { - typeRef.qualifier.last().name in realmObjectTypes && - // Disregard constructor invocations as that means that it is a Realm Java class - !( - typeRef.source?.run { treeStructure.getParent(lighterASTNode) } - ?.tokenType?.let { it == KtStubElementTypes.CONSTRUCTOR_CALLEE } - ?: false - ) - } - // After SUPERTYPES stage - is FirResolvedTypeRef -> typeRef.type.classId in realmObjectClassIds - else -> false + this.fir.superTypeRefs.any { typeRef -> + when (typeRef) { + // In SUPERTYPES stage + is FirUserTypeRef -> { + typeRef.qualifier.last().name in realmObjectTypes && + // Disregard constructor invocations as that means that it is a Realm Java class + !( + typeRef.source?.run { treeStructure.getParent(lighterASTNode) } + ?.tokenType?.let { it == KtStubElementTypes.CONSTRUCTOR_CALLEE } + ?: false + ) } + // After SUPERTYPES stage + is FirResolvedTypeRef -> typeRef.type.classId in realmObjectClassIds + else -> false } + } // JetBrains already have a method `fun IrAnnotationContainer.hasAnnotation(symbol: IrClassSymbol)` // It is unclear exactly what the difference is and how to get a ClassSymbol from a ClassId, @@ -449,8 +449,10 @@ data class SchemaProperty( companion object { fun getPersistedName(declaration: IrProperty): String { @Suppress("UNCHECKED_CAST") - return (declaration.getAnnotation(PERSISTED_NAME_ANNOTATION.asSingleFqName()) - .getValueArgument(0)!! as IrConstImpl).value + return ( + declaration.getAnnotation(PERSISTED_NAME_ANNOTATION.asSingleFqName()) + .getValueArgument(0)!! as IrConstImpl + ).value } } } @@ -713,8 +715,10 @@ fun getLinkingObjectPropertyName(backingField: IrField): String { fun getSchemaClassName(clazz: IrClass): String { return if (clazz.hasAnnotation(PERSISTED_NAME_ANNOTATION)) { @Suppress("UNCHECKED_CAST") - return (clazz.getAnnotation(PERSISTED_NAME_ANNOTATION.asSingleFqName()) - .getValueArgument(0)!! as IrConstImpl).value + return ( + clazz.getAnnotation(PERSISTED_NAME_ANNOTATION.asSingleFqName()) + .getValueArgument(0)!! as IrConstImpl + ).value } else { clazz.name.identifier } diff --git a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/RealmModelLoweringExtension.kt b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/RealmModelLoweringExtension.kt index bfe4c8564e..efd6fb1c21 100644 --- a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/RealmModelLoweringExtension.kt +++ b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/RealmModelLoweringExtension.kt @@ -64,6 +64,7 @@ private class RealmModelLowering(private val pluginContext: IrPluginContext) : C override fun lower(irFile: IrFile) = runOnFilePostfix(irFile) + @Suppress("LongMethod", "ComplexMethod") override fun lower(irClass: IrClass) { val realmPluginContext by lazy { RealmPluginContextImpl(pluginContext) } @@ -83,7 +84,7 @@ private class RealmModelLowering(private val pluginContext: IrPluginContext) : C arguments[0].typeOrNull!! } - if(!realmType.makeNotNull().isValidPersistedType()) { + if (!realmType.makeNotNull().isValidPersistedType()) { // TODO better name please logError("Invalid type parameter '${realmType.classFqName}', only Realm types are supported") } diff --git a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/RealmModelSyntheticPropertiesGeneration.kt b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/RealmModelSyntheticPropertiesGeneration.kt index 635003463b..9d64dcaf6a 100644 --- a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/RealmModelSyntheticPropertiesGeneration.kt +++ b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/RealmModelSyntheticPropertiesGeneration.kt @@ -50,11 +50,11 @@ import io.realm.kotlin.compiler.Names.PROPERTY_TYPE_OBJECT import io.realm.kotlin.compiler.Names.REALM_OBJECT_COMPANION_CLASS_KIND import io.realm.kotlin.compiler.Names.REALM_OBJECT_COMPANION_CLASS_MEMBER import io.realm.kotlin.compiler.Names.REALM_OBJECT_COMPANION_CLASS_NAME_MEMBER -import io.realm.kotlin.compiler.Names.REALM_OBJECT_COMPANION_USE_CUSTOM_TYPE_MEMBER import io.realm.kotlin.compiler.Names.REALM_OBJECT_COMPANION_FIELDS_MEMBER import io.realm.kotlin.compiler.Names.REALM_OBJECT_COMPANION_NEW_INSTANCE_METHOD import io.realm.kotlin.compiler.Names.REALM_OBJECT_COMPANION_PRIMARY_KEY_MEMBER import io.realm.kotlin.compiler.Names.REALM_OBJECT_COMPANION_SCHEMA_METHOD +import io.realm.kotlin.compiler.Names.REALM_OBJECT_COMPANION_USE_CUSTOM_TYPE_MEMBER import io.realm.kotlin.compiler.Names.SET import org.jetbrains.kotlin.backend.common.extensions.IrPluginContext import org.jetbrains.kotlin.backend.common.lower.DeclarationIrBuilder diff --git a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/RealmPluginContext.kt b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/RealmPluginContext.kt index 1fb350d9a5..6f72b58e1a 100644 --- a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/RealmPluginContext.kt +++ b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/RealmPluginContext.kt @@ -18,7 +18,6 @@ import org.jetbrains.kotlin.name.ClassId import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.name.Name - interface RealmPluginContext { val pluginContext: IrPluginContext val realmObjectHelper: IrClass @@ -89,7 +88,6 @@ interface RealmPluginContext { val getTypeAdapter: IrSimpleFunction - fun IrType.isRealmList(): Boolean { val propertyClassId: ClassId = this.classIdOrFail() val realmListClassId: ClassId? = realmListClass.classId @@ -168,10 +166,11 @@ interface RealmPluginContext { return propertyClassId == mutableRealmIntegerClassId } - // TODO Clean up + // TODO Clean up move around? + @Suppress("ComplexMethod") fun IrType.isValidPersistedType(): Boolean = isRealmAny() || - isByteArray() || - isString() || + isByteArray() || + isString() || // isLinkingObject() || // isEmbeddedLinkingObject() || // isPersistedPrimitiveType() || @@ -180,29 +179,29 @@ interface RealmPluginContext { // isChar() || // isShort() || // isInt() || - isLong() || - isBoolean() || - isFloat() || - isDouble() || - isDecimal128() || - // isEmbeddedLinkingObject() || - // isLinkingObject() || - isRealmList() || - isRealmSet() || - isRealmDictionary() || - isRealmInstant() || - isObjectId() || - isRealmObjectId() || - isRealmUUID() || - isRealmList() || - isRealmSet() || - isRealmDictionary() || - isSubtypeOfClass(embeddedRealmObjectInterface) || - asymmetricRealmObjectInterface?.let { isSubtypeOfClass(it.symbol) } ?: false || - isSubtypeOfClass(realmObjectInterface) + isLong() || + isBoolean() || + isFloat() || + isDouble() || + isDecimal128() || + // isEmbeddedLinkingObject() || + // isLinkingObject() || + isRealmList() || + isRealmSet() || + isRealmDictionary() || + isRealmInstant() || + isObjectId() || + isRealmObjectId() || + isRealmUUID() || + isRealmList() || + isRealmSet() || + isRealmDictionary() || + isSubtypeOfClass(embeddedRealmObjectInterface) || + asymmetricRealmObjectInterface?.let { isSubtypeOfClass(it.symbol) } ?: false || + isSubtypeOfClass(realmObjectInterface) } -class RealmPluginContextImpl(override val pluginContext: IrPluginContext): RealmPluginContext { +class RealmPluginContextImpl(override val pluginContext: IrPluginContext) : RealmPluginContext { override val realmObjectHelper: IrClass = pluginContext.lookupClassOrThrow(ClassIds.REALM_OBJECT_HELPER) override val realmListClass: IrClass = pluginContext.lookupClassOrThrow(ClassIds.REALM_LIST) override val realmSetClass: IrClass = pluginContext.lookupClassOrThrow(ClassIds.REALM_SET) @@ -330,4 +329,4 @@ class RealmPluginContextImpl(override val pluginContext: IrPluginContext): Realm override val getTypeAdapter: IrSimpleFunction = pluginContext.referenceFunctions(CallableId(FqName("io.realm.kotlin.internal"), Name.identifier("getTypeAdapter"))).first().owner -} \ No newline at end of file +} diff --git a/packages/test-base/src/commonMain/kotlin/io/realm/kotlin/entities/adapters/AllTypes.kt b/packages/test-base/src/commonMain/kotlin/io/realm/kotlin/entities/adapters/AllTypes.kt index 98de24e1c3..06385dae12 100644 --- a/packages/test-base/src/commonMain/kotlin/io/realm/kotlin/entities/adapters/AllTypes.kt +++ b/packages/test-base/src/commonMain/kotlin/io/realm/kotlin/entities/adapters/AllTypes.kt @@ -20,7 +20,6 @@ import org.mongodb.kbson.BsonObjectId import org.mongodb.kbson.BsonString import org.mongodb.kbson.Decimal128 - @Suppress("MagicNumber") class AllTypes : RealmObject { @@ -223,6 +222,7 @@ class AllTypes : RealmObject { // Empty object required by SampleTests } + @Suppress("ComplexMethod") override fun equals(other: Any?): Boolean { if (this === other) return true if (other == null || this::class != other::class) return false @@ -295,8 +295,6 @@ class AllTypes : RealmObject { result = 31 * result + adaptedStringDictionaryField.hashCode() return result } - - } // TODO should we write these type adapters as BsonValue converters? @@ -376,7 +374,6 @@ object BinaryAdapter : RealmTypeAdapter { override fun toRealm(value: ByteArray): ByteArray = value.copyOf() } - object NullableStringAdapter : RealmTypeAdapter { override fun fromRealm(realmValue: String?): String? = realmValue?.toString() diff --git a/packages/test-base/src/commonMain/kotlin/io/realm/kotlin/entities/adapters/UsingInstancedAdapter.kt b/packages/test-base/src/commonMain/kotlin/io/realm/kotlin/entities/adapters/UsingInstancedAdapter.kt index 01c17a0ff4..04e8911970 100644 --- a/packages/test-base/src/commonMain/kotlin/io/realm/kotlin/entities/adapters/UsingInstancedAdapter.kt +++ b/packages/test-base/src/commonMain/kotlin/io/realm/kotlin/entities/adapters/UsingInstancedAdapter.kt @@ -17,13 +17,13 @@ package io.realm.kotlin.entities.adapters +import io.realm.kotlin.internal.asBsonDateTime +import io.realm.kotlin.internal.toRealmInstant import io.realm.kotlin.types.RealmInstant import io.realm.kotlin.types.RealmObject import io.realm.kotlin.types.RealmTypeAdapter import io.realm.kotlin.types.annotations.TypeAdapter import org.mongodb.kbson.BsonDateTime -import io.realm.kotlin.internal.asBsonDateTime -import io.realm.kotlin.internal.toRealmInstant import kotlin.time.Duration.Companion.milliseconds class UsingInstancedAdapter : RealmObject { @@ -37,4 +37,3 @@ class RealmInstantBsonDateTimeAdapterInstanced : RealmTypeAdapter { + val typeAdapter = object : RealmTypeAdapter { override fun fromRealm(realmValue: String): String = TODO("Not yet implemented") override fun toRealm(value: String): String = TODO("Not yet implemented") @@ -511,7 +511,7 @@ class RealmConfigurationTests { @Test fun defineCustomTypeAdapters() { - val typeAdapter = object: RealmTypeAdapter { + val typeAdapter = object : RealmTypeAdapter { override fun fromRealm(realmValue: String): String = TODO("Not yet implemented") override fun toRealm(value: String): String = TODO("Not yet implemented") diff --git a/packages/test-base/src/commonTest/kotlin/io/realm/kotlin/test/common/TypeAdapterTests.kt b/packages/test-base/src/commonTest/kotlin/io/realm/kotlin/test/common/TypeAdapterTests.kt index 5dcf0a82c6..52fff15381 100644 --- a/packages/test-base/src/commonTest/kotlin/io/realm/kotlin/test/common/TypeAdapterTests.kt +++ b/packages/test-base/src/commonTest/kotlin/io/realm/kotlin/test/common/TypeAdapterTests.kt @@ -20,7 +20,6 @@ import io.realm.kotlin.RealmConfiguration import io.realm.kotlin.entities.adapters.AllTypes import io.realm.kotlin.entities.adapters.RealmInstantBsonDateTimeAdapterInstanced import io.realm.kotlin.entities.adapters.UsingInstancedAdapter -//import io.realm.kotlin.entities.adapters.UsingInstancedAdapter import io.realm.kotlin.entities.adapters.UsingSingletonAdapter import io.realm.kotlin.ext.realmDictionaryOf import io.realm.kotlin.ext.realmListOf @@ -124,5 +123,4 @@ class TypeAdapterTests { assertEquals(unmanagedObject, managedObject) } - } diff --git a/packages/test-base/src/jvmTest/kotlin/io/realm/kotlin/test/compiler/TypeAdaptersTests.kt b/packages/test-base/src/jvmTest/kotlin/io/realm/kotlin/test/compiler/TypeAdaptersTests.kt index 479670f185..145c305313 100644 --- a/packages/test-base/src/jvmTest/kotlin/io/realm/kotlin/test/compiler/TypeAdaptersTests.kt +++ b/packages/test-base/src/jvmTest/kotlin/io/realm/kotlin/test/compiler/TypeAdaptersTests.kt @@ -72,7 +72,7 @@ class TypeAdaptersTests { override fun toRealm(value: UserType): NonRealmType = TODO() } - """.trimIndent() + """.trimIndent() ) ) assertEquals( @@ -87,7 +87,6 @@ class TypeAdaptersTests { } } - @Test fun `invalid U-type non-matching user-defined type`() { typeAdapterTypes.forEach { type -> @@ -115,7 +114,7 @@ class TypeAdaptersTests { override fun toRealm(value: UserType): String = TODO() } - """.trimIndent() + """.trimIndent() ) ) assertEquals( @@ -250,7 +249,7 @@ class TypeAdaptersTests { override fun toRealm(value: UserType): $kotlinLiteral = TODO() } - """.trimIndent() + """.trimIndent() ) ) assertEquals(KotlinCompilation.ExitCode.OK, result.exitCode, result.messages) @@ -320,7 +319,7 @@ class TypeAdaptersTests { override fun toRealm(value: UserType): $kotlinLiteral = TODO() } - """.trimIndent() + """.trimIndent() ) ) assertEquals( @@ -341,7 +340,7 @@ class TypeAdaptersTests { type.collectionType == CollectionType.RLM_COLLECTION_TYPE_NONE } .forEach { type -> - val default = when(type.collectionType) { + val default = when (type.collectionType) { CollectionType.RLM_COLLECTION_TYPE_NONE -> error("Outside of testing scope") CollectionType.RLM_COLLECTION_TYPE_LIST -> "RealmList<@TypeAdapter(ValidRealmTypeAdapter::class) UserType> = realmListOf()" CollectionType.RLM_COLLECTION_TYPE_SET -> "RealmSet<@TypeAdapter(ValidRealmTypeAdapter::class) UserType> = realmSetOf()" @@ -350,7 +349,7 @@ class TypeAdaptersTests { } val adapterType = when (type.elementType.classifier) { - RealmObject::class -> "TestObject2${if(type.elementType.nullable) "?" else ""}" + RealmObject::class -> "TestObject2${if (type.elementType.nullable) "?" else ""}" else -> type.copy( collectionType = CollectionType.RLM_COLLECTION_TYPE_NONE ).toKotlinLiteral() @@ -404,12 +403,11 @@ class TypeAdaptersTests { override fun toRealm(value: UserType): $adapterType = TODO() } - """.trimIndent() + """.trimIndent() ) ) assertEquals(KotlinCompilation.ExitCode.OK, result.exitCode, result.messages) } } - } } From 058afc73fd84f921a0b51dd7bb28d6c8e198f2a2 Mon Sep 17 00:00:00 2001 From: Clemente Date: Wed, 20 Dec 2023 12:36:12 +0100 Subject: [PATCH 21/32] Fix nullable collections not being processed --- .../compiler/AccessorModifierIrGeneration.kt | 14 +- ...RealmModelSyntheticPropertiesGeneration.kt | 4 +- .../01_AFTER.ValidateIrBeforeLowering.ir | 1194 +++++++++++------ .../01_AFTER.ValidateIrBeforeLowering.ir | 45 + 4 files changed, 846 insertions(+), 411 deletions(-) diff --git a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/AccessorModifierIrGeneration.kt b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/AccessorModifierIrGeneration.kt index 32303defdd..3b30122ecc 100644 --- a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/AccessorModifierIrGeneration.kt +++ b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/AccessorModifierIrGeneration.kt @@ -766,7 +766,7 @@ class AccessorModifierIrGeneration(realmPluginContext: RealmPluginContext) : Rea .findAnnotation(TYPE_ADAPTER_ANNOTATION.asSingleFqName()) var adapterClassReference: IrClassReference? = null - var collectionAdapterType: (IrBuilderWithScope.(IrGetValue) -> IrExpression)? = null + var collectionAdapterExpression: (IrBuilderWithScope.(IrGetValue) -> IrExpression)? = null var collectionStoreType: IrType? = null typeAdapterAnnotation?.let { @@ -783,7 +783,7 @@ class AccessorModifierIrGeneration(realmPluginContext: RealmPluginContext) : Rea adapterClassReference = classReference val adapterClass: IrClass = classReference.classType.getClass()!! - collectionAdapterType = { objectReference -> + collectionAdapterExpression = { objectReference -> // retrieve the actual type adapter when (adapterClass.kind) { ClassKind.CLASS -> { @@ -814,7 +814,7 @@ class AccessorModifierIrGeneration(realmPluginContext: RealmPluginContext) : Rea // Only process field if we got valid generics if (coreGenericTypes != null) { - val genericPropertyType = getPropertyTypeFromKotlinType(collectionIrType) + val genericPropertyType = getPropertyTypeFromKotlinType(collectionIrType.makeNotNull()) // Only process if (genericPropertyType != null) { @@ -860,7 +860,7 @@ class AccessorModifierIrGeneration(realmPluginContext: RealmPluginContext) : Rea toRealmValue = null, collectionType = collectionType, collectionStoreType = collectionIrType, - collectionAdapterType = collectionAdapterType, + collectionAdapterValue = collectionAdapterExpression, ) } } @@ -878,7 +878,7 @@ class AccessorModifierIrGeneration(realmPluginContext: RealmPluginContext) : Rea toRealmValue: IrSimpleFunction? = null, collectionType: CollectionType = CollectionType.NONE, collectionStoreType: IrType? = null, - collectionAdapterType: (IrBuilderWithScope.(IrGetValue) -> IrExpression)? = null, + collectionAdapterValue: (IrBuilderWithScope.(IrGetValue) -> IrExpression)? = null, ) { // TODO check this backing field if required val backingField = property.declaration.backingField!! @@ -945,7 +945,7 @@ class AccessorModifierIrGeneration(realmPluginContext: RealmPluginContext) : Rea val objectReference = irGet(objectReferenceType, valueSymbol) putValueArgument(0, objectReference) putValueArgument(1, irString(property.persistedName)) - collectionAdapterType?.let { + collectionAdapterValue?.let { putValueArgument(2, it(objectReference)) } } @@ -1041,7 +1041,7 @@ class AccessorModifierIrGeneration(realmPluginContext: RealmPluginContext) : Rea putValueArgument(0, objectReference) putValueArgument(1, irString(property.persistedName)) putValueArgument(2, realmValue) - collectionAdapterType?.let { + collectionAdapterValue?.let { putValueArgument(3, it(objectReference)) } } diff --git a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/RealmModelSyntheticPropertiesGeneration.kt b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/RealmModelSyntheticPropertiesGeneration.kt index 9d64dcaf6a..22fa05178d 100644 --- a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/RealmModelSyntheticPropertiesGeneration.kt +++ b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/RealmModelSyntheticPropertiesGeneration.kt @@ -327,7 +327,9 @@ class RealmModelSyntheticPropertiesGeneration(private val pluginContext: IrPlugi pluginContext.irBuiltIns.arrayClass.typeWith(pluginContext.irBuiltIns.stringType), type, // Generate list of properties: List>> - properties!!.entries.map { + properties!!.entries.filter { + true // TODO filter actual adapted types + }.map { IrConstImpl.string( startOffset, endOffset, diff --git a/packages/plugin-compiler/src/test/resources/sample/expected/01_AFTER.ValidateIrBeforeLowering.ir b/packages/plugin-compiler/src/test/resources/sample/expected/01_AFTER.ValidateIrBeforeLowering.ir index 0045cc76b0..90a4473df6 100644 --- a/packages/plugin-compiler/src/test/resources/sample/expected/01_AFTER.ValidateIrBeforeLowering.ir +++ b/packages/plugin-compiler/src/test/resources/sample/expected/01_AFTER.ValidateIrBeforeLowering.ir @@ -971,7 +971,7 @@ MODULE_FRAGMENT name:
BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: CALL 'internal final fun getObject (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): kotlin.Any? [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Any? origin=GET_PROPERTY - : sample.input.Child? + : sample.input.Child : $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null @@ -1075,8 +1075,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getList (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmList [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmList origin=GET_PROPERTY - : kotlin.String + then: CALL 'internal final fun getList (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmList [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmList origin=GET_PROPERTY + : kotlin.String + : kotlin.String $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="stringListField" @@ -1099,8 +1100,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmList declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmList origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setList (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, list: io.realm.kotlin.types.RealmList, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : kotlin.String + then: CALL 'internal final fun setList (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, list: io.realm.kotlin.types.RealmList, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : kotlin.String + : kotlin.String $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="stringListField" @@ -1128,8 +1130,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getList (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmList [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmList origin=GET_PROPERTY - : kotlin.Byte + then: CALL 'internal final fun getList (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmList [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmList origin=GET_PROPERTY + : kotlin.Byte + : kotlin.Byte $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="byteListField" @@ -1152,8 +1155,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmList declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmList origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setList (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, list: io.realm.kotlin.types.RealmList, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : kotlin.Byte + then: CALL 'internal final fun setList (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, list: io.realm.kotlin.types.RealmList, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : kotlin.Byte + : kotlin.Byte $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="byteListField" @@ -1181,8 +1185,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getList (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmList [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmList origin=GET_PROPERTY - : kotlin.Char + then: CALL 'internal final fun getList (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmList [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmList origin=GET_PROPERTY + : kotlin.Char + : kotlin.Char $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="charListField" @@ -1205,8 +1210,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmList declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmList origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setList (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, list: io.realm.kotlin.types.RealmList, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : kotlin.Char + then: CALL 'internal final fun setList (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, list: io.realm.kotlin.types.RealmList, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : kotlin.Char + : kotlin.Char $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="charListField" @@ -1234,8 +1240,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getList (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmList [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmList origin=GET_PROPERTY - : kotlin.Short + then: CALL 'internal final fun getList (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmList [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmList origin=GET_PROPERTY + : kotlin.Short + : kotlin.Short $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="shortListField" @@ -1258,8 +1265,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmList declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmList origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setList (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, list: io.realm.kotlin.types.RealmList, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : kotlin.Short + then: CALL 'internal final fun setList (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, list: io.realm.kotlin.types.RealmList, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : kotlin.Short + : kotlin.Short $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="shortListField" @@ -1287,8 +1295,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getList (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmList [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmList origin=GET_PROPERTY - : kotlin.Int + then: CALL 'internal final fun getList (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmList [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmList origin=GET_PROPERTY + : kotlin.Int + : kotlin.Int $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="intListField" @@ -1311,8 +1320,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmList declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmList origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setList (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, list: io.realm.kotlin.types.RealmList, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : kotlin.Int + then: CALL 'internal final fun setList (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, list: io.realm.kotlin.types.RealmList, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : kotlin.Int + : kotlin.Int $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="intListField" @@ -1340,8 +1350,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getList (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmList [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmList origin=GET_PROPERTY - : kotlin.Long + then: CALL 'internal final fun getList (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmList [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmList origin=GET_PROPERTY + : kotlin.Long + : kotlin.Long $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="longListField" @@ -1364,8 +1375,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmList declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmList origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setList (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, list: io.realm.kotlin.types.RealmList, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : kotlin.Long + then: CALL 'internal final fun setList (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, list: io.realm.kotlin.types.RealmList, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : kotlin.Long + : kotlin.Long $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="longListField" @@ -1393,8 +1405,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getList (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmList [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmList origin=GET_PROPERTY - : kotlin.Boolean + then: CALL 'internal final fun getList (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmList [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmList origin=GET_PROPERTY + : kotlin.Boolean + : kotlin.Boolean $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="booleanListField" @@ -1417,8 +1430,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmList declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmList origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setList (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, list: io.realm.kotlin.types.RealmList, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : kotlin.Boolean + then: CALL 'internal final fun setList (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, list: io.realm.kotlin.types.RealmList, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : kotlin.Boolean + : kotlin.Boolean $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="booleanListField" @@ -1446,8 +1460,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getList (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmList [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmList origin=GET_PROPERTY - : kotlin.Float + then: CALL 'internal final fun getList (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmList [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmList origin=GET_PROPERTY + : kotlin.Float + : kotlin.Float $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="floatListField" @@ -1470,8 +1485,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmList declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmList origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setList (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, list: io.realm.kotlin.types.RealmList, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : kotlin.Float + then: CALL 'internal final fun setList (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, list: io.realm.kotlin.types.RealmList, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : kotlin.Float + : kotlin.Float $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="floatListField" @@ -1499,8 +1515,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getList (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmList [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmList origin=GET_PROPERTY - : kotlin.Double + then: CALL 'internal final fun getList (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmList [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmList origin=GET_PROPERTY + : kotlin.Double + : kotlin.Double $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="doubleListField" @@ -1523,8 +1540,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmList declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmList origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setList (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, list: io.realm.kotlin.types.RealmList, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : kotlin.Double + then: CALL 'internal final fun setList (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, list: io.realm.kotlin.types.RealmList, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : kotlin.Double + : kotlin.Double $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="doubleListField" @@ -1552,8 +1570,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getList (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmList [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmList origin=GET_PROPERTY - : io.realm.kotlin.types.RealmInstant + then: CALL 'internal final fun getList (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmList [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmList origin=GET_PROPERTY + : io.realm.kotlin.types.RealmInstant + : io.realm.kotlin.types.RealmInstant $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="timestampListField" @@ -1576,8 +1595,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmList declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmList origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setList (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, list: io.realm.kotlin.types.RealmList, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : io.realm.kotlin.types.RealmInstant + then: CALL 'internal final fun setList (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, list: io.realm.kotlin.types.RealmList, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : io.realm.kotlin.types.RealmInstant + : io.realm.kotlin.types.RealmInstant $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="timestampListField" @@ -1605,8 +1625,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getList (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmList [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmList origin=GET_PROPERTY - : io.realm.kotlin.types.ObjectId + then: CALL 'internal final fun getList (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmList [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmList origin=GET_PROPERTY + : io.realm.kotlin.types.ObjectId + : io.realm.kotlin.types.ObjectId $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="objectIdListField" @@ -1629,8 +1650,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmList declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmList origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setList (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, list: io.realm.kotlin.types.RealmList, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : io.realm.kotlin.types.ObjectId + then: CALL 'internal final fun setList (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, list: io.realm.kotlin.types.RealmList, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : io.realm.kotlin.types.ObjectId + : io.realm.kotlin.types.ObjectId $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="objectIdListField" @@ -1658,8 +1680,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getList (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmList [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmList origin=GET_PROPERTY - : org.mongodb.kbson.BsonObjectId + then: CALL 'internal final fun getList (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmList [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmList origin=GET_PROPERTY + : org.mongodb.kbson.BsonObjectId + : org.mongodb.kbson.BsonObjectId $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="bsonObjectIdListField" @@ -1682,8 +1705,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmList declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmList origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setList (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, list: io.realm.kotlin.types.RealmList, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : org.mongodb.kbson.BsonObjectId + then: CALL 'internal final fun setList (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, list: io.realm.kotlin.types.RealmList, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : org.mongodb.kbson.BsonObjectId + : org.mongodb.kbson.BsonObjectId $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="bsonObjectIdListField" @@ -1711,8 +1735,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getList (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmList [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmList origin=GET_PROPERTY - : io.realm.kotlin.types.RealmUUID + then: CALL 'internal final fun getList (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmList [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmList origin=GET_PROPERTY + : io.realm.kotlin.types.RealmUUID + : io.realm.kotlin.types.RealmUUID $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="uuidListField" @@ -1735,8 +1760,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmList declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmList origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setList (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, list: io.realm.kotlin.types.RealmList, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : io.realm.kotlin.types.RealmUUID + then: CALL 'internal final fun setList (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, list: io.realm.kotlin.types.RealmList, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : io.realm.kotlin.types.RealmUUID + : io.realm.kotlin.types.RealmUUID $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="uuidListField" @@ -1764,8 +1790,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getList (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmList [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmList origin=GET_PROPERTY - : kotlin.ByteArray + then: CALL 'internal final fun getList (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmList [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmList origin=GET_PROPERTY + : kotlin.ByteArray + : kotlin.ByteArray $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="binaryListField" @@ -1788,8 +1815,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmList declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmList origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setList (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, list: io.realm.kotlin.types.RealmList, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : kotlin.ByteArray + then: CALL 'internal final fun setList (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, list: io.realm.kotlin.types.RealmList, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : kotlin.ByteArray + : kotlin.ByteArray $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="binaryListField" @@ -1817,8 +1845,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getList (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmList [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmList origin=GET_PROPERTY - : org.mongodb.kbson.BsonDecimal128{ org.mongodb.kbson.Decimal128Kt.Decimal128 } + then: CALL 'internal final fun getList (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmList [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmList origin=GET_PROPERTY + : org.mongodb.kbson.BsonDecimal128{ org.mongodb.kbson.Decimal128Kt.Decimal128 } + : org.mongodb.kbson.BsonDecimal128{ org.mongodb.kbson.Decimal128Kt.Decimal128 } $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="decimal128ListField" @@ -1841,8 +1870,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmList declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmList origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setList (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, list: io.realm.kotlin.types.RealmList, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : org.mongodb.kbson.BsonDecimal128{ org.mongodb.kbson.Decimal128Kt.Decimal128 } + then: CALL 'internal final fun setList (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, list: io.realm.kotlin.types.RealmList, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : org.mongodb.kbson.BsonDecimal128{ org.mongodb.kbson.Decimal128Kt.Decimal128 } + : org.mongodb.kbson.BsonDecimal128{ org.mongodb.kbson.Decimal128Kt.Decimal128 } $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="decimal128ListField" @@ -1870,8 +1900,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getList (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmList [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmList origin=GET_PROPERTY - : sample.input.Sample + then: CALL 'internal final fun getList (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmList [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmList origin=GET_PROPERTY + : sample.input.Sample + : sample.input.Sample $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="objectListField" @@ -1894,8 +1925,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmList declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmList origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setList (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, list: io.realm.kotlin.types.RealmList, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : sample.input.Sample + then: CALL 'internal final fun setList (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, list: io.realm.kotlin.types.RealmList, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : sample.input.Sample + : sample.input.Sample $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="objectListField" @@ -1923,8 +1955,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getList (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmList [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmList origin=GET_PROPERTY - : sample.input.EmbeddedChild + then: CALL 'internal final fun getList (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmList [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmList origin=GET_PROPERTY + : sample.input.EmbeddedChild + : sample.input.EmbeddedChild $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="embeddedRealmObjectListField" @@ -1947,8 +1980,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmList declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmList origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setList (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, list: io.realm.kotlin.types.RealmList, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : sample.input.EmbeddedChild + then: CALL 'internal final fun setList (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, list: io.realm.kotlin.types.RealmList, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : sample.input.EmbeddedChild + : sample.input.EmbeddedChild $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="embeddedRealmObjectListField" @@ -1976,8 +2010,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getList (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmList [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmList origin=GET_PROPERTY - : kotlin.String? + then: CALL 'internal final fun getList (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmList [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmList origin=GET_PROPERTY + : kotlin.String? + : kotlin.String? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="nullableStringListField" @@ -2000,8 +2035,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmList declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmList origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setList (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, list: io.realm.kotlin.types.RealmList, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : kotlin.String? + then: CALL 'internal final fun setList (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, list: io.realm.kotlin.types.RealmList, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : kotlin.String? + : kotlin.String? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="nullableStringListField" @@ -2029,8 +2065,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getList (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmList [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmList origin=GET_PROPERTY - : kotlin.Byte? + then: CALL 'internal final fun getList (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmList [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmList origin=GET_PROPERTY + : kotlin.Byte? + : kotlin.Byte? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="nullableByteListField" @@ -2053,8 +2090,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmList declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmList origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setList (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, list: io.realm.kotlin.types.RealmList, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : kotlin.Byte? + then: CALL 'internal final fun setList (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, list: io.realm.kotlin.types.RealmList, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : kotlin.Byte? + : kotlin.Byte? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="nullableByteListField" @@ -2082,8 +2120,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getList (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmList [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmList origin=GET_PROPERTY - : kotlin.Char? + then: CALL 'internal final fun getList (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmList [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmList origin=GET_PROPERTY + : kotlin.Char? + : kotlin.Char? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="nullableCharListField" @@ -2106,8 +2145,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmList declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmList origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setList (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, list: io.realm.kotlin.types.RealmList, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : kotlin.Char? + then: CALL 'internal final fun setList (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, list: io.realm.kotlin.types.RealmList, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : kotlin.Char? + : kotlin.Char? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="nullableCharListField" @@ -2135,8 +2175,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getList (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmList [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmList origin=GET_PROPERTY - : kotlin.Short? + then: CALL 'internal final fun getList (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmList [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmList origin=GET_PROPERTY + : kotlin.Short? + : kotlin.Short? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="nullableShortListField" @@ -2159,8 +2200,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmList declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmList origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setList (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, list: io.realm.kotlin.types.RealmList, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : kotlin.Short? + then: CALL 'internal final fun setList (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, list: io.realm.kotlin.types.RealmList, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : kotlin.Short? + : kotlin.Short? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="nullableShortListField" @@ -2188,8 +2230,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getList (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmList [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmList origin=GET_PROPERTY - : kotlin.Int? + then: CALL 'internal final fun getList (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmList [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmList origin=GET_PROPERTY + : kotlin.Int? + : kotlin.Int? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="nullableIntListField" @@ -2212,8 +2255,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmList declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmList origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setList (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, list: io.realm.kotlin.types.RealmList, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : kotlin.Int? + then: CALL 'internal final fun setList (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, list: io.realm.kotlin.types.RealmList, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : kotlin.Int? + : kotlin.Int? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="nullableIntListField" @@ -2241,8 +2285,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getList (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmList [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmList origin=GET_PROPERTY - : kotlin.Long? + then: CALL 'internal final fun getList (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmList [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmList origin=GET_PROPERTY + : kotlin.Long? + : kotlin.Long? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="nullableLongListField" @@ -2265,8 +2310,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmList declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmList origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setList (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, list: io.realm.kotlin.types.RealmList, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : kotlin.Long? + then: CALL 'internal final fun setList (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, list: io.realm.kotlin.types.RealmList, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : kotlin.Long? + : kotlin.Long? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="nullableLongListField" @@ -2294,8 +2340,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getList (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmList [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmList origin=GET_PROPERTY - : kotlin.Boolean? + then: CALL 'internal final fun getList (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmList [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmList origin=GET_PROPERTY + : kotlin.Boolean? + : kotlin.Boolean? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="nullableBooleanListField" @@ -2318,8 +2365,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmList declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmList origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setList (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, list: io.realm.kotlin.types.RealmList, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : kotlin.Boolean? + then: CALL 'internal final fun setList (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, list: io.realm.kotlin.types.RealmList, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : kotlin.Boolean? + : kotlin.Boolean? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="nullableBooleanListField" @@ -2347,8 +2395,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getList (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmList [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmList origin=GET_PROPERTY - : kotlin.Float? + then: CALL 'internal final fun getList (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmList [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmList origin=GET_PROPERTY + : kotlin.Float? + : kotlin.Float? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="nullableFloatListField" @@ -2371,8 +2420,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmList declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmList origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setList (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, list: io.realm.kotlin.types.RealmList, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : kotlin.Float? + then: CALL 'internal final fun setList (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, list: io.realm.kotlin.types.RealmList, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : kotlin.Float? + : kotlin.Float? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="nullableFloatListField" @@ -2400,8 +2450,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getList (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmList [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmList origin=GET_PROPERTY - : kotlin.Double? + then: CALL 'internal final fun getList (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmList [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmList origin=GET_PROPERTY + : kotlin.Double? + : kotlin.Double? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="nullableDoubleListField" @@ -2424,8 +2475,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmList declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmList origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setList (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, list: io.realm.kotlin.types.RealmList, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : kotlin.Double? + then: CALL 'internal final fun setList (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, list: io.realm.kotlin.types.RealmList, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : kotlin.Double? + : kotlin.Double? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="nullableDoubleListField" @@ -2453,8 +2505,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getList (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmList [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmList origin=GET_PROPERTY - : io.realm.kotlin.types.RealmInstant? + then: CALL 'internal final fun getList (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmList [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmList origin=GET_PROPERTY + : io.realm.kotlin.types.RealmInstant? + : io.realm.kotlin.types.RealmInstant? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="nullableTimestampListField" @@ -2477,8 +2530,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmList declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmList origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setList (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, list: io.realm.kotlin.types.RealmList, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : io.realm.kotlin.types.RealmInstant? + then: CALL 'internal final fun setList (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, list: io.realm.kotlin.types.RealmList, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : io.realm.kotlin.types.RealmInstant? + : io.realm.kotlin.types.RealmInstant? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="nullableTimestampListField" @@ -2506,8 +2560,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getList (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmList [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmList origin=GET_PROPERTY - : io.realm.kotlin.types.ObjectId? + then: CALL 'internal final fun getList (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmList [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmList origin=GET_PROPERTY + : io.realm.kotlin.types.ObjectId? + : io.realm.kotlin.types.ObjectId? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="nullableObjectIdListField" @@ -2530,8 +2585,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmList declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmList origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setList (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, list: io.realm.kotlin.types.RealmList, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : io.realm.kotlin.types.ObjectId? + then: CALL 'internal final fun setList (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, list: io.realm.kotlin.types.RealmList, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : io.realm.kotlin.types.ObjectId? + : io.realm.kotlin.types.ObjectId? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="nullableObjectIdListField" @@ -2559,8 +2615,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getList (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmList [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmList origin=GET_PROPERTY - : org.mongodb.kbson.BsonObjectId? + then: CALL 'internal final fun getList (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmList [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmList origin=GET_PROPERTY + : org.mongodb.kbson.BsonObjectId? + : org.mongodb.kbson.BsonObjectId? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="nullableBsonObjectIdListField" @@ -2583,8 +2640,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmList declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmList origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setList (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, list: io.realm.kotlin.types.RealmList, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : org.mongodb.kbson.BsonObjectId? + then: CALL 'internal final fun setList (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, list: io.realm.kotlin.types.RealmList, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : org.mongodb.kbson.BsonObjectId? + : org.mongodb.kbson.BsonObjectId? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="nullableBsonObjectIdListField" @@ -2612,8 +2670,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getList (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmList [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmList origin=GET_PROPERTY - : io.realm.kotlin.types.RealmUUID? + then: CALL 'internal final fun getList (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmList [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmList origin=GET_PROPERTY + : io.realm.kotlin.types.RealmUUID? + : io.realm.kotlin.types.RealmUUID? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="nullableUUIDListField" @@ -2636,8 +2695,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmList declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmList origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setList (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, list: io.realm.kotlin.types.RealmList, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : io.realm.kotlin.types.RealmUUID? + then: CALL 'internal final fun setList (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, list: io.realm.kotlin.types.RealmList, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : io.realm.kotlin.types.RealmUUID? + : io.realm.kotlin.types.RealmUUID? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="nullableUUIDListField" @@ -2665,8 +2725,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getList (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmList [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmList origin=GET_PROPERTY - : kotlin.ByteArray? + then: CALL 'internal final fun getList (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmList [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmList origin=GET_PROPERTY + : kotlin.ByteArray? + : kotlin.ByteArray? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="nullableBinaryListField" @@ -2689,8 +2750,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmList declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmList origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setList (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, list: io.realm.kotlin.types.RealmList, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : kotlin.ByteArray? + then: CALL 'internal final fun setList (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, list: io.realm.kotlin.types.RealmList, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : kotlin.ByteArray? + : kotlin.ByteArray? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="nullableBinaryListField" @@ -2718,8 +2780,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getList (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmList [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmList origin=GET_PROPERTY - : org.mongodb.kbson.BsonDecimal128?{ org.mongodb.kbson.Decimal128Kt.Decimal128? } + then: CALL 'internal final fun getList (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmList [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmList origin=GET_PROPERTY + : org.mongodb.kbson.BsonDecimal128?{ org.mongodb.kbson.Decimal128Kt.Decimal128? } + : org.mongodb.kbson.BsonDecimal128?{ org.mongodb.kbson.Decimal128Kt.Decimal128? } $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="nullableDecimal128ListField" @@ -2742,8 +2805,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmList declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmList origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setList (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, list: io.realm.kotlin.types.RealmList, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : org.mongodb.kbson.BsonDecimal128?{ org.mongodb.kbson.Decimal128Kt.Decimal128? } + then: CALL 'internal final fun setList (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, list: io.realm.kotlin.types.RealmList, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : org.mongodb.kbson.BsonDecimal128?{ org.mongodb.kbson.Decimal128Kt.Decimal128? } + : org.mongodb.kbson.BsonDecimal128?{ org.mongodb.kbson.Decimal128Kt.Decimal128? } $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="nullableDecimal128ListField" @@ -2771,8 +2835,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getList (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmList [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmList origin=GET_PROPERTY - : io.realm.kotlin.types.RealmAny? + then: CALL 'internal final fun getList (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmList [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmList origin=GET_PROPERTY + : io.realm.kotlin.types.RealmAny? + : io.realm.kotlin.types.RealmAny? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="nullableRealmAnyListField" @@ -2795,8 +2860,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmList declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmList origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setList (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, list: io.realm.kotlin.types.RealmList, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : io.realm.kotlin.types.RealmAny? + then: CALL 'internal final fun setList (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, list: io.realm.kotlin.types.RealmList, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : io.realm.kotlin.types.RealmAny? + : io.realm.kotlin.types.RealmAny? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="nullableRealmAnyListField" @@ -2824,8 +2890,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getSet (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmSet [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmSet origin=GET_PROPERTY - : kotlin.String + then: CALL 'internal final fun getSet (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmSet [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmSet origin=GET_PROPERTY + : kotlin.String + : kotlin.String $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="stringSetField" @@ -2848,8 +2915,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmSet declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmSet origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setSet (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, set: io.realm.kotlin.types.RealmSet, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : kotlin.String + then: CALL 'internal final fun setSet (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, set: io.realm.kotlin.types.RealmSet, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : kotlin.String + : kotlin.String $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="stringSetField" @@ -2877,8 +2945,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getSet (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmSet [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmSet origin=GET_PROPERTY - : kotlin.Byte + then: CALL 'internal final fun getSet (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmSet [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmSet origin=GET_PROPERTY + : kotlin.Byte + : kotlin.Byte $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="byteSetField" @@ -2901,8 +2970,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmSet declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmSet origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setSet (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, set: io.realm.kotlin.types.RealmSet, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : kotlin.Byte + then: CALL 'internal final fun setSet (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, set: io.realm.kotlin.types.RealmSet, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : kotlin.Byte + : kotlin.Byte $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="byteSetField" @@ -2930,8 +3000,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getSet (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmSet [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmSet origin=GET_PROPERTY - : kotlin.Char + then: CALL 'internal final fun getSet (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmSet [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmSet origin=GET_PROPERTY + : kotlin.Char + : kotlin.Char $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="charSetField" @@ -2954,8 +3025,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmSet declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmSet origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setSet (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, set: io.realm.kotlin.types.RealmSet, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : kotlin.Char + then: CALL 'internal final fun setSet (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, set: io.realm.kotlin.types.RealmSet, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : kotlin.Char + : kotlin.Char $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="charSetField" @@ -2983,8 +3055,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getSet (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmSet [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmSet origin=GET_PROPERTY - : kotlin.Short + then: CALL 'internal final fun getSet (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmSet [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmSet origin=GET_PROPERTY + : kotlin.Short + : kotlin.Short $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="shortSetField" @@ -3007,8 +3080,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmSet declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmSet origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setSet (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, set: io.realm.kotlin.types.RealmSet, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : kotlin.Short + then: CALL 'internal final fun setSet (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, set: io.realm.kotlin.types.RealmSet, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : kotlin.Short + : kotlin.Short $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="shortSetField" @@ -3036,8 +3110,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getSet (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmSet [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmSet origin=GET_PROPERTY - : kotlin.Int + then: CALL 'internal final fun getSet (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmSet [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmSet origin=GET_PROPERTY + : kotlin.Int + : kotlin.Int $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="intSetField" @@ -3060,8 +3135,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmSet declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmSet origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setSet (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, set: io.realm.kotlin.types.RealmSet, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : kotlin.Int + then: CALL 'internal final fun setSet (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, set: io.realm.kotlin.types.RealmSet, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : kotlin.Int + : kotlin.Int $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="intSetField" @@ -3089,8 +3165,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getSet (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmSet [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmSet origin=GET_PROPERTY - : kotlin.Long + then: CALL 'internal final fun getSet (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmSet [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmSet origin=GET_PROPERTY + : kotlin.Long + : kotlin.Long $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="longSetField" @@ -3113,8 +3190,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmSet declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmSet origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setSet (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, set: io.realm.kotlin.types.RealmSet, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : kotlin.Long + then: CALL 'internal final fun setSet (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, set: io.realm.kotlin.types.RealmSet, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : kotlin.Long + : kotlin.Long $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="longSetField" @@ -3142,8 +3220,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getSet (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmSet [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmSet origin=GET_PROPERTY - : kotlin.Boolean + then: CALL 'internal final fun getSet (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmSet [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmSet origin=GET_PROPERTY + : kotlin.Boolean + : kotlin.Boolean $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="booleanSetField" @@ -3166,8 +3245,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmSet declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmSet origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setSet (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, set: io.realm.kotlin.types.RealmSet, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : kotlin.Boolean + then: CALL 'internal final fun setSet (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, set: io.realm.kotlin.types.RealmSet, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : kotlin.Boolean + : kotlin.Boolean $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="booleanSetField" @@ -3195,8 +3275,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getSet (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmSet [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmSet origin=GET_PROPERTY - : kotlin.Float + then: CALL 'internal final fun getSet (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmSet [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmSet origin=GET_PROPERTY + : kotlin.Float + : kotlin.Float $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="floatSetField" @@ -3219,8 +3300,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmSet declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmSet origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setSet (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, set: io.realm.kotlin.types.RealmSet, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : kotlin.Float + then: CALL 'internal final fun setSet (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, set: io.realm.kotlin.types.RealmSet, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : kotlin.Float + : kotlin.Float $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="floatSetField" @@ -3248,8 +3330,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getSet (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmSet [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmSet origin=GET_PROPERTY - : kotlin.Double + then: CALL 'internal final fun getSet (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmSet [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmSet origin=GET_PROPERTY + : kotlin.Double + : kotlin.Double $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="doubleSetField" @@ -3272,8 +3355,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmSet declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmSet origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setSet (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, set: io.realm.kotlin.types.RealmSet, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : kotlin.Double + then: CALL 'internal final fun setSet (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, set: io.realm.kotlin.types.RealmSet, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : kotlin.Double + : kotlin.Double $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="doubleSetField" @@ -3301,8 +3385,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getSet (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmSet [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmSet origin=GET_PROPERTY - : io.realm.kotlin.types.RealmInstant + then: CALL 'internal final fun getSet (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmSet [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmSet origin=GET_PROPERTY + : io.realm.kotlin.types.RealmInstant + : io.realm.kotlin.types.RealmInstant $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="timestampSetField" @@ -3325,8 +3410,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmSet declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmSet origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setSet (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, set: io.realm.kotlin.types.RealmSet, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : io.realm.kotlin.types.RealmInstant + then: CALL 'internal final fun setSet (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, set: io.realm.kotlin.types.RealmSet, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : io.realm.kotlin.types.RealmInstant + : io.realm.kotlin.types.RealmInstant $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="timestampSetField" @@ -3354,8 +3440,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getSet (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmSet [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmSet origin=GET_PROPERTY - : io.realm.kotlin.types.ObjectId + then: CALL 'internal final fun getSet (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmSet [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmSet origin=GET_PROPERTY + : io.realm.kotlin.types.ObjectId + : io.realm.kotlin.types.ObjectId $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="objectIdSetField" @@ -3378,8 +3465,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmSet declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmSet origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setSet (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, set: io.realm.kotlin.types.RealmSet, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : io.realm.kotlin.types.ObjectId + then: CALL 'internal final fun setSet (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, set: io.realm.kotlin.types.RealmSet, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : io.realm.kotlin.types.ObjectId + : io.realm.kotlin.types.ObjectId $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="objectIdSetField" @@ -3407,8 +3495,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getSet (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmSet [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmSet origin=GET_PROPERTY - : org.mongodb.kbson.BsonObjectId + then: CALL 'internal final fun getSet (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmSet [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmSet origin=GET_PROPERTY + : org.mongodb.kbson.BsonObjectId + : org.mongodb.kbson.BsonObjectId $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="bsonObjectIdSetField" @@ -3431,8 +3520,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmSet declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmSet origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setSet (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, set: io.realm.kotlin.types.RealmSet, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : org.mongodb.kbson.BsonObjectId + then: CALL 'internal final fun setSet (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, set: io.realm.kotlin.types.RealmSet, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : org.mongodb.kbson.BsonObjectId + : org.mongodb.kbson.BsonObjectId $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="bsonObjectIdSetField" @@ -3460,8 +3550,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getSet (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmSet [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmSet origin=GET_PROPERTY - : io.realm.kotlin.types.RealmUUID + then: CALL 'internal final fun getSet (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmSet [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmSet origin=GET_PROPERTY + : io.realm.kotlin.types.RealmUUID + : io.realm.kotlin.types.RealmUUID $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="uuidSetField" @@ -3484,8 +3575,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmSet declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmSet origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setSet (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, set: io.realm.kotlin.types.RealmSet, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : io.realm.kotlin.types.RealmUUID + then: CALL 'internal final fun setSet (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, set: io.realm.kotlin.types.RealmSet, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : io.realm.kotlin.types.RealmUUID + : io.realm.kotlin.types.RealmUUID $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="uuidSetField" @@ -3513,8 +3605,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getSet (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmSet [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmSet origin=GET_PROPERTY - : kotlin.ByteArray + then: CALL 'internal final fun getSet (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmSet [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmSet origin=GET_PROPERTY + : kotlin.ByteArray + : kotlin.ByteArray $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="binarySetField" @@ -3537,8 +3630,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmSet declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmSet origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setSet (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, set: io.realm.kotlin.types.RealmSet, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : kotlin.ByteArray + then: CALL 'internal final fun setSet (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, set: io.realm.kotlin.types.RealmSet, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : kotlin.ByteArray + : kotlin.ByteArray $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="binarySetField" @@ -3566,8 +3660,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getSet (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmSet [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmSet origin=GET_PROPERTY - : org.mongodb.kbson.BsonDecimal128{ org.mongodb.kbson.Decimal128Kt.Decimal128 } + then: CALL 'internal final fun getSet (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmSet [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmSet origin=GET_PROPERTY + : org.mongodb.kbson.BsonDecimal128{ org.mongodb.kbson.Decimal128Kt.Decimal128 } + : org.mongodb.kbson.BsonDecimal128{ org.mongodb.kbson.Decimal128Kt.Decimal128 } $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="decimal128SetField" @@ -3590,8 +3685,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmSet declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmSet origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setSet (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, set: io.realm.kotlin.types.RealmSet, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : org.mongodb.kbson.BsonDecimal128{ org.mongodb.kbson.Decimal128Kt.Decimal128 } + then: CALL 'internal final fun setSet (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, set: io.realm.kotlin.types.RealmSet, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : org.mongodb.kbson.BsonDecimal128{ org.mongodb.kbson.Decimal128Kt.Decimal128 } + : org.mongodb.kbson.BsonDecimal128{ org.mongodb.kbson.Decimal128Kt.Decimal128 } $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="decimal128SetField" @@ -3619,8 +3715,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getSet (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmSet [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmSet origin=GET_PROPERTY - : sample.input.Sample + then: CALL 'internal final fun getSet (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmSet [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmSet origin=GET_PROPERTY + : sample.input.Sample + : sample.input.Sample $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="objectSetField" @@ -3643,8 +3740,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmSet declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmSet origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setSet (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, set: io.realm.kotlin.types.RealmSet, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : sample.input.Sample + then: CALL 'internal final fun setSet (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, set: io.realm.kotlin.types.RealmSet, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : sample.input.Sample + : sample.input.Sample $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="objectSetField" @@ -3672,8 +3770,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getSet (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmSet [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmSet origin=GET_PROPERTY - : kotlin.String? + then: CALL 'internal final fun getSet (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmSet [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmSet origin=GET_PROPERTY + : kotlin.String? + : kotlin.String? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="nullableStringSetField" @@ -3696,8 +3795,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmSet declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmSet origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setSet (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, set: io.realm.kotlin.types.RealmSet, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : kotlin.String? + then: CALL 'internal final fun setSet (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, set: io.realm.kotlin.types.RealmSet, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : kotlin.String? + : kotlin.String? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="nullableStringSetField" @@ -3725,8 +3825,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getSet (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmSet [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmSet origin=GET_PROPERTY - : kotlin.Byte? + then: CALL 'internal final fun getSet (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmSet [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmSet origin=GET_PROPERTY + : kotlin.Byte? + : kotlin.Byte? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="nullableByteSetField" @@ -3749,8 +3850,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmSet declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmSet origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setSet (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, set: io.realm.kotlin.types.RealmSet, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : kotlin.Byte? + then: CALL 'internal final fun setSet (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, set: io.realm.kotlin.types.RealmSet, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : kotlin.Byte? + : kotlin.Byte? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="nullableByteSetField" @@ -3778,8 +3880,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getSet (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmSet [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmSet origin=GET_PROPERTY - : kotlin.Char? + then: CALL 'internal final fun getSet (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmSet [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmSet origin=GET_PROPERTY + : kotlin.Char? + : kotlin.Char? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="nullableCharSetField" @@ -3802,8 +3905,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmSet declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmSet origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setSet (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, set: io.realm.kotlin.types.RealmSet, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : kotlin.Char? + then: CALL 'internal final fun setSet (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, set: io.realm.kotlin.types.RealmSet, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : kotlin.Char? + : kotlin.Char? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="nullableCharSetField" @@ -3831,8 +3935,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getSet (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmSet [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmSet origin=GET_PROPERTY - : kotlin.Short? + then: CALL 'internal final fun getSet (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmSet [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmSet origin=GET_PROPERTY + : kotlin.Short? + : kotlin.Short? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="nullableShortSetField" @@ -3855,8 +3960,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmSet declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmSet origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setSet (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, set: io.realm.kotlin.types.RealmSet, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : kotlin.Short? + then: CALL 'internal final fun setSet (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, set: io.realm.kotlin.types.RealmSet, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : kotlin.Short? + : kotlin.Short? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="nullableShortSetField" @@ -3884,8 +3990,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getSet (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmSet [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmSet origin=GET_PROPERTY - : kotlin.Int? + then: CALL 'internal final fun getSet (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmSet [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmSet origin=GET_PROPERTY + : kotlin.Int? + : kotlin.Int? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="nullableIntSetField" @@ -3908,8 +4015,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmSet declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmSet origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setSet (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, set: io.realm.kotlin.types.RealmSet, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : kotlin.Int? + then: CALL 'internal final fun setSet (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, set: io.realm.kotlin.types.RealmSet, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : kotlin.Int? + : kotlin.Int? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="nullableIntSetField" @@ -3937,8 +4045,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getSet (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmSet [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmSet origin=GET_PROPERTY - : kotlin.Long? + then: CALL 'internal final fun getSet (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmSet [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmSet origin=GET_PROPERTY + : kotlin.Long? + : kotlin.Long? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="nullableLongSetField" @@ -3961,8 +4070,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmSet declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmSet origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setSet (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, set: io.realm.kotlin.types.RealmSet, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : kotlin.Long? + then: CALL 'internal final fun setSet (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, set: io.realm.kotlin.types.RealmSet, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : kotlin.Long? + : kotlin.Long? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="nullableLongSetField" @@ -3990,8 +4100,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getSet (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmSet [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmSet origin=GET_PROPERTY - : kotlin.Boolean? + then: CALL 'internal final fun getSet (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmSet [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmSet origin=GET_PROPERTY + : kotlin.Boolean? + : kotlin.Boolean? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="nullableBooleanSetField" @@ -4014,8 +4125,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmSet declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmSet origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setSet (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, set: io.realm.kotlin.types.RealmSet, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : kotlin.Boolean? + then: CALL 'internal final fun setSet (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, set: io.realm.kotlin.types.RealmSet, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : kotlin.Boolean? + : kotlin.Boolean? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="nullableBooleanSetField" @@ -4043,8 +4155,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getSet (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmSet [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmSet origin=GET_PROPERTY - : kotlin.Float? + then: CALL 'internal final fun getSet (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmSet [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmSet origin=GET_PROPERTY + : kotlin.Float? + : kotlin.Float? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="nullableFloatSetField" @@ -4067,8 +4180,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmSet declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmSet origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setSet (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, set: io.realm.kotlin.types.RealmSet, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : kotlin.Float? + then: CALL 'internal final fun setSet (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, set: io.realm.kotlin.types.RealmSet, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : kotlin.Float? + : kotlin.Float? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="nullableFloatSetField" @@ -4096,8 +4210,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getSet (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmSet [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmSet origin=GET_PROPERTY - : kotlin.Double? + then: CALL 'internal final fun getSet (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmSet [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmSet origin=GET_PROPERTY + : kotlin.Double? + : kotlin.Double? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="nullableDoubleSetField" @@ -4120,8 +4235,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmSet declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmSet origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setSet (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, set: io.realm.kotlin.types.RealmSet, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : kotlin.Double? + then: CALL 'internal final fun setSet (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, set: io.realm.kotlin.types.RealmSet, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : kotlin.Double? + : kotlin.Double? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="nullableDoubleSetField" @@ -4149,8 +4265,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getSet (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmSet [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmSet origin=GET_PROPERTY - : io.realm.kotlin.types.RealmInstant? + then: CALL 'internal final fun getSet (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmSet [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmSet origin=GET_PROPERTY + : io.realm.kotlin.types.RealmInstant? + : io.realm.kotlin.types.RealmInstant? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="nullableTimestampSetField" @@ -4173,8 +4290,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmSet declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmSet origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setSet (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, set: io.realm.kotlin.types.RealmSet, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : io.realm.kotlin.types.RealmInstant? + then: CALL 'internal final fun setSet (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, set: io.realm.kotlin.types.RealmSet, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : io.realm.kotlin.types.RealmInstant? + : io.realm.kotlin.types.RealmInstant? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="nullableTimestampSetField" @@ -4202,8 +4320,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getSet (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmSet [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmSet origin=GET_PROPERTY - : io.realm.kotlin.types.ObjectId? + then: CALL 'internal final fun getSet (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmSet [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmSet origin=GET_PROPERTY + : io.realm.kotlin.types.ObjectId? + : io.realm.kotlin.types.ObjectId? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="nullableObjectIdSetField" @@ -4226,8 +4345,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmSet declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmSet origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setSet (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, set: io.realm.kotlin.types.RealmSet, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : io.realm.kotlin.types.ObjectId? + then: CALL 'internal final fun setSet (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, set: io.realm.kotlin.types.RealmSet, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : io.realm.kotlin.types.ObjectId? + : io.realm.kotlin.types.ObjectId? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="nullableObjectIdSetField" @@ -4255,8 +4375,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getSet (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmSet [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmSet origin=GET_PROPERTY - : org.mongodb.kbson.BsonObjectId? + then: CALL 'internal final fun getSet (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmSet [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmSet origin=GET_PROPERTY + : org.mongodb.kbson.BsonObjectId? + : org.mongodb.kbson.BsonObjectId? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="nullableBsonObjectIdSetField" @@ -4279,8 +4400,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmSet declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmSet origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setSet (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, set: io.realm.kotlin.types.RealmSet, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : org.mongodb.kbson.BsonObjectId? + then: CALL 'internal final fun setSet (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, set: io.realm.kotlin.types.RealmSet, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : org.mongodb.kbson.BsonObjectId? + : org.mongodb.kbson.BsonObjectId? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="nullableBsonObjectIdSetField" @@ -4308,8 +4430,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getSet (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmSet [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmSet origin=GET_PROPERTY - : io.realm.kotlin.types.RealmUUID? + then: CALL 'internal final fun getSet (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmSet [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmSet origin=GET_PROPERTY + : io.realm.kotlin.types.RealmUUID? + : io.realm.kotlin.types.RealmUUID? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="nullableUUIDSetField" @@ -4332,8 +4455,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmSet declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmSet origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setSet (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, set: io.realm.kotlin.types.RealmSet, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : io.realm.kotlin.types.RealmUUID? + then: CALL 'internal final fun setSet (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, set: io.realm.kotlin.types.RealmSet, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : io.realm.kotlin.types.RealmUUID? + : io.realm.kotlin.types.RealmUUID? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="nullableUUIDSetField" @@ -4361,8 +4485,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getSet (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmSet [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmSet origin=GET_PROPERTY - : kotlin.ByteArray? + then: CALL 'internal final fun getSet (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmSet [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmSet origin=GET_PROPERTY + : kotlin.ByteArray? + : kotlin.ByteArray? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="nullableBinarySetField" @@ -4385,8 +4510,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmSet declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmSet origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setSet (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, set: io.realm.kotlin.types.RealmSet, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : kotlin.ByteArray? + then: CALL 'internal final fun setSet (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, set: io.realm.kotlin.types.RealmSet, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : kotlin.ByteArray? + : kotlin.ByteArray? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="nullableBinarySetField" @@ -4414,8 +4540,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getSet (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmSet [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmSet origin=GET_PROPERTY - : org.mongodb.kbson.BsonDecimal128?{ org.mongodb.kbson.Decimal128Kt.Decimal128? } + then: CALL 'internal final fun getSet (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmSet [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmSet origin=GET_PROPERTY + : org.mongodb.kbson.BsonDecimal128?{ org.mongodb.kbson.Decimal128Kt.Decimal128? } + : org.mongodb.kbson.BsonDecimal128?{ org.mongodb.kbson.Decimal128Kt.Decimal128? } $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="nullableDecimal128SetField" @@ -4438,8 +4565,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmSet declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmSet origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setSet (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, set: io.realm.kotlin.types.RealmSet, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : org.mongodb.kbson.BsonDecimal128?{ org.mongodb.kbson.Decimal128Kt.Decimal128? } + then: CALL 'internal final fun setSet (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, set: io.realm.kotlin.types.RealmSet, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : org.mongodb.kbson.BsonDecimal128?{ org.mongodb.kbson.Decimal128Kt.Decimal128? } + : org.mongodb.kbson.BsonDecimal128?{ org.mongodb.kbson.Decimal128Kt.Decimal128? } $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="nullableDecimal128SetField" @@ -4467,8 +4595,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getSet (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmSet [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmSet origin=GET_PROPERTY - : io.realm.kotlin.types.RealmAny? + then: CALL 'internal final fun getSet (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmSet [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmSet origin=GET_PROPERTY + : io.realm.kotlin.types.RealmAny? + : io.realm.kotlin.types.RealmAny? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="nullableRealmAnySetField" @@ -4491,8 +4620,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmSet declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmSet origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setSet (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, set: io.realm.kotlin.types.RealmSet, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : io.realm.kotlin.types.RealmAny? + then: CALL 'internal final fun setSet (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, set: io.realm.kotlin.types.RealmSet, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : io.realm.kotlin.types.RealmAny? + : io.realm.kotlin.types.RealmAny? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="nullableRealmAnySetField" @@ -4520,8 +4650,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmDictionary [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmDictionary origin=GET_PROPERTY - : kotlin.String + then: CALL 'internal final fun getDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmDictionary [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmDictionary origin=GET_PROPERTY + : kotlin.String + : kotlin.String $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="stringDictionaryField" @@ -4544,8 +4675,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmDictionary declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmDictionary origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, dictionary: io.realm.kotlin.types.RealmDictionary, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : kotlin.String + then: CALL 'internal final fun setDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, dictionary: io.realm.kotlin.types.RealmDictionary, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : kotlin.String + : kotlin.String $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="stringDictionaryField" @@ -4573,8 +4705,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmDictionary [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmDictionary origin=GET_PROPERTY - : kotlin.Byte + then: CALL 'internal final fun getDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmDictionary [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmDictionary origin=GET_PROPERTY + : kotlin.Byte + : kotlin.Byte $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="byteDictionaryField" @@ -4597,8 +4730,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmDictionary declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmDictionary origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, dictionary: io.realm.kotlin.types.RealmDictionary, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : kotlin.Byte + then: CALL 'internal final fun setDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, dictionary: io.realm.kotlin.types.RealmDictionary, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : kotlin.Byte + : kotlin.Byte $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="byteDictionaryField" @@ -4626,8 +4760,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmDictionary [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmDictionary origin=GET_PROPERTY - : kotlin.Char + then: CALL 'internal final fun getDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmDictionary [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmDictionary origin=GET_PROPERTY + : kotlin.Char + : kotlin.Char $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="charDictionaryField" @@ -4650,8 +4785,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmDictionary declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmDictionary origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, dictionary: io.realm.kotlin.types.RealmDictionary, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : kotlin.Char + then: CALL 'internal final fun setDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, dictionary: io.realm.kotlin.types.RealmDictionary, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : kotlin.Char + : kotlin.Char $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="charDictionaryField" @@ -4679,8 +4815,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmDictionary [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmDictionary origin=GET_PROPERTY - : kotlin.Short + then: CALL 'internal final fun getDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmDictionary [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmDictionary origin=GET_PROPERTY + : kotlin.Short + : kotlin.Short $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="shortDictionaryField" @@ -4703,8 +4840,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmDictionary declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmDictionary origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, dictionary: io.realm.kotlin.types.RealmDictionary, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : kotlin.Short + then: CALL 'internal final fun setDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, dictionary: io.realm.kotlin.types.RealmDictionary, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : kotlin.Short + : kotlin.Short $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="shortDictionaryField" @@ -4732,8 +4870,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmDictionary [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmDictionary origin=GET_PROPERTY - : kotlin.Int + then: CALL 'internal final fun getDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmDictionary [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmDictionary origin=GET_PROPERTY + : kotlin.Int + : kotlin.Int $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="intDictionaryField" @@ -4756,8 +4895,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmDictionary declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmDictionary origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, dictionary: io.realm.kotlin.types.RealmDictionary, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : kotlin.Int + then: CALL 'internal final fun setDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, dictionary: io.realm.kotlin.types.RealmDictionary, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : kotlin.Int + : kotlin.Int $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="intDictionaryField" @@ -4785,8 +4925,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmDictionary [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmDictionary origin=GET_PROPERTY - : kotlin.Long + then: CALL 'internal final fun getDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmDictionary [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmDictionary origin=GET_PROPERTY + : kotlin.Long + : kotlin.Long $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="longDictionaryField" @@ -4809,8 +4950,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmDictionary declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmDictionary origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, dictionary: io.realm.kotlin.types.RealmDictionary, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : kotlin.Long + then: CALL 'internal final fun setDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, dictionary: io.realm.kotlin.types.RealmDictionary, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : kotlin.Long + : kotlin.Long $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="longDictionaryField" @@ -4838,8 +4980,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmDictionary [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmDictionary origin=GET_PROPERTY - : kotlin.Boolean + then: CALL 'internal final fun getDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmDictionary [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmDictionary origin=GET_PROPERTY + : kotlin.Boolean + : kotlin.Boolean $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="booleanDictionaryField" @@ -4862,8 +5005,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmDictionary declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmDictionary origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, dictionary: io.realm.kotlin.types.RealmDictionary, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : kotlin.Boolean + then: CALL 'internal final fun setDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, dictionary: io.realm.kotlin.types.RealmDictionary, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : kotlin.Boolean + : kotlin.Boolean $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="booleanDictionaryField" @@ -4891,8 +5035,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmDictionary [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmDictionary origin=GET_PROPERTY - : kotlin.Float + then: CALL 'internal final fun getDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmDictionary [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmDictionary origin=GET_PROPERTY + : kotlin.Float + : kotlin.Float $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="floatDictionaryField" @@ -4915,8 +5060,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmDictionary declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmDictionary origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, dictionary: io.realm.kotlin.types.RealmDictionary, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : kotlin.Float + then: CALL 'internal final fun setDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, dictionary: io.realm.kotlin.types.RealmDictionary, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : kotlin.Float + : kotlin.Float $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="floatDictionaryField" @@ -4944,8 +5090,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmDictionary [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmDictionary origin=GET_PROPERTY - : kotlin.Double + then: CALL 'internal final fun getDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmDictionary [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmDictionary origin=GET_PROPERTY + : kotlin.Double + : kotlin.Double $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="doubleDictionaryField" @@ -4968,8 +5115,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmDictionary declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmDictionary origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, dictionary: io.realm.kotlin.types.RealmDictionary, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : kotlin.Double + then: CALL 'internal final fun setDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, dictionary: io.realm.kotlin.types.RealmDictionary, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : kotlin.Double + : kotlin.Double $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="doubleDictionaryField" @@ -4997,8 +5145,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmDictionary [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmDictionary origin=GET_PROPERTY - : io.realm.kotlin.types.RealmInstant + then: CALL 'internal final fun getDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmDictionary [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmDictionary origin=GET_PROPERTY + : io.realm.kotlin.types.RealmInstant + : io.realm.kotlin.types.RealmInstant $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="timestampDictionaryField" @@ -5021,8 +5170,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmDictionary declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmDictionary origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, dictionary: io.realm.kotlin.types.RealmDictionary, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : io.realm.kotlin.types.RealmInstant + then: CALL 'internal final fun setDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, dictionary: io.realm.kotlin.types.RealmDictionary, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : io.realm.kotlin.types.RealmInstant + : io.realm.kotlin.types.RealmInstant $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="timestampDictionaryField" @@ -5050,8 +5200,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmDictionary [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmDictionary origin=GET_PROPERTY - : io.realm.kotlin.types.ObjectId + then: CALL 'internal final fun getDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmDictionary [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmDictionary origin=GET_PROPERTY + : io.realm.kotlin.types.ObjectId + : io.realm.kotlin.types.ObjectId $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="objectIdDictionaryField" @@ -5074,8 +5225,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmDictionary declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmDictionary origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, dictionary: io.realm.kotlin.types.RealmDictionary, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : io.realm.kotlin.types.ObjectId + then: CALL 'internal final fun setDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, dictionary: io.realm.kotlin.types.RealmDictionary, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : io.realm.kotlin.types.ObjectId + : io.realm.kotlin.types.ObjectId $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="objectIdDictionaryField" @@ -5103,8 +5255,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmDictionary [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmDictionary origin=GET_PROPERTY - : org.mongodb.kbson.BsonObjectId + then: CALL 'internal final fun getDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmDictionary [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmDictionary origin=GET_PROPERTY + : org.mongodb.kbson.BsonObjectId + : org.mongodb.kbson.BsonObjectId $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="bsonObjectIdDictionaryField" @@ -5127,8 +5280,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmDictionary declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmDictionary origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, dictionary: io.realm.kotlin.types.RealmDictionary, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : org.mongodb.kbson.BsonObjectId + then: CALL 'internal final fun setDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, dictionary: io.realm.kotlin.types.RealmDictionary, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : org.mongodb.kbson.BsonObjectId + : org.mongodb.kbson.BsonObjectId $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="bsonObjectIdDictionaryField" @@ -5156,8 +5310,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmDictionary [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmDictionary origin=GET_PROPERTY - : io.realm.kotlin.types.RealmUUID + then: CALL 'internal final fun getDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmDictionary [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmDictionary origin=GET_PROPERTY + : io.realm.kotlin.types.RealmUUID + : io.realm.kotlin.types.RealmUUID $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="uuidDictionaryField" @@ -5180,8 +5335,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmDictionary declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmDictionary origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, dictionary: io.realm.kotlin.types.RealmDictionary, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : io.realm.kotlin.types.RealmUUID + then: CALL 'internal final fun setDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, dictionary: io.realm.kotlin.types.RealmDictionary, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : io.realm.kotlin.types.RealmUUID + : io.realm.kotlin.types.RealmUUID $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="uuidDictionaryField" @@ -5209,8 +5365,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmDictionary [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmDictionary origin=GET_PROPERTY - : kotlin.ByteArray + then: CALL 'internal final fun getDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmDictionary [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmDictionary origin=GET_PROPERTY + : kotlin.ByteArray + : kotlin.ByteArray $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="binaryDictionaryField" @@ -5233,8 +5390,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmDictionary declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmDictionary origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, dictionary: io.realm.kotlin.types.RealmDictionary, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : kotlin.ByteArray + then: CALL 'internal final fun setDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, dictionary: io.realm.kotlin.types.RealmDictionary, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : kotlin.ByteArray + : kotlin.ByteArray $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="binaryDictionaryField" @@ -5262,8 +5420,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmDictionary [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmDictionary origin=GET_PROPERTY - : org.mongodb.kbson.BsonDecimal128{ org.mongodb.kbson.Decimal128Kt.Decimal128 } + then: CALL 'internal final fun getDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmDictionary [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmDictionary origin=GET_PROPERTY + : org.mongodb.kbson.BsonDecimal128{ org.mongodb.kbson.Decimal128Kt.Decimal128 } + : org.mongodb.kbson.BsonDecimal128{ org.mongodb.kbson.Decimal128Kt.Decimal128 } $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="decimal128DictionaryField" @@ -5286,8 +5445,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmDictionary declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmDictionary origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, dictionary: io.realm.kotlin.types.RealmDictionary, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : org.mongodb.kbson.BsonDecimal128{ org.mongodb.kbson.Decimal128Kt.Decimal128 } + then: CALL 'internal final fun setDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, dictionary: io.realm.kotlin.types.RealmDictionary, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : org.mongodb.kbson.BsonDecimal128{ org.mongodb.kbson.Decimal128Kt.Decimal128 } + : org.mongodb.kbson.BsonDecimal128{ org.mongodb.kbson.Decimal128Kt.Decimal128 } $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="decimal128DictionaryField" @@ -5315,8 +5475,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmDictionary [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmDictionary origin=GET_PROPERTY - : kotlin.String? + then: CALL 'internal final fun getDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmDictionary [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmDictionary origin=GET_PROPERTY + : kotlin.String? + : kotlin.String? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="nullableStringDictionaryField" @@ -5339,8 +5500,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmDictionary declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmDictionary origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, dictionary: io.realm.kotlin.types.RealmDictionary, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : kotlin.String? + then: CALL 'internal final fun setDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, dictionary: io.realm.kotlin.types.RealmDictionary, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : kotlin.String? + : kotlin.String? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="nullableStringDictionaryField" @@ -5368,8 +5530,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmDictionary [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmDictionary origin=GET_PROPERTY - : kotlin.Byte? + then: CALL 'internal final fun getDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmDictionary [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmDictionary origin=GET_PROPERTY + : kotlin.Byte? + : kotlin.Byte? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="nullableByteDictionaryField" @@ -5392,8 +5555,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmDictionary declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmDictionary origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, dictionary: io.realm.kotlin.types.RealmDictionary, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : kotlin.Byte? + then: CALL 'internal final fun setDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, dictionary: io.realm.kotlin.types.RealmDictionary, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : kotlin.Byte? + : kotlin.Byte? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="nullableByteDictionaryField" @@ -5421,8 +5585,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmDictionary [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmDictionary origin=GET_PROPERTY - : kotlin.Char? + then: CALL 'internal final fun getDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmDictionary [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmDictionary origin=GET_PROPERTY + : kotlin.Char? + : kotlin.Char? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="nullableCharDictionaryField" @@ -5445,8 +5610,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmDictionary declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmDictionary origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, dictionary: io.realm.kotlin.types.RealmDictionary, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : kotlin.Char? + then: CALL 'internal final fun setDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, dictionary: io.realm.kotlin.types.RealmDictionary, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : kotlin.Char? + : kotlin.Char? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="nullableCharDictionaryField" @@ -5474,8 +5640,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmDictionary [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmDictionary origin=GET_PROPERTY - : kotlin.Short? + then: CALL 'internal final fun getDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmDictionary [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmDictionary origin=GET_PROPERTY + : kotlin.Short? + : kotlin.Short? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="nullableShortDictionaryField" @@ -5498,8 +5665,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmDictionary declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmDictionary origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, dictionary: io.realm.kotlin.types.RealmDictionary, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : kotlin.Short? + then: CALL 'internal final fun setDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, dictionary: io.realm.kotlin.types.RealmDictionary, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : kotlin.Short? + : kotlin.Short? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="nullableShortDictionaryField" @@ -5527,8 +5695,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmDictionary [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmDictionary origin=GET_PROPERTY - : kotlin.Int? + then: CALL 'internal final fun getDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmDictionary [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmDictionary origin=GET_PROPERTY + : kotlin.Int? + : kotlin.Int? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="nullableIntDictionaryField" @@ -5551,8 +5720,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmDictionary declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmDictionary origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, dictionary: io.realm.kotlin.types.RealmDictionary, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : kotlin.Int? + then: CALL 'internal final fun setDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, dictionary: io.realm.kotlin.types.RealmDictionary, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : kotlin.Int? + : kotlin.Int? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="nullableIntDictionaryField" @@ -5580,8 +5750,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmDictionary [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmDictionary origin=GET_PROPERTY - : kotlin.Long? + then: CALL 'internal final fun getDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmDictionary [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmDictionary origin=GET_PROPERTY + : kotlin.Long? + : kotlin.Long? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="nullableLongDictionaryField" @@ -5604,8 +5775,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmDictionary declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmDictionary origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, dictionary: io.realm.kotlin.types.RealmDictionary, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : kotlin.Long? + then: CALL 'internal final fun setDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, dictionary: io.realm.kotlin.types.RealmDictionary, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : kotlin.Long? + : kotlin.Long? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="nullableLongDictionaryField" @@ -5633,8 +5805,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmDictionary [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmDictionary origin=GET_PROPERTY - : kotlin.Boolean? + then: CALL 'internal final fun getDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmDictionary [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmDictionary origin=GET_PROPERTY + : kotlin.Boolean? + : kotlin.Boolean? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="nullableBooleanDictionaryField" @@ -5657,8 +5830,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmDictionary declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmDictionary origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, dictionary: io.realm.kotlin.types.RealmDictionary, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : kotlin.Boolean? + then: CALL 'internal final fun setDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, dictionary: io.realm.kotlin.types.RealmDictionary, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : kotlin.Boolean? + : kotlin.Boolean? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="nullableBooleanDictionaryField" @@ -5686,8 +5860,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmDictionary [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmDictionary origin=GET_PROPERTY - : kotlin.Float? + then: CALL 'internal final fun getDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmDictionary [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmDictionary origin=GET_PROPERTY + : kotlin.Float? + : kotlin.Float? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="nullableFloatDictionaryField" @@ -5710,8 +5885,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmDictionary declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmDictionary origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, dictionary: io.realm.kotlin.types.RealmDictionary, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : kotlin.Float? + then: CALL 'internal final fun setDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, dictionary: io.realm.kotlin.types.RealmDictionary, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : kotlin.Float? + : kotlin.Float? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="nullableFloatDictionaryField" @@ -5739,8 +5915,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmDictionary [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmDictionary origin=GET_PROPERTY - : kotlin.Double? + then: CALL 'internal final fun getDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmDictionary [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmDictionary origin=GET_PROPERTY + : kotlin.Double? + : kotlin.Double? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="nullableDoubleDictionaryField" @@ -5763,8 +5940,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmDictionary declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmDictionary origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, dictionary: io.realm.kotlin.types.RealmDictionary, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : kotlin.Double? + then: CALL 'internal final fun setDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, dictionary: io.realm.kotlin.types.RealmDictionary, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : kotlin.Double? + : kotlin.Double? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="nullableDoubleDictionaryField" @@ -5792,8 +5970,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmDictionary [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmDictionary origin=GET_PROPERTY - : io.realm.kotlin.types.RealmInstant? + then: CALL 'internal final fun getDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmDictionary [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmDictionary origin=GET_PROPERTY + : io.realm.kotlin.types.RealmInstant? + : io.realm.kotlin.types.RealmInstant? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="nullableTimestampDictionaryField" @@ -5816,8 +5995,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmDictionary declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmDictionary origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, dictionary: io.realm.kotlin.types.RealmDictionary, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : io.realm.kotlin.types.RealmInstant? + then: CALL 'internal final fun setDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, dictionary: io.realm.kotlin.types.RealmDictionary, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : io.realm.kotlin.types.RealmInstant? + : io.realm.kotlin.types.RealmInstant? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="nullableTimestampDictionaryField" @@ -5845,8 +6025,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmDictionary [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmDictionary origin=GET_PROPERTY - : io.realm.kotlin.types.ObjectId? + then: CALL 'internal final fun getDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmDictionary [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmDictionary origin=GET_PROPERTY + : io.realm.kotlin.types.ObjectId? + : io.realm.kotlin.types.ObjectId? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="nullableObjectIdDictionaryField" @@ -5869,8 +6050,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmDictionary declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmDictionary origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, dictionary: io.realm.kotlin.types.RealmDictionary, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : io.realm.kotlin.types.ObjectId? + then: CALL 'internal final fun setDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, dictionary: io.realm.kotlin.types.RealmDictionary, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : io.realm.kotlin.types.ObjectId? + : io.realm.kotlin.types.ObjectId? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="nullableObjectIdDictionaryField" @@ -5898,8 +6080,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmDictionary [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmDictionary origin=GET_PROPERTY - : org.mongodb.kbson.BsonObjectId? + then: CALL 'internal final fun getDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmDictionary [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmDictionary origin=GET_PROPERTY + : org.mongodb.kbson.BsonObjectId? + : org.mongodb.kbson.BsonObjectId? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="nullableBsonObjectIdDictionaryField" @@ -5922,8 +6105,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmDictionary declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmDictionary origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, dictionary: io.realm.kotlin.types.RealmDictionary, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : org.mongodb.kbson.BsonObjectId? + then: CALL 'internal final fun setDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, dictionary: io.realm.kotlin.types.RealmDictionary, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : org.mongodb.kbson.BsonObjectId? + : org.mongodb.kbson.BsonObjectId? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="nullableBsonObjectIdDictionaryField" @@ -5951,8 +6135,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmDictionary [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmDictionary origin=GET_PROPERTY - : io.realm.kotlin.types.RealmUUID? + then: CALL 'internal final fun getDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmDictionary [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmDictionary origin=GET_PROPERTY + : io.realm.kotlin.types.RealmUUID? + : io.realm.kotlin.types.RealmUUID? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="nullableUUIDDictionaryField" @@ -5975,8 +6160,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmDictionary declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmDictionary origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, dictionary: io.realm.kotlin.types.RealmDictionary, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : io.realm.kotlin.types.RealmUUID? + then: CALL 'internal final fun setDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, dictionary: io.realm.kotlin.types.RealmDictionary, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : io.realm.kotlin.types.RealmUUID? + : io.realm.kotlin.types.RealmUUID? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="nullableUUIDDictionaryField" @@ -6004,8 +6190,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmDictionary [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmDictionary origin=GET_PROPERTY - : kotlin.ByteArray? + then: CALL 'internal final fun getDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmDictionary [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmDictionary origin=GET_PROPERTY + : kotlin.ByteArray? + : kotlin.ByteArray? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="nullableBinaryDictionaryField" @@ -6028,8 +6215,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmDictionary declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmDictionary origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, dictionary: io.realm.kotlin.types.RealmDictionary, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : kotlin.ByteArray? + then: CALL 'internal final fun setDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, dictionary: io.realm.kotlin.types.RealmDictionary, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : kotlin.ByteArray? + : kotlin.ByteArray? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="nullableBinaryDictionaryField" @@ -6057,8 +6245,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmDictionary [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmDictionary origin=GET_PROPERTY - : org.mongodb.kbson.BsonDecimal128?{ org.mongodb.kbson.Decimal128Kt.Decimal128? } + then: CALL 'internal final fun getDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmDictionary [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmDictionary origin=GET_PROPERTY + : org.mongodb.kbson.BsonDecimal128?{ org.mongodb.kbson.Decimal128Kt.Decimal128? } + : org.mongodb.kbson.BsonDecimal128?{ org.mongodb.kbson.Decimal128Kt.Decimal128? } $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="nullableDecimal128DictionaryField" @@ -6081,8 +6270,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmDictionary declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmDictionary origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, dictionary: io.realm.kotlin.types.RealmDictionary, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : org.mongodb.kbson.BsonDecimal128?{ org.mongodb.kbson.Decimal128Kt.Decimal128? } + then: CALL 'internal final fun setDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, dictionary: io.realm.kotlin.types.RealmDictionary, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : org.mongodb.kbson.BsonDecimal128?{ org.mongodb.kbson.Decimal128Kt.Decimal128? } + : org.mongodb.kbson.BsonDecimal128?{ org.mongodb.kbson.Decimal128Kt.Decimal128? } $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="nullableDecimal128DictionaryField" @@ -6110,8 +6300,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmDictionary [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmDictionary origin=GET_PROPERTY - : io.realm.kotlin.types.RealmAny? + then: CALL 'internal final fun getDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmDictionary [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmDictionary origin=GET_PROPERTY + : io.realm.kotlin.types.RealmAny? + : io.realm.kotlin.types.RealmAny? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="nullableRealmAnyDictionaryField" @@ -6134,8 +6325,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmDictionary declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmDictionary origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, dictionary: io.realm.kotlin.types.RealmDictionary, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : io.realm.kotlin.types.RealmAny? + then: CALL 'internal final fun setDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, dictionary: io.realm.kotlin.types.RealmDictionary, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : io.realm.kotlin.types.RealmAny? + : io.realm.kotlin.types.RealmAny? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="nullableRealmAnyDictionaryField" @@ -6163,8 +6355,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmDictionary [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmDictionary origin=GET_PROPERTY - : sample.input.Sample? + then: CALL 'internal final fun getDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmDictionary [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmDictionary origin=GET_PROPERTY + : sample.input.Sample? + : sample.input.Sample? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="nullableObjectDictionaryField" @@ -6187,8 +6380,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmDictionary declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmDictionary origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, dictionary: io.realm.kotlin.types.RealmDictionary, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : sample.input.Sample? + then: CALL 'internal final fun setDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, dictionary: io.realm.kotlin.types.RealmDictionary, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : sample.input.Sample? + : sample.input.Sample? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="nullableObjectDictionaryField" @@ -6216,8 +6410,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun getDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.internal.ManagedRealmDictionary [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmDictionary origin=GET_PROPERTY - : sample.input.EmbeddedChild? + then: CALL 'internal final fun getDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?): io.realm.kotlin.internal.ManagedRealmDictionary [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.internal.ManagedRealmDictionary origin=GET_PROPERTY + : sample.input.EmbeddedChild? + : sample.input.EmbeddedChild? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="nullableEmbeddedObjectDictionaryField" @@ -6240,8 +6435,9 @@ MODULE_FRAGMENT name:
value: GET_VAR ': io.realm.kotlin.types.RealmDictionary declared in sample.input.Sample.' type=io.realm.kotlin.types.RealmDictionary origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'internal final fun setDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, dictionary: io.realm.kotlin.types.RealmDictionary, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY - : sample.input.EmbeddedChild? + then: CALL 'internal final fun setDictionary (obj: io.realm.kotlin.internal.RealmObjectReference, col: kotlin.String, dictionary: io.realm.kotlin.types.RealmDictionary, typeAdapter: io.realm.kotlin.types.RealmTypeAdapter?, updatePolicy: io.realm.kotlin.UpdatePolicy, cache: kotlin.collections.MutableMap{ io.realm.kotlin.internal.RealmUtilsKt.UnmanagedToManagedObjectCache }): kotlin.Unit [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Unit origin=GET_PROPERTY + : sample.input.EmbeddedChild? + : sample.input.EmbeddedChild? $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null col: CONST String type=kotlin.String value="nullableEmbeddedObjectDictionaryField" @@ -6374,7 +6570,7 @@ MODULE_FRAGMENT name:
BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: CALL 'internal final fun getObject (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): kotlin.Any? [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Any? origin=GET_PROPERTY - : sample.input.Child? + : sample.input.Child : $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null @@ -6502,8 +6698,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'public final fun fromRealm (converterClass: kotlin.reflect.KClass>, realmValue: kotlin.Any): kotlin.Any [inline] declared in io.realm.kotlin.internal.ConvertersKt' type=kotlin.Any origin=null - converterClass: CONST Null type=kotlin.Nothing? value=null + then: CALL 'public final fun fromRealm (obj: io.realm.kotlin.internal.RealmObjectReference, adapterClass: kotlin.reflect.KClass<*>, realmValue: kotlin.Any): kotlin.Any? [inline] declared in io.realm.kotlin.internal.ConvertersKt' type=kotlin.Any? origin=null + obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null + adapterClass: CLASS_REFERENCE 'CLASS CLASS name:RealmInstantBsonDateTimeAdapterInstanced modality:FINAL visibility:public superTypes:[io.realm.kotlin.types.RealmTypeAdapter]' type=kotlin.reflect.KClass realmValue: CALL 'internal final fun getInstant (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.types.RealmInstant? [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.types.RealmInstant? origin=GET_PROPERTY $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null @@ -6531,8 +6728,9 @@ MODULE_FRAGMENT name:
$this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="instancedAdaptedRealmInstant" - value: CALL 'public final fun toRealm (converterClass: kotlin.reflect.KClass>, userValue: kotlin.Any): kotlin.Any [inline] declared in io.realm.kotlin.internal.ConvertersKt' type=kotlin.Any origin=null - converterClass: CONST Null type=kotlin.Nothing? value=null + value: CALL 'public final fun toRealm (obj: io.realm.kotlin.internal.RealmObjectReference, adapterClass: kotlin.reflect.KClass<*>, userValue: kotlin.Any?): kotlin.Any? [inline] declared in io.realm.kotlin.internal.ConvertersKt' type=kotlin.Any? origin=null + obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null + adapterClass: CLASS_REFERENCE 'CLASS CLASS name:RealmInstantBsonDateTimeAdapterInstanced modality:FINAL visibility:public superTypes:[io.realm.kotlin.types.RealmTypeAdapter]' type=kotlin.reflect.KClass userValue: GET_VAR ': org.mongodb.kbson.BsonDateTime declared in sample.input.Sample.' type=org.mongodb.kbson.BsonDateTime origin=null FUN name:dumpSchema visibility:public modality:FINAL <> ($this:sample.input.Sample) returnType:kotlin.String $this: VALUE_PARAMETER name: type:sample.input.Sample @@ -7985,6 +8183,146 @@ MODULE_FRAGMENT name:
RETURN type=kotlin.Nothing from='public final fun (): kotlin.String declared in sample.input.Sample.Companion' GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:io_realm_kotlin_className type:kotlin.String visibility:private' type=kotlin.String origin=null receiver: GET_VAR ': sample.input.Sample.Companion declared in sample.input.Sample.Companion.' type=sample.input.Sample.Companion origin=null + PROPERTY name:io_realm_kotlin_useCustomType visibility:public modality:FINAL [var] + FIELD PROPERTY_BACKING_FIELD name:io_realm_kotlin_useCustomType type:kotlin.collections.Set visibility:private + EXPRESSION_BODY + CALL 'public final fun setOf (vararg elements: T of kotlin.collections.SetsKt.setOf): kotlin.collections.Set declared in kotlin.collections.SetsKt' type=kotlin.collections.Set origin=null + : kotlin.String + elements: VARARG type=kotlin.Array varargElementType=kotlin.collections.Set + CONST String type=kotlin.String value="id" + CONST String type=kotlin.String value="stringField" + CONST String type=kotlin.String value="byteField" + CONST String type=kotlin.String value="charField" + CONST String type=kotlin.String value="shortField" + CONST String type=kotlin.String value="intField" + CONST String type=kotlin.String value="longField" + CONST String type=kotlin.String value="booleanField" + CONST String type=kotlin.String value="floatField" + CONST String type=kotlin.String value="doubleField" + CONST String type=kotlin.String value="decimal128Field" + CONST String type=kotlin.String value="timestampField" + CONST String type=kotlin.String value="objectIdField" + CONST String type=kotlin.String value="bsonObjectIdField" + CONST String type=kotlin.String value="uuidField" + CONST String type=kotlin.String value="byteArrayField" + CONST String type=kotlin.String value="mutableRealmInt" + CONST String type=kotlin.String value="child" + CONST String type=kotlin.String value="nullableRealmAny" + CONST String type=kotlin.String value="stringListField" + CONST String type=kotlin.String value="byteListField" + CONST String type=kotlin.String value="charListField" + CONST String type=kotlin.String value="shortListField" + CONST String type=kotlin.String value="intListField" + CONST String type=kotlin.String value="longListField" + CONST String type=kotlin.String value="booleanListField" + CONST String type=kotlin.String value="floatListField" + CONST String type=kotlin.String value="doubleListField" + CONST String type=kotlin.String value="timestampListField" + CONST String type=kotlin.String value="objectIdListField" + CONST String type=kotlin.String value="bsonObjectIdListField" + CONST String type=kotlin.String value="uuidListField" + CONST String type=kotlin.String value="binaryListField" + CONST String type=kotlin.String value="decimal128ListField" + CONST String type=kotlin.String value="objectListField" + CONST String type=kotlin.String value="embeddedRealmObjectListField" + CONST String type=kotlin.String value="nullableStringListField" + CONST String type=kotlin.String value="nullableByteListField" + CONST String type=kotlin.String value="nullableCharListField" + CONST String type=kotlin.String value="nullableShortListField" + CONST String type=kotlin.String value="nullableIntListField" + CONST String type=kotlin.String value="nullableLongListField" + CONST String type=kotlin.String value="nullableBooleanListField" + CONST String type=kotlin.String value="nullableFloatListField" + CONST String type=kotlin.String value="nullableDoubleListField" + CONST String type=kotlin.String value="nullableTimestampListField" + CONST String type=kotlin.String value="nullableObjectIdListField" + CONST String type=kotlin.String value="nullableBsonObjectIdListField" + CONST String type=kotlin.String value="nullableUUIDListField" + CONST String type=kotlin.String value="nullableBinaryListField" + CONST String type=kotlin.String value="nullableDecimal128ListField" + CONST String type=kotlin.String value="nullableRealmAnyListField" + CONST String type=kotlin.String value="stringSetField" + CONST String type=kotlin.String value="byteSetField" + CONST String type=kotlin.String value="charSetField" + CONST String type=kotlin.String value="shortSetField" + CONST String type=kotlin.String value="intSetField" + CONST String type=kotlin.String value="longSetField" + CONST String type=kotlin.String value="booleanSetField" + CONST String type=kotlin.String value="floatSetField" + CONST String type=kotlin.String value="doubleSetField" + CONST String type=kotlin.String value="timestampSetField" + CONST String type=kotlin.String value="objectIdSetField" + CONST String type=kotlin.String value="bsonObjectIdSetField" + CONST String type=kotlin.String value="uuidSetField" + CONST String type=kotlin.String value="binarySetField" + CONST String type=kotlin.String value="decimal128SetField" + CONST String type=kotlin.String value="objectSetField" + CONST String type=kotlin.String value="nullableStringSetField" + CONST String type=kotlin.String value="nullableByteSetField" + CONST String type=kotlin.String value="nullableCharSetField" + CONST String type=kotlin.String value="nullableShortSetField" + CONST String type=kotlin.String value="nullableIntSetField" + CONST String type=kotlin.String value="nullableLongSetField" + CONST String type=kotlin.String value="nullableBooleanSetField" + CONST String type=kotlin.String value="nullableFloatSetField" + CONST String type=kotlin.String value="nullableDoubleSetField" + CONST String type=kotlin.String value="nullableTimestampSetField" + CONST String type=kotlin.String value="nullableObjectIdSetField" + CONST String type=kotlin.String value="nullableBsonObjectIdSetField" + CONST String type=kotlin.String value="nullableUUIDSetField" + CONST String type=kotlin.String value="nullableBinarySetField" + CONST String type=kotlin.String value="nullableDecimal128SetField" + CONST String type=kotlin.String value="nullableRealmAnySetField" + CONST String type=kotlin.String value="stringDictionaryField" + CONST String type=kotlin.String value="byteDictionaryField" + CONST String type=kotlin.String value="charDictionaryField" + CONST String type=kotlin.String value="shortDictionaryField" + CONST String type=kotlin.String value="intDictionaryField" + CONST String type=kotlin.String value="longDictionaryField" + CONST String type=kotlin.String value="booleanDictionaryField" + CONST String type=kotlin.String value="floatDictionaryField" + CONST String type=kotlin.String value="doubleDictionaryField" + CONST String type=kotlin.String value="timestampDictionaryField" + CONST String type=kotlin.String value="objectIdDictionaryField" + CONST String type=kotlin.String value="bsonObjectIdDictionaryField" + CONST String type=kotlin.String value="uuidDictionaryField" + CONST String type=kotlin.String value="binaryDictionaryField" + CONST String type=kotlin.String value="decimal128DictionaryField" + CONST String type=kotlin.String value="nullableStringDictionaryField" + CONST String type=kotlin.String value="nullableByteDictionaryField" + CONST String type=kotlin.String value="nullableCharDictionaryField" + CONST String type=kotlin.String value="nullableShortDictionaryField" + CONST String type=kotlin.String value="nullableIntDictionaryField" + CONST String type=kotlin.String value="nullableLongDictionaryField" + CONST String type=kotlin.String value="nullableBooleanDictionaryField" + CONST String type=kotlin.String value="nullableFloatDictionaryField" + CONST String type=kotlin.String value="nullableDoubleDictionaryField" + CONST String type=kotlin.String value="nullableTimestampDictionaryField" + CONST String type=kotlin.String value="nullableObjectIdDictionaryField" + CONST String type=kotlin.String value="nullableBsonObjectIdDictionaryField" + CONST String type=kotlin.String value="nullableUUIDDictionaryField" + CONST String type=kotlin.String value="nullableBinaryDictionaryField" + CONST String type=kotlin.String value="nullableDecimal128DictionaryField" + CONST String type=kotlin.String value="nullableRealmAnyDictionaryField" + CONST String type=kotlin.String value="nullableObjectDictionaryField" + CONST String type=kotlin.String value="nullableEmbeddedObjectDictionaryField" + CONST String type=kotlin.String value="linkingObjectsByList" + CONST String type=kotlin.String value="linkingObjectsBySet" + CONST String type=kotlin.String value="linkingObjectsByDictionary" + CONST String type=kotlin.String value="persistedNameStringField" + CONST String type=kotlin.String value="persistedNameChildField" + CONST String type=kotlin.String value="persistedNameLinkingObjectsField" + CONST String type=kotlin.String value="singletonAdaptedRealmInstant" + CONST String type=kotlin.String value="instancedAdaptedRealmInstant" + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:sample.input.Sample.Companion) returnType:kotlin.collections.Set + correspondingProperty: PROPERTY name:io_realm_kotlin_useCustomType visibility:public modality:FINAL [var] + overridden: + public abstract fun (): kotlin.collections.Set declared in io.realm.kotlin.internal.RealmObjectCompanion + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:sample.input.Sample.Companion + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): kotlin.collections.Set declared in sample.input.Sample.Companion' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:io_realm_kotlin_useCustomType type:kotlin.collections.Set visibility:private' type=kotlin.collections.Set origin=null + receiver: GET_VAR ': sample.input.Sample.Companion declared in sample.input.Sample.Companion.' type=sample.input.Sample.Companion origin=null PROPERTY name:io_realm_kotlin_fields visibility:public modality:FINAL [var] FIELD PROPERTY_BACKING_FIELD name:io_realm_kotlin_fields type:kotlin.collections.Map> visibility:private EXPRESSION_BODY @@ -8712,7 +9050,7 @@ MODULE_FRAGMENT name:
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS OBJECT name:RealmInstantBsonDateTimeAdapterSingleton modality:FINAL visibility:public superTypes:[io.realm.kotlin.types.RealmTypeAdapter]' FUN name:fromRealm visibility:public modality:OPEN <> ($this:sample.input.RealmInstantBsonDateTimeAdapterSingleton, realmValue:io.realm.kotlin.types.RealmInstant) returnType:org.mongodb.kbson.BsonDateTime overridden: - public abstract fun fromRealm (realmValue: R of io.realm.kotlin.types.RealmTypeAdapter): U of io.realm.kotlin.types.RealmTypeAdapter declared in io.realm.kotlin.types.RealmTypeAdapter + public abstract fun fromRealm (realmValue: S of io.realm.kotlin.types.RealmTypeAdapter): U of io.realm.kotlin.types.RealmTypeAdapter declared in io.realm.kotlin.types.RealmTypeAdapter $this: VALUE_PARAMETER name: type:sample.input.RealmInstantBsonDateTimeAdapterSingleton VALUE_PARAMETER name:realmValue index:0 type:io.realm.kotlin.types.RealmInstant BLOCK_BODY @@ -8721,7 +9059,7 @@ MODULE_FRAGMENT name:
value: CONST Long type=kotlin.Long value=100 FUN name:toRealm visibility:public modality:OPEN <> ($this:sample.input.RealmInstantBsonDateTimeAdapterSingleton, value:org.mongodb.kbson.BsonDateTime) returnType:io.realm.kotlin.types.RealmInstant overridden: - public abstract fun toRealm (value: U of io.realm.kotlin.types.RealmTypeAdapter): R of io.realm.kotlin.types.RealmTypeAdapter declared in io.realm.kotlin.types.RealmTypeAdapter + public abstract fun toRealm (value: U of io.realm.kotlin.types.RealmTypeAdapter): S of io.realm.kotlin.types.RealmTypeAdapter declared in io.realm.kotlin.types.RealmTypeAdapter $this: VALUE_PARAMETER name: type:sample.input.RealmInstantBsonDateTimeAdapterSingleton VALUE_PARAMETER name:value index:0 type:org.mongodb.kbson.BsonDateTime BLOCK_BODY @@ -8749,7 +9087,7 @@ MODULE_FRAGMENT name:
INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:RealmInstantBsonDateTimeAdapterInstanced modality:FINAL visibility:public superTypes:[io.realm.kotlin.types.RealmTypeAdapter]' FUN name:fromRealm visibility:public modality:OPEN <> ($this:sample.input.RealmInstantBsonDateTimeAdapterInstanced, realmValue:io.realm.kotlin.types.RealmInstant) returnType:org.mongodb.kbson.BsonDateTime overridden: - public abstract fun fromRealm (realmValue: R of io.realm.kotlin.types.RealmTypeAdapter): U of io.realm.kotlin.types.RealmTypeAdapter declared in io.realm.kotlin.types.RealmTypeAdapter + public abstract fun fromRealm (realmValue: S of io.realm.kotlin.types.RealmTypeAdapter): U of io.realm.kotlin.types.RealmTypeAdapter declared in io.realm.kotlin.types.RealmTypeAdapter $this: VALUE_PARAMETER name: type:sample.input.RealmInstantBsonDateTimeAdapterInstanced VALUE_PARAMETER name:realmValue index:0 type:io.realm.kotlin.types.RealmInstant BLOCK_BODY @@ -8758,7 +9096,7 @@ MODULE_FRAGMENT name:
value: CONST Long type=kotlin.Long value=100 FUN name:toRealm visibility:public modality:OPEN <> ($this:sample.input.RealmInstantBsonDateTimeAdapterInstanced, value:org.mongodb.kbson.BsonDateTime) returnType:io.realm.kotlin.types.RealmInstant overridden: - public abstract fun toRealm (value: U of io.realm.kotlin.types.RealmTypeAdapter): R of io.realm.kotlin.types.RealmTypeAdapter declared in io.realm.kotlin.types.RealmTypeAdapter + public abstract fun toRealm (value: U of io.realm.kotlin.types.RealmTypeAdapter): S of io.realm.kotlin.types.RealmTypeAdapter declared in io.realm.kotlin.types.RealmTypeAdapter $this: VALUE_PARAMETER name: type:sample.input.RealmInstantBsonDateTimeAdapterInstanced VALUE_PARAMETER name:value index:0 type:org.mongodb.kbson.BsonDateTime BLOCK_BODY @@ -8972,6 +9310,24 @@ MODULE_FRAGMENT name:
RETURN type=kotlin.Nothing from='public final fun (): kotlin.String declared in sample.input.Child.Companion' GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:io_realm_kotlin_className type:kotlin.String visibility:private' type=kotlin.String origin=null receiver: GET_VAR ': sample.input.Child.Companion declared in sample.input.Child.Companion.' type=sample.input.Child.Companion origin=null + PROPERTY name:io_realm_kotlin_useCustomType visibility:public modality:FINAL [var] + FIELD PROPERTY_BACKING_FIELD name:io_realm_kotlin_useCustomType type:kotlin.collections.Set visibility:private + EXPRESSION_BODY + CALL 'public final fun setOf (vararg elements: T of kotlin.collections.SetsKt.setOf): kotlin.collections.Set declared in kotlin.collections.SetsKt' type=kotlin.collections.Set origin=null + : kotlin.String + elements: VARARG type=kotlin.Array varargElementType=kotlin.collections.Set + CONST String type=kotlin.String value="name" + CONST String type=kotlin.String value="linkingObjectsByObject" + CONST String type=kotlin.String value="persistedNameParent" + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:sample.input.Child.Companion) returnType:kotlin.collections.Set + correspondingProperty: PROPERTY name:io_realm_kotlin_useCustomType visibility:public modality:FINAL [var] + overridden: + public abstract fun (): kotlin.collections.Set declared in io.realm.kotlin.internal.RealmObjectCompanion + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:sample.input.Child.Companion + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): kotlin.collections.Set declared in sample.input.Child.Companion' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:io_realm_kotlin_useCustomType type:kotlin.collections.Set visibility:private' type=kotlin.collections.Set origin=null + receiver: GET_VAR ': sample.input.Child.Companion declared in sample.input.Child.Companion.' type=sample.input.Child.Companion origin=null PROPERTY name:io_realm_kotlin_fields visibility:public modality:FINAL [var] FIELD PROPERTY_BACKING_FIELD name:io_realm_kotlin_fields type:kotlin.collections.Map> visibility:private EXPRESSION_BODY @@ -9110,7 +9466,7 @@ MODULE_FRAGMENT name:
BRANCH if: CONST Boolean type=kotlin.Boolean value=true then: CALL 'internal final fun getObject (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): kotlin.Any? [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=kotlin.Any? origin=GET_PROPERTY - : sample.input.EmbeddedChild? + : sample.input.EmbeddedChild : $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.EmbeddedParent.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null @@ -9219,6 +9575,22 @@ MODULE_FRAGMENT name:
RETURN type=kotlin.Nothing from='public final fun (): kotlin.String declared in sample.input.EmbeddedParent.Companion' GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:io_realm_kotlin_className type:kotlin.String visibility:private' type=kotlin.String origin=null receiver: GET_VAR ': sample.input.EmbeddedParent.Companion declared in sample.input.EmbeddedParent.Companion.' type=sample.input.EmbeddedParent.Companion origin=null + PROPERTY name:io_realm_kotlin_useCustomType visibility:public modality:FINAL [var] + FIELD PROPERTY_BACKING_FIELD name:io_realm_kotlin_useCustomType type:kotlin.collections.Set visibility:private + EXPRESSION_BODY + CALL 'public final fun setOf (vararg elements: T of kotlin.collections.SetsKt.setOf): kotlin.collections.Set declared in kotlin.collections.SetsKt' type=kotlin.collections.Set origin=null + : kotlin.String + elements: VARARG type=kotlin.Array varargElementType=kotlin.collections.Set + CONST String type=kotlin.String value="child" + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:sample.input.EmbeddedParent.Companion) returnType:kotlin.collections.Set + correspondingProperty: PROPERTY name:io_realm_kotlin_useCustomType visibility:public modality:FINAL [var] + overridden: + public abstract fun (): kotlin.collections.Set declared in io.realm.kotlin.internal.RealmObjectCompanion + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:sample.input.EmbeddedParent.Companion + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): kotlin.collections.Set declared in sample.input.EmbeddedParent.Companion' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:io_realm_kotlin_useCustomType type:kotlin.collections.Set visibility:private' type=kotlin.collections.Set origin=null + receiver: GET_VAR ': sample.input.EmbeddedParent.Companion declared in sample.input.EmbeddedParent.Companion.' type=sample.input.EmbeddedParent.Companion origin=null PROPERTY name:io_realm_kotlin_fields visibility:public modality:FINAL [var] FIELD PROPERTY_BACKING_FIELD name:io_realm_kotlin_fields type:kotlin.collections.Map> visibility:private EXPRESSION_BODY @@ -9454,6 +9826,22 @@ MODULE_FRAGMENT name:
RETURN type=kotlin.Nothing from='public final fun (): kotlin.String declared in sample.input.EmbeddedChild.Companion' GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:io_realm_kotlin_className type:kotlin.String visibility:private' type=kotlin.String origin=null receiver: GET_VAR ': sample.input.EmbeddedChild.Companion declared in sample.input.EmbeddedChild.Companion.' type=sample.input.EmbeddedChild.Companion origin=null + PROPERTY name:io_realm_kotlin_useCustomType visibility:public modality:FINAL [var] + FIELD PROPERTY_BACKING_FIELD name:io_realm_kotlin_useCustomType type:kotlin.collections.Set visibility:private + EXPRESSION_BODY + CALL 'public final fun setOf (vararg elements: T of kotlin.collections.SetsKt.setOf): kotlin.collections.Set declared in kotlin.collections.SetsKt' type=kotlin.collections.Set origin=null + : kotlin.String + elements: VARARG type=kotlin.Array varargElementType=kotlin.collections.Set + CONST String type=kotlin.String value="name" + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:sample.input.EmbeddedChild.Companion) returnType:kotlin.collections.Set + correspondingProperty: PROPERTY name:io_realm_kotlin_useCustomType visibility:public modality:FINAL [var] + overridden: + public abstract fun (): kotlin.collections.Set declared in io.realm.kotlin.internal.RealmObjectCompanion + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:sample.input.EmbeddedChild.Companion + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): kotlin.collections.Set declared in sample.input.EmbeddedChild.Companion' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:io_realm_kotlin_useCustomType type:kotlin.collections.Set visibility:private' type=kotlin.collections.Set origin=null + receiver: GET_VAR ': sample.input.EmbeddedChild.Companion declared in sample.input.EmbeddedChild.Companion.' type=sample.input.EmbeddedChild.Companion origin=null PROPERTY name:io_realm_kotlin_fields visibility:public modality:FINAL [var] FIELD PROPERTY_BACKING_FIELD name:io_realm_kotlin_fields type:kotlin.collections.Map> visibility:private EXPRESSION_BODY diff --git a/packages/plugin-compiler/src/test/resources/schema/expected/01_AFTER.ValidateIrBeforeLowering.ir b/packages/plugin-compiler/src/test/resources/schema/expected/01_AFTER.ValidateIrBeforeLowering.ir index 72f689feb3..638ef72d55 100644 --- a/packages/plugin-compiler/src/test/resources/schema/expected/01_AFTER.ValidateIrBeforeLowering.ir +++ b/packages/plugin-compiler/src/test/resources/schema/expected/01_AFTER.ValidateIrBeforeLowering.ir @@ -76,6 +76,21 @@ MODULE_FRAGMENT name:
RETURN type=kotlin.Nothing from='public final fun (): kotlin.String declared in schema.input.A.Companion' GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:io_realm_kotlin_className type:kotlin.String visibility:private' type=kotlin.String origin=null receiver: GET_VAR ': schema.input.A.Companion declared in schema.input.A.Companion.' type=schema.input.A.Companion origin=null + PROPERTY name:io_realm_kotlin_useCustomType visibility:public modality:FINAL [var] + FIELD PROPERTY_BACKING_FIELD name:io_realm_kotlin_useCustomType type:kotlin.collections.Set visibility:private + EXPRESSION_BODY + CALL 'public final fun setOf (vararg elements: T of kotlin.collections.SetsKt.setOf): kotlin.collections.Set declared in kotlin.collections.SetsKt' type=kotlin.collections.Set origin=null + : kotlin.String + elements: VARARG type=kotlin.Array varargElementType=kotlin.collections.Set + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:schema.input.A.Companion) returnType:kotlin.collections.Set + correspondingProperty: PROPERTY name:io_realm_kotlin_useCustomType visibility:public modality:FINAL [var] + overridden: + public abstract fun (): kotlin.collections.Set declared in io.realm.kotlin.internal.RealmObjectCompanion + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:schema.input.A.Companion + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): kotlin.collections.Set declared in schema.input.A.Companion' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:io_realm_kotlin_useCustomType type:kotlin.collections.Set visibility:private' type=kotlin.collections.Set origin=null + receiver: GET_VAR ': schema.input.A.Companion declared in schema.input.A.Companion.' type=schema.input.A.Companion origin=null PROPERTY name:io_realm_kotlin_fields visibility:public modality:FINAL [var] FIELD PROPERTY_BACKING_FIELD name:io_realm_kotlin_fields type:kotlin.collections.Map> visibility:private EXPRESSION_BODY @@ -245,6 +260,21 @@ MODULE_FRAGMENT name:
RETURN type=kotlin.Nothing from='public final fun (): kotlin.String declared in schema.input.B.Companion' GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:io_realm_kotlin_className type:kotlin.String visibility:private' type=kotlin.String origin=null receiver: GET_VAR ': schema.input.B.Companion declared in schema.input.B.Companion.' type=schema.input.B.Companion origin=null + PROPERTY name:io_realm_kotlin_useCustomType visibility:public modality:FINAL [var] + FIELD PROPERTY_BACKING_FIELD name:io_realm_kotlin_useCustomType type:kotlin.collections.Set visibility:private + EXPRESSION_BODY + CALL 'public final fun setOf (vararg elements: T of kotlin.collections.SetsKt.setOf): kotlin.collections.Set declared in kotlin.collections.SetsKt' type=kotlin.collections.Set origin=null + : kotlin.String + elements: VARARG type=kotlin.Array varargElementType=kotlin.collections.Set + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:schema.input.B.Companion) returnType:kotlin.collections.Set + correspondingProperty: PROPERTY name:io_realm_kotlin_useCustomType visibility:public modality:FINAL [var] + overridden: + public abstract fun (): kotlin.collections.Set declared in io.realm.kotlin.internal.RealmObjectCompanion + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:schema.input.B.Companion + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): kotlin.collections.Set declared in schema.input.B.Companion' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:io_realm_kotlin_useCustomType type:kotlin.collections.Set visibility:private' type=kotlin.collections.Set origin=null + receiver: GET_VAR ': schema.input.B.Companion declared in schema.input.B.Companion.' type=schema.input.B.Companion origin=null PROPERTY name:io_realm_kotlin_fields visibility:public modality:FINAL [var] FIELD PROPERTY_BACKING_FIELD name:io_realm_kotlin_fields type:kotlin.collections.Map> visibility:private EXPRESSION_BODY @@ -414,6 +444,21 @@ MODULE_FRAGMENT name:
RETURN type=kotlin.Nothing from='public final fun (): kotlin.String declared in schema.input.C.Companion' GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:io_realm_kotlin_className type:kotlin.String visibility:private' type=kotlin.String origin=null receiver: GET_VAR ': schema.input.C.Companion declared in schema.input.C.Companion.' type=schema.input.C.Companion origin=null + PROPERTY name:io_realm_kotlin_useCustomType visibility:public modality:FINAL [var] + FIELD PROPERTY_BACKING_FIELD name:io_realm_kotlin_useCustomType type:kotlin.collections.Set visibility:private + EXPRESSION_BODY + CALL 'public final fun setOf (vararg elements: T of kotlin.collections.SetsKt.setOf): kotlin.collections.Set declared in kotlin.collections.SetsKt' type=kotlin.collections.Set origin=null + : kotlin.String + elements: VARARG type=kotlin.Array varargElementType=kotlin.collections.Set + FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:schema.input.C.Companion) returnType:kotlin.collections.Set + correspondingProperty: PROPERTY name:io_realm_kotlin_useCustomType visibility:public modality:FINAL [var] + overridden: + public abstract fun (): kotlin.collections.Set declared in io.realm.kotlin.internal.RealmObjectCompanion + $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:schema.input.C.Companion + BLOCK_BODY + RETURN type=kotlin.Nothing from='public final fun (): kotlin.collections.Set declared in schema.input.C.Companion' + GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:io_realm_kotlin_useCustomType type:kotlin.collections.Set visibility:private' type=kotlin.collections.Set origin=null + receiver: GET_VAR ': schema.input.C.Companion declared in schema.input.C.Companion.' type=schema.input.C.Companion origin=null PROPERTY name:io_realm_kotlin_fields visibility:public modality:FINAL [var] FIELD PROPERTY_BACKING_FIELD name:io_realm_kotlin_fields type:kotlin.collections.Map> visibility:private EXPRESSION_BODY From 38fe50f05bf23788dac0259f9010845034fd5698 Mon Sep 17 00:00:00 2001 From: Clemente Date: Wed, 20 Dec 2023 13:00:53 +0100 Subject: [PATCH 22/32] Fix expected IR --- .../sample/expected/01_AFTER.ValidateIrBeforeLowering.ir | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/plugin-compiler/src/test/resources/sample/expected/01_AFTER.ValidateIrBeforeLowering.ir b/packages/plugin-compiler/src/test/resources/sample/expected/01_AFTER.ValidateIrBeforeLowering.ir index 90a4473df6..c81b4275c4 100644 --- a/packages/plugin-compiler/src/test/resources/sample/expected/01_AFTER.ValidateIrBeforeLowering.ir +++ b/packages/plugin-compiler/src/test/resources/sample/expected/01_AFTER.ValidateIrBeforeLowering.ir @@ -1,6 +1,6 @@ // --- IR for
after Validate IR before lowering MODULE_FRAGMENT name:
- FILE fqName:sample.input fileName:/Users/clemente.tort/realm-kotlin/packages/plugin-compiler/build/resources/test/sample/input/Sample.kt + FILE fqName:sample.input fileName:input/Sample.kt CLASS CLASS name:Sample modality:OPEN visibility:public superTypes:[io.realm.kotlin.types.RealmObject; io.realm.kotlin.internal.RealmObjectInternal] $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:sample.input.Sample CONSTRUCTOR visibility:public <> () returnType:sample.input.Sample [primary] From a7111b12f0b309add78c85bf542f3afc83d26b69 Mon Sep 17 00:00:00 2001 From: Clemente Date: Wed, 20 Dec 2023 15:16:28 +0100 Subject: [PATCH 23/32] Remove uses type adapter compile computed property --- .../kotlin/internal/RealmObjectCompanion.kt | 1 - .../kotlin/internal/RealmObjectHelper.kt | 136 +++++++------ .../internal/schema/CachedClassKeyMap.kt | 3 - .../compiler/AccessorModifierIrGeneration.kt | 2 +- .../io/realm/kotlin/compiler/Identifiers.kt | 2 - .../io/realm/kotlin/compiler/IrUtils.kt | 2 +- ...RealmModelSyntheticPropertiesGeneration.kt | 52 ----- .../01_AFTER.ValidateIrBeforeLowering.ir | 190 ------------------ .../01_AFTER.ValidateIrBeforeLowering.ir | 45 ----- 9 files changed, 81 insertions(+), 352 deletions(-) diff --git a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmObjectCompanion.kt b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmObjectCompanion.kt index 859d388cbf..7f345fdcac 100644 --- a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmObjectCompanion.kt +++ b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmObjectCompanion.kt @@ -33,7 +33,6 @@ public interface RealmObjectCompanion { public val `io_realm_kotlin_fields`: Map> public val `io_realm_kotlin_primaryKey`: KMutableProperty1<*, *>? public val `io_realm_kotlin_classKind`: RealmClassKind - public val `io_realm_kotlin_useCustomType`: Set public fun `io_realm_kotlin_schema`(): RealmClassImpl public fun `io_realm_kotlin_newInstance`(): Any } diff --git a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmObjectHelper.kt b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmObjectHelper.kt index a08ab21104..56e1fb9bc1 100644 --- a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmObjectHelper.kt +++ b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmObjectHelper.kt @@ -795,76 +795,98 @@ internal object RealmObjectHelper { } accessor as KMutableProperty1 - if (property.usesCustomType) { - // Passthrough values when a property uses a custom type adapter, values will be converted automatically. - val getterValue = accessor.get(source) - accessor.set(target, getterValue) - } else { - when (property.collectionType) { - CollectionType.RLM_COLLECTION_TYPE_NONE -> when (property.type) { - PropertyType.RLM_PROPERTY_TYPE_OBJECT -> { - val isTargetEmbedded = - target.realmObjectReference!!.owner.schemaMetadata.getOrThrow(property.linkTarget).isEmbeddedRealmObject - if (isTargetEmbedded) { - val value = accessor.get(source) as EmbeddedRealmObject? - setEmbeddedRealmObjectByKey( - target.realmObjectReference!!, - property.key, - value, - updatePolicy, - cache - ) - } else { - val value = accessor.get(source) as RealmObject? - setObjectByKey( - target.realmObjectReference!!, - property.key, - value, - updatePolicy, - cache - ) - } + when (property.collectionType) { + CollectionType.RLM_COLLECTION_TYPE_NONE -> when (property.type) { + PropertyType.RLM_PROPERTY_TYPE_OBJECT -> { + val isTargetEmbedded = + target.realmObjectReference!!.owner.schemaMetadata.getOrThrow(property.linkTarget).isEmbeddedRealmObject + if (isTargetEmbedded) { + val value = accessor.get(source) as EmbeddedRealmObject? + setEmbeddedRealmObjectByKey( + target.realmObjectReference!!, + property.key, + value, + updatePolicy, + cache + ) + } else { + val value = accessor.get(source) as RealmObject? + setObjectByKey( + target.realmObjectReference!!, + property.key, + value, + updatePolicy, + cache + ) + } + } + + else -> { + val getterValue = accessor.get(source) + accessor.set(target, getterValue) + } + } + + CollectionType.RLM_COLLECTION_TYPE_LIST -> { + when (val managedList = accessor.get(target)) { + // We cannot use setList as that requires the type, so we need to retrieve the + // existing list, wipe it and insert new elements + is ManagedRealmList<*> -> { + managedList.clear() + val elements = accessor.get(source) as RealmList + managedList.operator.insertAll( + managedList.size, + elements, + updatePolicy, + cache + ) } + else -> { + // Passthrough values when a property uses a custom type adapter, values will be converted automatically. val getterValue = accessor.get(source) accessor.set(target, getterValue) } } - CollectionType.RLM_COLLECTION_TYPE_LIST -> { - // We cannot use setList as that requires the type, so we need to retrieve the - // existing list, wipe it and insert new elements - @Suppress("UNCHECKED_CAST") - (accessor.get(target) as ManagedRealmList) - .run { - clear() - val elements = accessor.get(source) as RealmList<*> - operator.insertAll(size, elements, updatePolicy, cache) - } - } - CollectionType.RLM_COLLECTION_TYPE_SET -> { + } + + CollectionType.RLM_COLLECTION_TYPE_SET -> { + when (val managedSet = accessor.get(target)) { // We cannot use setSet as that requires the type, so we need to retrieve the // existing set, wipe it and insert new elements - @Suppress("UNCHECKED_CAST") - (accessor.get(target) as ManagedRealmSet) - .run { - clear() - val elements = accessor.get(source) as RealmSet<*> - operator.addAll(elements, updatePolicy, cache) - } + is ManagedRealmSet<*> -> { + managedSet.clear() + val elements = accessor.get(source) as RealmSet + managedSet.operator.addAll(elements, updatePolicy, cache) + } + + else -> { + // Passthrough values when a property uses a custom type adapter, values will be converted automatically. + val getterValue = accessor.get(source) + accessor.set(target, getterValue) + } } - CollectionType.RLM_COLLECTION_TYPE_DICTIONARY -> { + } + + CollectionType.RLM_COLLECTION_TYPE_DICTIONARY -> { + when (val managedDictionary = accessor.get(target)) { // We cannot use setDictionary as that requires the type, so we need to retrieve // the existing dictionary, wipe it and insert new elements - @Suppress("UNCHECKED_CAST") - (accessor.get(target) as ManagedRealmDictionary) - .run { - clear() - val elements = accessor.get(source) as RealmDictionary<*> - operator.putAll(elements, updatePolicy, cache) - } + is ManagedRealmDictionary<*> -> { + managedDictionary.clear() + val elements = accessor.get(source) as RealmDictionary + managedDictionary.operator.putAll(elements, updatePolicy, cache) + } + + else -> { + // Passthrough values when a property uses a custom type adapter, values will be converted automatically. + val getterValue = accessor.get(source) + accessor.set(target, getterValue) + } } - else -> TODO("Collection type ${property.collectionType} is not supported") } + + else -> TODO("Collection type ${property.collectionType} is not supported") } } } diff --git a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/schema/CachedClassKeyMap.kt b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/schema/CachedClassKeyMap.kt index 17dd0cb8ce..a1ae2d6d0d 100644 --- a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/schema/CachedClassKeyMap.kt +++ b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/schema/CachedClassKeyMap.kt @@ -75,7 +75,6 @@ public interface PropertyMetadata { public val linkTarget: String public val linkOriginPropertyName: String public val isComputed: Boolean - public val usesCustomType: Boolean /** * Returns `true` if this property has been defined by the user, `false` is returned * if this property is only found in the on-disk schema. @@ -149,7 +148,6 @@ public class CachedClassMetadata( CachedPropertyMetadata( propertyInfo = propertyInfo, accessor = companion?.io_realm_kotlin_fields?.get(propertyInfo.name), - usesCustomType = companion?.io_realm_kotlin_useCustomType?.contains(propertyInfo.name) ?: false, ) } } @@ -171,7 +169,6 @@ public class CachedClassMetadata( public class CachedPropertyMetadata( propertyInfo: PropertyInfo, override val accessor: KProperty1? = null, - override val usesCustomType: Boolean, ) : PropertyMetadata { override val name: String = propertyInfo.name override val publicName: String = propertyInfo.publicName diff --git a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/AccessorModifierIrGeneration.kt b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/AccessorModifierIrGeneration.kt index 3b30122ecc..88f64973a0 100644 --- a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/AccessorModifierIrGeneration.kt +++ b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/AccessorModifierIrGeneration.kt @@ -823,7 +823,7 @@ class AccessorModifierIrGeneration(realmPluginContext: RealmPluginContext) : Rea declaration = declaration, computedType = propertyTypeRaw, collectionType = collectionType, - coreGenericTypes = listOf(coreGenericTypes) + coreGenericTypes = listOf(coreGenericTypes), ) fields[name] = schemaProperty // TODO OPTIMIZE consider synthetic property generation for lists to cache diff --git a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/Identifiers.kt b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/Identifiers.kt index 9b26251888..0df6d6e92c 100644 --- a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/Identifiers.kt +++ b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/Identifiers.kt @@ -36,8 +36,6 @@ internal object Names { Name.identifier("${REALM_SYNTHETIC_PROPERTY_PREFIX}className") val REALM_OBJECT_COMPANION_FIELDS_MEMBER: Name = Name.identifier("${REALM_SYNTHETIC_PROPERTY_PREFIX}fields") - val REALM_OBJECT_COMPANION_USE_CUSTOM_TYPE_MEMBER: Name = - Name.identifier("${REALM_SYNTHETIC_PROPERTY_PREFIX}useCustomType") val REALM_OBJECT_COMPANION_PRIMARY_KEY_MEMBER: Name = Name.identifier("${REALM_SYNTHETIC_PROPERTY_PREFIX}primaryKey") val REALM_OBJECT_COMPANION_CLASS_KIND: Name = diff --git a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/IrUtils.kt b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/IrUtils.kt index 9bb8d33197..5f7b8f7f51 100644 --- a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/IrUtils.kt +++ b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/IrUtils.kt @@ -413,7 +413,7 @@ data class SchemaProperty( val declaration: IrProperty, val computedType: IrType, val collectionType: CollectionType = CollectionType.NONE, - val coreGenericTypes: List? = null, + val coreGenericTypes: List? = null ) { val isComputed = propertyType == PropertyType.RLM_PROPERTY_TYPE_LINKING_OBJECTS val hasPersistedNameAnnotation = diff --git a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/RealmModelSyntheticPropertiesGeneration.kt b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/RealmModelSyntheticPropertiesGeneration.kt index 22fa05178d..f2fe995f7f 100644 --- a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/RealmModelSyntheticPropertiesGeneration.kt +++ b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/RealmModelSyntheticPropertiesGeneration.kt @@ -24,7 +24,6 @@ import io.realm.kotlin.compiler.ClassIds.INDEX_ANNOTATION import io.realm.kotlin.compiler.ClassIds.KBSON_OBJECT_ID import io.realm.kotlin.compiler.ClassIds.KOTLIN_COLLECTIONS_MAP import io.realm.kotlin.compiler.ClassIds.KOTLIN_COLLECTIONS_MAPOF -import io.realm.kotlin.compiler.ClassIds.KOTLIN_COLLECTIONS_SET import io.realm.kotlin.compiler.ClassIds.KOTLIN_PAIR import io.realm.kotlin.compiler.ClassIds.OBJECT_REFERENCE_CLASS import io.realm.kotlin.compiler.ClassIds.PRIMARY_KEY_ANNOTATION @@ -54,7 +53,6 @@ import io.realm.kotlin.compiler.Names.REALM_OBJECT_COMPANION_FIELDS_MEMBER import io.realm.kotlin.compiler.Names.REALM_OBJECT_COMPANION_NEW_INSTANCE_METHOD import io.realm.kotlin.compiler.Names.REALM_OBJECT_COMPANION_PRIMARY_KEY_MEMBER import io.realm.kotlin.compiler.Names.REALM_OBJECT_COMPANION_SCHEMA_METHOD -import io.realm.kotlin.compiler.Names.REALM_OBJECT_COMPANION_USE_CUSTOM_TYPE_MEMBER import io.realm.kotlin.compiler.Names.SET import org.jetbrains.kotlin.backend.common.extensions.IrPluginContext import org.jetbrains.kotlin.backend.common.lower.DeclarationIrBuilder @@ -160,7 +158,6 @@ class RealmModelSyntheticPropertiesGeneration(private val pluginContext: IrPlugi pluginContext.lookupClassOrThrow(ClassIds.KOTLIN_REFLECT_KPROPERTY1) private val mapClass: IrClass = pluginContext.lookupClassOrThrow(KOTLIN_COLLECTIONS_MAP) - private val setClass: IrClass = pluginContext.lookupClassOrThrow(KOTLIN_COLLECTIONS_SET) private val pairClass: IrClass = pluginContext.lookupClassOrThrow(KOTLIN_PAIR) private val pairCtor = pluginContext.lookupConstructorInClass(KOTLIN_PAIR) private val realmObjectMutablePropertyType = kMutableProperty1Class.typeWith( @@ -176,20 +173,11 @@ class RealmModelSyntheticPropertiesGeneration(private val pluginContext: IrPlugi val parameters = it.owner.valueParameters parameters.size == 1 && parameters.first().isVararg } - private val setOf = pluginContext.referenceFunctions(ClassIds.KOTLIN_COLLECTIONS_SETOF) - .first { - val parameters = it.owner.valueParameters - parameters.size == 1 && parameters.first().isVararg - } private val companionFieldsType = mapClass.typeWith( pluginContext.irBuiltIns.stringType, realmObjectMutablePropertyType ) - - private val companionCustomTypesType = setClass.typeWith( - pluginContext.irBuiltIns.stringType - ) @Suppress("UnusedPrivateMember") private val companionComputedFieldsType = mapClass.typeWith( pluginContext.irBuiltIns.stringType, @@ -302,46 +290,6 @@ class RealmModelSyntheticPropertiesGeneration(private val pluginContext: IrPlugi IrConstImpl.string(startOffset, endOffset, pluginContext.irBuiltIns.stringType, className) } - // Add `public val `io_realm_kotlin_useCustomType`: Set` property. - companion.addValueProperty( - pluginContext, - realmObjectCompanionInterface, - REALM_OBJECT_COMPANION_USE_CUSTOM_TYPE_MEMBER, - companionCustomTypesType, - ) { startOffset, endOffset -> - IrCallImpl( - startOffset = startOffset, endOffset = endOffset, - type = companionCustomTypesType, - symbol = setOf, - typeArgumentsCount = 1, - valueArgumentsCount = 1, - origin = null, - superQualifierSymbol = null - ).apply { - putTypeArgument(index = 0, type = pluginContext.irBuiltIns.stringType) - putValueArgument( - index = 0, - valueArgument = IrVarargImpl( - UNDEFINED_OFFSET, - UNDEFINED_OFFSET, - pluginContext.irBuiltIns.arrayClass.typeWith(pluginContext.irBuiltIns.stringType), - type, - // Generate list of properties: List>> - properties!!.entries.filter { - true // TODO filter actual adapted types - }.map { - IrConstImpl.string( - startOffset, - endOffset, - pluginContext.irBuiltIns.stringType, - it.value.persistedName - ) - }, - ) - ) - } - } - // Add `public val `io_realm_kotlin_fields`: Map>` property. companion.addValueProperty( pluginContext, diff --git a/packages/plugin-compiler/src/test/resources/sample/expected/01_AFTER.ValidateIrBeforeLowering.ir b/packages/plugin-compiler/src/test/resources/sample/expected/01_AFTER.ValidateIrBeforeLowering.ir index c81b4275c4..301442443f 100644 --- a/packages/plugin-compiler/src/test/resources/sample/expected/01_AFTER.ValidateIrBeforeLowering.ir +++ b/packages/plugin-compiler/src/test/resources/sample/expected/01_AFTER.ValidateIrBeforeLowering.ir @@ -8183,146 +8183,6 @@ MODULE_FRAGMENT name:
RETURN type=kotlin.Nothing from='public final fun (): kotlin.String declared in sample.input.Sample.Companion' GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:io_realm_kotlin_className type:kotlin.String visibility:private' type=kotlin.String origin=null receiver: GET_VAR ': sample.input.Sample.Companion declared in sample.input.Sample.Companion.' type=sample.input.Sample.Companion origin=null - PROPERTY name:io_realm_kotlin_useCustomType visibility:public modality:FINAL [var] - FIELD PROPERTY_BACKING_FIELD name:io_realm_kotlin_useCustomType type:kotlin.collections.Set visibility:private - EXPRESSION_BODY - CALL 'public final fun setOf (vararg elements: T of kotlin.collections.SetsKt.setOf): kotlin.collections.Set declared in kotlin.collections.SetsKt' type=kotlin.collections.Set origin=null - : kotlin.String - elements: VARARG type=kotlin.Array varargElementType=kotlin.collections.Set - CONST String type=kotlin.String value="id" - CONST String type=kotlin.String value="stringField" - CONST String type=kotlin.String value="byteField" - CONST String type=kotlin.String value="charField" - CONST String type=kotlin.String value="shortField" - CONST String type=kotlin.String value="intField" - CONST String type=kotlin.String value="longField" - CONST String type=kotlin.String value="booleanField" - CONST String type=kotlin.String value="floatField" - CONST String type=kotlin.String value="doubleField" - CONST String type=kotlin.String value="decimal128Field" - CONST String type=kotlin.String value="timestampField" - CONST String type=kotlin.String value="objectIdField" - CONST String type=kotlin.String value="bsonObjectIdField" - CONST String type=kotlin.String value="uuidField" - CONST String type=kotlin.String value="byteArrayField" - CONST String type=kotlin.String value="mutableRealmInt" - CONST String type=kotlin.String value="child" - CONST String type=kotlin.String value="nullableRealmAny" - CONST String type=kotlin.String value="stringListField" - CONST String type=kotlin.String value="byteListField" - CONST String type=kotlin.String value="charListField" - CONST String type=kotlin.String value="shortListField" - CONST String type=kotlin.String value="intListField" - CONST String type=kotlin.String value="longListField" - CONST String type=kotlin.String value="booleanListField" - CONST String type=kotlin.String value="floatListField" - CONST String type=kotlin.String value="doubleListField" - CONST String type=kotlin.String value="timestampListField" - CONST String type=kotlin.String value="objectIdListField" - CONST String type=kotlin.String value="bsonObjectIdListField" - CONST String type=kotlin.String value="uuidListField" - CONST String type=kotlin.String value="binaryListField" - CONST String type=kotlin.String value="decimal128ListField" - CONST String type=kotlin.String value="objectListField" - CONST String type=kotlin.String value="embeddedRealmObjectListField" - CONST String type=kotlin.String value="nullableStringListField" - CONST String type=kotlin.String value="nullableByteListField" - CONST String type=kotlin.String value="nullableCharListField" - CONST String type=kotlin.String value="nullableShortListField" - CONST String type=kotlin.String value="nullableIntListField" - CONST String type=kotlin.String value="nullableLongListField" - CONST String type=kotlin.String value="nullableBooleanListField" - CONST String type=kotlin.String value="nullableFloatListField" - CONST String type=kotlin.String value="nullableDoubleListField" - CONST String type=kotlin.String value="nullableTimestampListField" - CONST String type=kotlin.String value="nullableObjectIdListField" - CONST String type=kotlin.String value="nullableBsonObjectIdListField" - CONST String type=kotlin.String value="nullableUUIDListField" - CONST String type=kotlin.String value="nullableBinaryListField" - CONST String type=kotlin.String value="nullableDecimal128ListField" - CONST String type=kotlin.String value="nullableRealmAnyListField" - CONST String type=kotlin.String value="stringSetField" - CONST String type=kotlin.String value="byteSetField" - CONST String type=kotlin.String value="charSetField" - CONST String type=kotlin.String value="shortSetField" - CONST String type=kotlin.String value="intSetField" - CONST String type=kotlin.String value="longSetField" - CONST String type=kotlin.String value="booleanSetField" - CONST String type=kotlin.String value="floatSetField" - CONST String type=kotlin.String value="doubleSetField" - CONST String type=kotlin.String value="timestampSetField" - CONST String type=kotlin.String value="objectIdSetField" - CONST String type=kotlin.String value="bsonObjectIdSetField" - CONST String type=kotlin.String value="uuidSetField" - CONST String type=kotlin.String value="binarySetField" - CONST String type=kotlin.String value="decimal128SetField" - CONST String type=kotlin.String value="objectSetField" - CONST String type=kotlin.String value="nullableStringSetField" - CONST String type=kotlin.String value="nullableByteSetField" - CONST String type=kotlin.String value="nullableCharSetField" - CONST String type=kotlin.String value="nullableShortSetField" - CONST String type=kotlin.String value="nullableIntSetField" - CONST String type=kotlin.String value="nullableLongSetField" - CONST String type=kotlin.String value="nullableBooleanSetField" - CONST String type=kotlin.String value="nullableFloatSetField" - CONST String type=kotlin.String value="nullableDoubleSetField" - CONST String type=kotlin.String value="nullableTimestampSetField" - CONST String type=kotlin.String value="nullableObjectIdSetField" - CONST String type=kotlin.String value="nullableBsonObjectIdSetField" - CONST String type=kotlin.String value="nullableUUIDSetField" - CONST String type=kotlin.String value="nullableBinarySetField" - CONST String type=kotlin.String value="nullableDecimal128SetField" - CONST String type=kotlin.String value="nullableRealmAnySetField" - CONST String type=kotlin.String value="stringDictionaryField" - CONST String type=kotlin.String value="byteDictionaryField" - CONST String type=kotlin.String value="charDictionaryField" - CONST String type=kotlin.String value="shortDictionaryField" - CONST String type=kotlin.String value="intDictionaryField" - CONST String type=kotlin.String value="longDictionaryField" - CONST String type=kotlin.String value="booleanDictionaryField" - CONST String type=kotlin.String value="floatDictionaryField" - CONST String type=kotlin.String value="doubleDictionaryField" - CONST String type=kotlin.String value="timestampDictionaryField" - CONST String type=kotlin.String value="objectIdDictionaryField" - CONST String type=kotlin.String value="bsonObjectIdDictionaryField" - CONST String type=kotlin.String value="uuidDictionaryField" - CONST String type=kotlin.String value="binaryDictionaryField" - CONST String type=kotlin.String value="decimal128DictionaryField" - CONST String type=kotlin.String value="nullableStringDictionaryField" - CONST String type=kotlin.String value="nullableByteDictionaryField" - CONST String type=kotlin.String value="nullableCharDictionaryField" - CONST String type=kotlin.String value="nullableShortDictionaryField" - CONST String type=kotlin.String value="nullableIntDictionaryField" - CONST String type=kotlin.String value="nullableLongDictionaryField" - CONST String type=kotlin.String value="nullableBooleanDictionaryField" - CONST String type=kotlin.String value="nullableFloatDictionaryField" - CONST String type=kotlin.String value="nullableDoubleDictionaryField" - CONST String type=kotlin.String value="nullableTimestampDictionaryField" - CONST String type=kotlin.String value="nullableObjectIdDictionaryField" - CONST String type=kotlin.String value="nullableBsonObjectIdDictionaryField" - CONST String type=kotlin.String value="nullableUUIDDictionaryField" - CONST String type=kotlin.String value="nullableBinaryDictionaryField" - CONST String type=kotlin.String value="nullableDecimal128DictionaryField" - CONST String type=kotlin.String value="nullableRealmAnyDictionaryField" - CONST String type=kotlin.String value="nullableObjectDictionaryField" - CONST String type=kotlin.String value="nullableEmbeddedObjectDictionaryField" - CONST String type=kotlin.String value="linkingObjectsByList" - CONST String type=kotlin.String value="linkingObjectsBySet" - CONST String type=kotlin.String value="linkingObjectsByDictionary" - CONST String type=kotlin.String value="persistedNameStringField" - CONST String type=kotlin.String value="persistedNameChildField" - CONST String type=kotlin.String value="persistedNameLinkingObjectsField" - CONST String type=kotlin.String value="singletonAdaptedRealmInstant" - CONST String type=kotlin.String value="instancedAdaptedRealmInstant" - FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:sample.input.Sample.Companion) returnType:kotlin.collections.Set - correspondingProperty: PROPERTY name:io_realm_kotlin_useCustomType visibility:public modality:FINAL [var] - overridden: - public abstract fun (): kotlin.collections.Set declared in io.realm.kotlin.internal.RealmObjectCompanion - $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:sample.input.Sample.Companion - BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun (): kotlin.collections.Set declared in sample.input.Sample.Companion' - GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:io_realm_kotlin_useCustomType type:kotlin.collections.Set visibility:private' type=kotlin.collections.Set origin=null - receiver: GET_VAR ': sample.input.Sample.Companion declared in sample.input.Sample.Companion.' type=sample.input.Sample.Companion origin=null PROPERTY name:io_realm_kotlin_fields visibility:public modality:FINAL [var] FIELD PROPERTY_BACKING_FIELD name:io_realm_kotlin_fields type:kotlin.collections.Map> visibility:private EXPRESSION_BODY @@ -9310,24 +9170,6 @@ MODULE_FRAGMENT name:
RETURN type=kotlin.Nothing from='public final fun (): kotlin.String declared in sample.input.Child.Companion' GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:io_realm_kotlin_className type:kotlin.String visibility:private' type=kotlin.String origin=null receiver: GET_VAR ': sample.input.Child.Companion declared in sample.input.Child.Companion.' type=sample.input.Child.Companion origin=null - PROPERTY name:io_realm_kotlin_useCustomType visibility:public modality:FINAL [var] - FIELD PROPERTY_BACKING_FIELD name:io_realm_kotlin_useCustomType type:kotlin.collections.Set visibility:private - EXPRESSION_BODY - CALL 'public final fun setOf (vararg elements: T of kotlin.collections.SetsKt.setOf): kotlin.collections.Set declared in kotlin.collections.SetsKt' type=kotlin.collections.Set origin=null - : kotlin.String - elements: VARARG type=kotlin.Array varargElementType=kotlin.collections.Set - CONST String type=kotlin.String value="name" - CONST String type=kotlin.String value="linkingObjectsByObject" - CONST String type=kotlin.String value="persistedNameParent" - FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:sample.input.Child.Companion) returnType:kotlin.collections.Set - correspondingProperty: PROPERTY name:io_realm_kotlin_useCustomType visibility:public modality:FINAL [var] - overridden: - public abstract fun (): kotlin.collections.Set declared in io.realm.kotlin.internal.RealmObjectCompanion - $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:sample.input.Child.Companion - BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun (): kotlin.collections.Set declared in sample.input.Child.Companion' - GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:io_realm_kotlin_useCustomType type:kotlin.collections.Set visibility:private' type=kotlin.collections.Set origin=null - receiver: GET_VAR ': sample.input.Child.Companion declared in sample.input.Child.Companion.' type=sample.input.Child.Companion origin=null PROPERTY name:io_realm_kotlin_fields visibility:public modality:FINAL [var] FIELD PROPERTY_BACKING_FIELD name:io_realm_kotlin_fields type:kotlin.collections.Map> visibility:private EXPRESSION_BODY @@ -9575,22 +9417,6 @@ MODULE_FRAGMENT name:
RETURN type=kotlin.Nothing from='public final fun (): kotlin.String declared in sample.input.EmbeddedParent.Companion' GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:io_realm_kotlin_className type:kotlin.String visibility:private' type=kotlin.String origin=null receiver: GET_VAR ': sample.input.EmbeddedParent.Companion declared in sample.input.EmbeddedParent.Companion.' type=sample.input.EmbeddedParent.Companion origin=null - PROPERTY name:io_realm_kotlin_useCustomType visibility:public modality:FINAL [var] - FIELD PROPERTY_BACKING_FIELD name:io_realm_kotlin_useCustomType type:kotlin.collections.Set visibility:private - EXPRESSION_BODY - CALL 'public final fun setOf (vararg elements: T of kotlin.collections.SetsKt.setOf): kotlin.collections.Set declared in kotlin.collections.SetsKt' type=kotlin.collections.Set origin=null - : kotlin.String - elements: VARARG type=kotlin.Array varargElementType=kotlin.collections.Set - CONST String type=kotlin.String value="child" - FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:sample.input.EmbeddedParent.Companion) returnType:kotlin.collections.Set - correspondingProperty: PROPERTY name:io_realm_kotlin_useCustomType visibility:public modality:FINAL [var] - overridden: - public abstract fun (): kotlin.collections.Set declared in io.realm.kotlin.internal.RealmObjectCompanion - $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:sample.input.EmbeddedParent.Companion - BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun (): kotlin.collections.Set declared in sample.input.EmbeddedParent.Companion' - GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:io_realm_kotlin_useCustomType type:kotlin.collections.Set visibility:private' type=kotlin.collections.Set origin=null - receiver: GET_VAR ': sample.input.EmbeddedParent.Companion declared in sample.input.EmbeddedParent.Companion.' type=sample.input.EmbeddedParent.Companion origin=null PROPERTY name:io_realm_kotlin_fields visibility:public modality:FINAL [var] FIELD PROPERTY_BACKING_FIELD name:io_realm_kotlin_fields type:kotlin.collections.Map> visibility:private EXPRESSION_BODY @@ -9826,22 +9652,6 @@ MODULE_FRAGMENT name:
RETURN type=kotlin.Nothing from='public final fun (): kotlin.String declared in sample.input.EmbeddedChild.Companion' GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:io_realm_kotlin_className type:kotlin.String visibility:private' type=kotlin.String origin=null receiver: GET_VAR ': sample.input.EmbeddedChild.Companion declared in sample.input.EmbeddedChild.Companion.' type=sample.input.EmbeddedChild.Companion origin=null - PROPERTY name:io_realm_kotlin_useCustomType visibility:public modality:FINAL [var] - FIELD PROPERTY_BACKING_FIELD name:io_realm_kotlin_useCustomType type:kotlin.collections.Set visibility:private - EXPRESSION_BODY - CALL 'public final fun setOf (vararg elements: T of kotlin.collections.SetsKt.setOf): kotlin.collections.Set declared in kotlin.collections.SetsKt' type=kotlin.collections.Set origin=null - : kotlin.String - elements: VARARG type=kotlin.Array varargElementType=kotlin.collections.Set - CONST String type=kotlin.String value="name" - FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:sample.input.EmbeddedChild.Companion) returnType:kotlin.collections.Set - correspondingProperty: PROPERTY name:io_realm_kotlin_useCustomType visibility:public modality:FINAL [var] - overridden: - public abstract fun (): kotlin.collections.Set declared in io.realm.kotlin.internal.RealmObjectCompanion - $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:sample.input.EmbeddedChild.Companion - BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun (): kotlin.collections.Set declared in sample.input.EmbeddedChild.Companion' - GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:io_realm_kotlin_useCustomType type:kotlin.collections.Set visibility:private' type=kotlin.collections.Set origin=null - receiver: GET_VAR ': sample.input.EmbeddedChild.Companion declared in sample.input.EmbeddedChild.Companion.' type=sample.input.EmbeddedChild.Companion origin=null PROPERTY name:io_realm_kotlin_fields visibility:public modality:FINAL [var] FIELD PROPERTY_BACKING_FIELD name:io_realm_kotlin_fields type:kotlin.collections.Map> visibility:private EXPRESSION_BODY diff --git a/packages/plugin-compiler/src/test/resources/schema/expected/01_AFTER.ValidateIrBeforeLowering.ir b/packages/plugin-compiler/src/test/resources/schema/expected/01_AFTER.ValidateIrBeforeLowering.ir index 638ef72d55..72f689feb3 100644 --- a/packages/plugin-compiler/src/test/resources/schema/expected/01_AFTER.ValidateIrBeforeLowering.ir +++ b/packages/plugin-compiler/src/test/resources/schema/expected/01_AFTER.ValidateIrBeforeLowering.ir @@ -76,21 +76,6 @@ MODULE_FRAGMENT name:
RETURN type=kotlin.Nothing from='public final fun (): kotlin.String declared in schema.input.A.Companion' GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:io_realm_kotlin_className type:kotlin.String visibility:private' type=kotlin.String origin=null receiver: GET_VAR ': schema.input.A.Companion declared in schema.input.A.Companion.' type=schema.input.A.Companion origin=null - PROPERTY name:io_realm_kotlin_useCustomType visibility:public modality:FINAL [var] - FIELD PROPERTY_BACKING_FIELD name:io_realm_kotlin_useCustomType type:kotlin.collections.Set visibility:private - EXPRESSION_BODY - CALL 'public final fun setOf (vararg elements: T of kotlin.collections.SetsKt.setOf): kotlin.collections.Set declared in kotlin.collections.SetsKt' type=kotlin.collections.Set origin=null - : kotlin.String - elements: VARARG type=kotlin.Array varargElementType=kotlin.collections.Set - FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:schema.input.A.Companion) returnType:kotlin.collections.Set - correspondingProperty: PROPERTY name:io_realm_kotlin_useCustomType visibility:public modality:FINAL [var] - overridden: - public abstract fun (): kotlin.collections.Set declared in io.realm.kotlin.internal.RealmObjectCompanion - $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:schema.input.A.Companion - BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun (): kotlin.collections.Set declared in schema.input.A.Companion' - GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:io_realm_kotlin_useCustomType type:kotlin.collections.Set visibility:private' type=kotlin.collections.Set origin=null - receiver: GET_VAR ': schema.input.A.Companion declared in schema.input.A.Companion.' type=schema.input.A.Companion origin=null PROPERTY name:io_realm_kotlin_fields visibility:public modality:FINAL [var] FIELD PROPERTY_BACKING_FIELD name:io_realm_kotlin_fields type:kotlin.collections.Map> visibility:private EXPRESSION_BODY @@ -260,21 +245,6 @@ MODULE_FRAGMENT name:
RETURN type=kotlin.Nothing from='public final fun (): kotlin.String declared in schema.input.B.Companion' GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:io_realm_kotlin_className type:kotlin.String visibility:private' type=kotlin.String origin=null receiver: GET_VAR ': schema.input.B.Companion declared in schema.input.B.Companion.' type=schema.input.B.Companion origin=null - PROPERTY name:io_realm_kotlin_useCustomType visibility:public modality:FINAL [var] - FIELD PROPERTY_BACKING_FIELD name:io_realm_kotlin_useCustomType type:kotlin.collections.Set visibility:private - EXPRESSION_BODY - CALL 'public final fun setOf (vararg elements: T of kotlin.collections.SetsKt.setOf): kotlin.collections.Set declared in kotlin.collections.SetsKt' type=kotlin.collections.Set origin=null - : kotlin.String - elements: VARARG type=kotlin.Array varargElementType=kotlin.collections.Set - FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:schema.input.B.Companion) returnType:kotlin.collections.Set - correspondingProperty: PROPERTY name:io_realm_kotlin_useCustomType visibility:public modality:FINAL [var] - overridden: - public abstract fun (): kotlin.collections.Set declared in io.realm.kotlin.internal.RealmObjectCompanion - $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:schema.input.B.Companion - BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun (): kotlin.collections.Set declared in schema.input.B.Companion' - GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:io_realm_kotlin_useCustomType type:kotlin.collections.Set visibility:private' type=kotlin.collections.Set origin=null - receiver: GET_VAR ': schema.input.B.Companion declared in schema.input.B.Companion.' type=schema.input.B.Companion origin=null PROPERTY name:io_realm_kotlin_fields visibility:public modality:FINAL [var] FIELD PROPERTY_BACKING_FIELD name:io_realm_kotlin_fields type:kotlin.collections.Map> visibility:private EXPRESSION_BODY @@ -444,21 +414,6 @@ MODULE_FRAGMENT name:
RETURN type=kotlin.Nothing from='public final fun (): kotlin.String declared in schema.input.C.Companion' GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:io_realm_kotlin_className type:kotlin.String visibility:private' type=kotlin.String origin=null receiver: GET_VAR ': schema.input.C.Companion declared in schema.input.C.Companion.' type=schema.input.C.Companion origin=null - PROPERTY name:io_realm_kotlin_useCustomType visibility:public modality:FINAL [var] - FIELD PROPERTY_BACKING_FIELD name:io_realm_kotlin_useCustomType type:kotlin.collections.Set visibility:private - EXPRESSION_BODY - CALL 'public final fun setOf (vararg elements: T of kotlin.collections.SetsKt.setOf): kotlin.collections.Set declared in kotlin.collections.SetsKt' type=kotlin.collections.Set origin=null - : kotlin.String - elements: VARARG type=kotlin.Array varargElementType=kotlin.collections.Set - FUN DEFAULT_PROPERTY_ACCESSOR name: visibility:public modality:FINAL <> ($this:schema.input.C.Companion) returnType:kotlin.collections.Set - correspondingProperty: PROPERTY name:io_realm_kotlin_useCustomType visibility:public modality:FINAL [var] - overridden: - public abstract fun (): kotlin.collections.Set declared in io.realm.kotlin.internal.RealmObjectCompanion - $this: VALUE_PARAMETER INSTANCE_RECEIVER name: type:schema.input.C.Companion - BLOCK_BODY - RETURN type=kotlin.Nothing from='public final fun (): kotlin.collections.Set declared in schema.input.C.Companion' - GET_FIELD 'FIELD PROPERTY_BACKING_FIELD name:io_realm_kotlin_useCustomType type:kotlin.collections.Set visibility:private' type=kotlin.collections.Set origin=null - receiver: GET_VAR ': schema.input.C.Companion declared in schema.input.C.Companion.' type=schema.input.C.Companion origin=null PROPERTY name:io_realm_kotlin_fields visibility:public modality:FINAL [var] FIELD PROPERTY_BACKING_FIELD name:io_realm_kotlin_fields type:kotlin.collections.Map> visibility:private EXPRESSION_BODY From 6408db14cf7ad2b7e3b450158b1ebc59ba6ebb35 Mon Sep 17 00:00:00 2001 From: Clemente Date: Wed, 20 Dec 2023 16:35:53 +0100 Subject: [PATCH 24/32] Add more tests around adapter supported types --- .../compiler/AccessorModifierIrGeneration.kt | 5 +- .../compiler/RealmModelLoweringExtension.kt | 24 +++++++- .../kotlin/test/compiler/TypeAdaptersTests.kt | 57 +++++++++++++++++++ 3 files changed, 79 insertions(+), 7 deletions(-) diff --git a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/AccessorModifierIrGeneration.kt b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/AccessorModifierIrGeneration.kt index 88f64973a0..11095ec8be 100644 --- a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/AccessorModifierIrGeneration.kt +++ b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/AccessorModifierIrGeneration.kt @@ -765,9 +765,7 @@ class AccessorModifierIrGeneration(realmPluginContext: RealmPluginContext) : Rea .annotations .findAnnotation(TYPE_ADAPTER_ANNOTATION.asSingleFqName()) - var adapterClassReference: IrClassReference? = null var collectionAdapterExpression: (IrBuilderWithScope.(IrGetValue) -> IrExpression)? = null - var collectionStoreType: IrType? = null typeAdapterAnnotation?.let { val typeAdapterInfo = it.getTypeAdapterInfo() @@ -780,7 +778,6 @@ class AccessorModifierIrGeneration(realmPluginContext: RealmPluginContext) : Rea // Replace the property type with the one from the type adapter collectionIrType = realmType - adapterClassReference = classReference val adapterClass: IrClass = classReference.classType.getClass()!! collectionAdapterExpression = { objectReference -> @@ -794,7 +791,7 @@ class AccessorModifierIrGeneration(realmPluginContext: RealmPluginContext) : Rea // pass obj reference putValueArgument(0, objectReference) // pass class reference - putValueArgument(1, adapterClassReference) + putValueArgument(1, classReference) } } ClassKind.OBJECT -> { diff --git a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/RealmModelLoweringExtension.kt b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/RealmModelLoweringExtension.kt index efd6fb1c21..8a1c179a6d 100644 --- a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/RealmModelLoweringExtension.kt +++ b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/RealmModelLoweringExtension.kt @@ -33,8 +33,10 @@ import org.jetbrains.kotlin.ir.expressions.impl.IrClassReferenceImpl import org.jetbrains.kotlin.ir.expressions.impl.IrConstructorCallImpl import org.jetbrains.kotlin.ir.symbols.IrClassSymbol import org.jetbrains.kotlin.ir.types.IrSimpleType +import org.jetbrains.kotlin.ir.types.IrStarProjection import org.jetbrains.kotlin.ir.types.classFqName import org.jetbrains.kotlin.ir.types.defaultType +import org.jetbrains.kotlin.ir.types.impl.IrSimpleTypeImpl import org.jetbrains.kotlin.ir.types.makeNotNull import org.jetbrains.kotlin.ir.types.starProjectedType import org.jetbrains.kotlin.ir.types.superTypes @@ -64,7 +66,7 @@ private class RealmModelLowering(private val pluginContext: IrPluginContext) : C override fun lower(irFile: IrFile) = runOnFilePostfix(irFile) - @Suppress("LongMethod", "ComplexMethod") + @Suppress("LongMethod", "ComplexMethod", "NestedBlockDepth") override fun lower(irClass: IrClass) { val realmPluginContext by lazy { RealmPluginContextImpl(pluginContext) } @@ -84,8 +86,24 @@ private class RealmModelLowering(private val pluginContext: IrPluginContext) : C arguments[0].typeOrNull!! } - if (!realmType.makeNotNull().isValidPersistedType()) { - // TODO better name please + val type = + if (realmType.isRealmList() || realmType.isRealmSet() || realmType.isRealmDictionary()) { + val typeArgument = (realmType as IrSimpleTypeImpl).arguments[0] + if (typeArgument is IrStarProjection) { + logError( +// "Error in field ${declaration.name} - ${collectionType.description} cannot use a '*' projection.", +// declaration.locationOf() + "TODO IMPROVE ERROR" + ) + return + } + + typeArgument.typeOrNull!! + } else { + realmType + } + + if (!type.makeNotNull().isValidPersistedType()) { logError("Invalid type parameter '${realmType.classFqName}', only Realm types are supported") } } diff --git a/packages/test-base/src/jvmTest/kotlin/io/realm/kotlin/test/compiler/TypeAdaptersTests.kt b/packages/test-base/src/jvmTest/kotlin/io/realm/kotlin/test/compiler/TypeAdaptersTests.kt index 145c305313..b2b207027e 100644 --- a/packages/test-base/src/jvmTest/kotlin/io/realm/kotlin/test/compiler/TypeAdaptersTests.kt +++ b/packages/test-base/src/jvmTest/kotlin/io/realm/kotlin/test/compiler/TypeAdaptersTests.kt @@ -20,6 +20,7 @@ import com.tschuchort.compiletesting.KotlinCompilation import com.tschuchort.compiletesting.SourceFile import io.realm.kotlin.internal.interop.CollectionType import io.realm.kotlin.test.util.Compiler.compileFromSource +import io.realm.kotlin.test.util.TypeDescriptor import io.realm.kotlin.test.util.TypeDescriptor.allFieldTypes import io.realm.kotlin.test.util.TypeDescriptor.unsupportedRealmTypeAdaptersClassifiers import io.realm.kotlin.types.MutableRealmInt @@ -330,6 +331,62 @@ class TypeAdaptersTests { } } + @Test + fun `type adapter with star projection`() { + CollectionType.values() + .filterNot { collectionType -> + collectionType == CollectionType.RLM_COLLECTION_TYPE_NONE + } + .map { collectionType -> + TypeDescriptor.RealmFieldType( + collectionType = collectionType, + elementType = TypeDescriptor.ElementType( + classifier = String::class, + nullable = false + ) + ) + } + .map { + it.toKotlinLiteral().replace("String", "*") + } + .forEach { kotlinLiteral -> + val result = compileFromSource( + plugins = listOf(io.realm.kotlin.compiler.Registrar()), + source = SourceFile.kotlin( + "typeadapter_supportness_$kotlinLiteral.kt", + """ + import io.realm.kotlin.types.RealmAny + import io.realm.kotlin.types.RealmDictionary + import io.realm.kotlin.types.RealmList + import io.realm.kotlin.types.RealmSet + import io.realm.kotlin.types.RealmInstant + import io.realm.kotlin.types.MutableRealmInt + import io.realm.kotlin.types.RealmObject + import io.realm.kotlin.types.RealmTypeAdapter + import io.realm.kotlin.types.RealmUUID + import io.realm.kotlin.types.annotations.TypeAdapter + import io.realm.kotlin.types.ObjectId + import org.mongodb.kbson.BsonDecimal128 + import org.mongodb.kbson.BsonObjectId + + class UserType + + object ValidRealmTypeAdapter : RealmTypeAdapter<$kotlinLiteral, UserType> { + override fun fromRealm(realmValue: $kotlinLiteral): UserType = TODO() + + override fun toRealm(value: UserType): $kotlinLiteral = TODO() + } + """.trimIndent() + ) + ) + assertEquals( + KotlinCompilation.ExitCode.COMPILATION_ERROR, + result.exitCode, + result.messages + ) + } + } + @Test fun `apply annotation to type parameter`() { allFieldTypes From 385e369d490d3e611c2b529f00ff1d1fdfae7933 Mon Sep 17 00:00:00 2001 From: Clemente Date: Wed, 20 Dec 2023 16:42:24 +0100 Subject: [PATCH 25/32] Linting --- .../io/realm/kotlin/compiler/RealmModelLoweringExtension.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/RealmModelLoweringExtension.kt b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/RealmModelLoweringExtension.kt index 8a1c179a6d..c5ff9bf6e9 100644 --- a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/RealmModelLoweringExtension.kt +++ b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/RealmModelLoweringExtension.kt @@ -88,7 +88,7 @@ private class RealmModelLowering(private val pluginContext: IrPluginContext) : C val type = if (realmType.isRealmList() || realmType.isRealmSet() || realmType.isRealmDictionary()) { - val typeArgument = (realmType as IrSimpleTypeImpl).arguments[0] + val typeArgument = (realmType as IrSimpleTypeImpl).arguments[0] if (typeArgument is IrStarProjection) { logError( // "Error in field ${declaration.name} - ${collectionType.description} cannot use a '*' projection.", From 77cdc2e23fcf0f64b146e64b4c8906a9c2c1a319 Mon Sep 17 00:00:00 2001 From: Clemente Date: Wed, 20 Dec 2023 17:21:21 +0100 Subject: [PATCH 26/32] Clean up compiler tests --- .../kotlin/internal/RealmListInternal.kt | 10 +--------- .../realm/kotlin/internal/RealmMapInternal.kt | 2 +- .../realm/kotlin/internal/RealmSetInternal.kt | 2 +- .../io/realm/kotlin/types/RealmTypeAdapter.kt | 1 - .../compiler/AccessorModifierIrGeneration.kt | 3 +-- .../compiler/RealmModelLoweringExtension.kt | 7 +++---- .../kotlin/compiler/RealmPluginContext.kt | 11 ----------- .../kotlin/entities/adapters/AllTypes.kt | 3 +-- .../kotlin/test/compiler/TypeAdaptersTests.kt | 19 ++++++++++--------- 9 files changed, 18 insertions(+), 40 deletions(-) diff --git a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmListInternal.kt b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmListInternal.kt index 52114328b1..23b56e6f69 100644 --- a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmListInternal.kt +++ b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmListInternal.kt @@ -259,15 +259,7 @@ internal class TypeAdaptedListOperator( override val nativePointer: RealmListPointer by listOperator::nativePointer override val mediator: Mediator by listOperator::mediator override val realmReference: RealmReference by listOperator::realmReference - override val valueConverter: RealmValueConverter = object : RealmValueConverter { - override fun MemTrackingAllocator.publicToRealmValue(value: E?): RealmValue { - TODO("Not yet implemented") - } - - override fun realmValueToPublic(realmValue: RealmValue): E? { - TODO("Not yet implemented") - } - } + override val valueConverter: RealmValueConverter by lazy { throw RuntimeException("TypeAdaptedListOperator does not have a valueConverter") } override fun get(index: Int): E = typeAdapter.fromRealm(listOperator.get(index)) diff --git a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmMapInternal.kt b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmMapInternal.kt index 678b9c695c..56a2159fef 100644 --- a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmMapInternal.kt +++ b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmMapInternal.kt @@ -333,7 +333,7 @@ internal class TypeAdaptedMapOperator( override val mediator: Mediator by mapOperator::mediator override val realmReference: RealmReference by mapOperator::realmReference - override val valueConverter: RealmValueConverter by lazy { throw IllegalStateException("Unreachable") } + override val valueConverter: RealmValueConverter by lazy { throw RuntimeException("TypeAdaptedMapOperator does not have a valueConverter") } } internal open class PrimitiveMapOperator constructor( diff --git a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmSetInternal.kt b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmSetInternal.kt index 30f0e662ad..5e04d1029f 100644 --- a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmSetInternal.kt +++ b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmSetInternal.kt @@ -313,7 +313,7 @@ internal class TypeAdaptedSetOperator( override val mediator: Mediator by setOperator::mediator override val realmReference: RealmReference by setOperator::realmReference - override val valueConverter: RealmValueConverter by lazy { throw IllegalStateException("Not available") } + override val valueConverter: RealmValueConverter by lazy { throw RuntimeException("TypeAdaptedSetOperator does not have a valueConverter") } override fun get(index: Int): E = typeAdapter.fromRealm(setOperator.get(index)) diff --git a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/types/RealmTypeAdapter.kt b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/types/RealmTypeAdapter.kt index d762e8e10d..5065ffd2e0 100644 --- a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/types/RealmTypeAdapter.kt +++ b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/types/RealmTypeAdapter.kt @@ -6,7 +6,6 @@ package io.realm.kotlin.types * @param S storage type. * @param U user type. */ -// TODO Perform some validation on supported R realm-types public interface RealmTypeAdapter { // where S is a supported realm type public fun fromRealm(realmValue: S): U diff --git a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/AccessorModifierIrGeneration.kt b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/AccessorModifierIrGeneration.kt index 11095ec8be..2c9c3be277 100644 --- a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/AccessorModifierIrGeneration.kt +++ b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/AccessorModifierIrGeneration.kt @@ -185,8 +185,7 @@ class AccessorModifierIrGeneration(realmPluginContext: RealmPluginContext) : Rea val adapterClass: IrClass = adapterClassReference.classType.getClass()!! if (propertyType.classId != userType.classId) { - // TODO improve messaging - logError("Not matching types 1") + logError("Type adapter public type does not match the property type.") } // Replace the property type with the one from the type adapter diff --git a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/RealmModelLoweringExtension.kt b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/RealmModelLoweringExtension.kt index c5ff9bf6e9..71823e1c5f 100644 --- a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/RealmModelLoweringExtension.kt +++ b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/RealmModelLoweringExtension.kt @@ -91,9 +91,8 @@ private class RealmModelLowering(private val pluginContext: IrPluginContext) : C val typeArgument = (realmType as IrSimpleTypeImpl).arguments[0] if (typeArgument is IrStarProjection) { logError( -// "Error in field ${declaration.name} - ${collectionType.description} cannot use a '*' projection.", -// declaration.locationOf() - "TODO IMPROVE ERROR" + "Error in class ${irClass.name} - ${realmType.classFqName?.shortName()} cannot use a '*' projection.", + irClass.locationOf() ) return } @@ -104,7 +103,7 @@ private class RealmModelLowering(private val pluginContext: IrPluginContext) : C } if (!type.makeNotNull().isValidPersistedType()) { - logError("Invalid type parameter '${realmType.classFqName}', only Realm types are supported") + logError("Invalid adapter persisted type '${realmType.classFqName}', only Realm persistable types are supported.") } } } diff --git a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/RealmPluginContext.kt b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/RealmPluginContext.kt index 6f72b58e1a..5e76801ef0 100644 --- a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/RealmPluginContext.kt +++ b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/RealmPluginContext.kt @@ -166,26 +166,15 @@ interface RealmPluginContext { return propertyClassId == mutableRealmIntegerClassId } - // TODO Clean up move around? @Suppress("ComplexMethod") fun IrType.isValidPersistedType(): Boolean = isRealmAny() || isByteArray() || isString() || -// isLinkingObject() || -// isEmbeddedLinkingObject() || -// isPersistedPrimitiveType() || -// isMutableRealmInteger() || -// isByte() || -// isChar() || -// isShort() || -// isInt() || isLong() || isBoolean() || isFloat() || isDouble() || isDecimal128() || - // isEmbeddedLinkingObject() || - // isLinkingObject() || isRealmList() || isRealmSet() || isRealmDictionary() || diff --git a/packages/test-base/src/commonMain/kotlin/io/realm/kotlin/entities/adapters/AllTypes.kt b/packages/test-base/src/commonMain/kotlin/io/realm/kotlin/entities/adapters/AllTypes.kt index 06385dae12..659872b42d 100644 --- a/packages/test-base/src/commonMain/kotlin/io/realm/kotlin/entities/adapters/AllTypes.kt +++ b/packages/test-base/src/commonMain/kotlin/io/realm/kotlin/entities/adapters/AllTypes.kt @@ -297,8 +297,7 @@ class AllTypes : RealmObject { } } -// TODO should we write these type adapters as BsonValue converters? -// Passthrough converters +// Passthrough converters, we could use BsonTypes, but passthrough is also a case to test. object StringAdapter : RealmTypeAdapter { override fun fromRealm(realmValue: String): String = realmValue.toString() diff --git a/packages/test-base/src/jvmTest/kotlin/io/realm/kotlin/test/compiler/TypeAdaptersTests.kt b/packages/test-base/src/jvmTest/kotlin/io/realm/kotlin/test/compiler/TypeAdaptersTests.kt index b2b207027e..cc9d027f11 100644 --- a/packages/test-base/src/jvmTest/kotlin/io/realm/kotlin/test/compiler/TypeAdaptersTests.kt +++ b/packages/test-base/src/jvmTest/kotlin/io/realm/kotlin/test/compiler/TypeAdaptersTests.kt @@ -43,16 +43,15 @@ import kotlin.test.assertTrue * - [x] Adapters type unsupportness * - [x] Adapter not matching public type * - [x] Instanced and singleton adapters - * - [] Other annotations Ignore, Index etc - * TODO: Rename generated file names + * - [x] Other annotations Ignore, Index etc + * - [x] Star projections in persistable types */ class TypeAdaptersTests { private val typeAdapterTypes = listOf("object", "class") - // TODO: Can we make it fail when declaring type adapters rather than when we apply them? @Test - fun `invalid R-type unsupported persisted type`() { + fun `invalid persisted type`() { typeAdapterTypes.forEach { type -> val result = compileFromSource( plugins = listOf(io.realm.kotlin.compiler.Registrar()), @@ -82,14 +81,14 @@ class TypeAdaptersTests { result.messages ) assertTrue( - result.messages.contains("Invalid type parameter 'NonRealmType', only Realm types are supported"), + result.messages.contains("Invalid adapter persisted type 'NonRealmType', only Realm persistable types are supported."), result.messages ) } } @Test - fun `invalid U-type non-matching user-defined type`() { + fun `not matching user type`() { typeAdapterTypes.forEach { type -> val result = compileFromSource( plugins = listOf(io.realm.kotlin.compiler.Registrar()), @@ -123,7 +122,7 @@ class TypeAdaptersTests { result.exitCode, result.messages ) - assertTrue(result.messages.contains("Not matching types"), result.messages) + assertTrue(result.messages.contains("Type adapter public type does not match the property type."), result.messages) } } @@ -167,7 +166,7 @@ class TypeAdaptersTests { } @Test - fun `type adapters supportness`() { + fun `validate all adapters supported types`() { val defaults = mapOf( Boolean::class to true, Long::class to "1", @@ -259,7 +258,7 @@ class TypeAdaptersTests { } @Test - fun `type adapters unsupportness`() { + fun `validate all adapters unsupported types`() { val defaults = mapOf( Byte::class to "1", Char::class to "\'c\'", @@ -328,6 +327,7 @@ class TypeAdaptersTests { result.exitCode, result.messages ) + assertTrue(result.messages.contains("only Realm persistable types are supported"), result.messages) } } @@ -384,6 +384,7 @@ class TypeAdaptersTests { result.exitCode, result.messages ) + assertTrue(result.messages.contains("cannot use a '*' projection"), result.messages) } } From 3b18d8d8b0bb583974572af068cacee62c744613 Mon Sep 17 00:00:00 2001 From: Clemente Date: Wed, 20 Dec 2023 23:20:29 +0100 Subject: [PATCH 27/32] Add roundtrip tests --- .../kotlin/entities/adapters/AllTypes.kt | 358 ++++++++++++------ .../kotlin/test/common/TypeAdapterTests.kt | 188 +++++++-- 2 files changed, 399 insertions(+), 147 deletions(-) diff --git a/packages/test-base/src/commonMain/kotlin/io/realm/kotlin/entities/adapters/AllTypes.kt b/packages/test-base/src/commonMain/kotlin/io/realm/kotlin/entities/adapters/AllTypes.kt index 659872b42d..f7a8b83a65 100644 --- a/packages/test-base/src/commonMain/kotlin/io/realm/kotlin/entities/adapters/AllTypes.kt +++ b/packages/test-base/src/commonMain/kotlin/io/realm/kotlin/entities/adapters/AllTypes.kt @@ -5,6 +5,8 @@ import io.realm.kotlin.ext.asRealmObject import io.realm.kotlin.ext.realmDictionaryOf import io.realm.kotlin.ext.realmListOf import io.realm.kotlin.ext.realmSetOf +import io.realm.kotlin.internal.interop.CollectionType +import io.realm.kotlin.test.util.TypeDescriptor import io.realm.kotlin.types.ObjectId import io.realm.kotlin.types.RealmAny import io.realm.kotlin.types.RealmDictionary @@ -14,21 +16,48 @@ import io.realm.kotlin.types.RealmObject import io.realm.kotlin.types.RealmSet import io.realm.kotlin.types.RealmTypeAdapter import io.realm.kotlin.types.RealmUUID +import io.realm.kotlin.types.annotations.PersistedName import io.realm.kotlin.types.annotations.TypeAdapter import org.mongodb.kbson.BsonDecimal128 import org.mongodb.kbson.BsonObjectId import org.mongodb.kbson.BsonString import org.mongodb.kbson.Decimal128 +import kotlin.reflect.KMutableProperty1 + +class ReferencedObject : RealmObject { + var stringField: String = "" + + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other == null || this::class != other::class) return false + + other as ReferencedObject + + if (stringField != other.stringField) return false + + return true + } + + override fun hashCode(): Int { + return stringField.hashCode() + } + + +} @Suppress("MagicNumber") class AllTypes : RealmObject { + @PersistedName("persistedStringField") @TypeAdapter(StringAdapter::class) var stringField: String = "Realm" @TypeAdapter(BooleanAdapter::class) var booleanField: Boolean = true + @TypeAdapter(LongAdapter::class) + var longField: Long = 10L + @TypeAdapter(FloatAdapter::class) var floatField: Float = 3.14f @@ -59,6 +88,9 @@ class AllTypes : RealmObject { @TypeAdapter(NullableBooleanAdapter::class) var nullableBooleanField: Boolean? = null + @TypeAdapter(NullableLongAdapter::class) + var nullableLongField: Long? = null + @TypeAdapter(NullableFloatAdapter::class) var nullableFloatField: Float? = null @@ -86,8 +118,8 @@ class AllTypes : RealmObject { @TypeAdapter(RealmAnyAdapter::class) var nullableRealmAnyField: RealmAny? = null - @TypeAdapter(AllTypesObjectAdapter::class) - var nullableObject: AllTypes? = null + @TypeAdapter(NullableReferencedObjectAdapter::class) + var nullableObject: ReferencedObject? = null @TypeAdapter(StringRealmListAdapter::class) var stringListField: RealmList = realmListOf() @@ -106,9 +138,13 @@ class AllTypes : RealmObject { // var uuidListField: RealmList = realmListOf() // var binaryListField: RealmList = realmListOf() // var decimal128ListField: RealmList = realmListOf() -// var objectListField: RealmList = realmListOf() -// -// var nullableStringListField: RealmList = realmListOf() + + @TypeAdapter(ReferencedObjectRealmListAdapter::class) + var objectListField: RealmList = realmListOf() + + @TypeAdapter(NullableStringRealmListAdapter::class) + var nullableStringListField: RealmList = realmListOf() + // var nullableByteListField: RealmList = realmListOf() // var nullableCharListField: RealmList = realmListOf() // var nullableShortListField: RealmList = realmListOf() @@ -124,10 +160,11 @@ class AllTypes : RealmObject { // var nullableBinaryListField: RealmList = realmListOf() // var nullableDecimal128ListField: RealmList = realmListOf() // var nullableRealmAnyListField: RealmList = realmListOf() -// + @TypeAdapter(StringRealmSetAdapter::class) var stringSetField: RealmSet = realmSetOf() -// var byteSetField: RealmSet = realmSetOf() + + // var byteSetField: RealmSet = realmSetOf() // var charSetField: RealmSet = realmSetOf() // var shortSetField: RealmSet = realmSetOf() // var intSetField: RealmSet = realmSetOf() @@ -141,9 +178,11 @@ class AllTypes : RealmObject { // var uuidSetField: RealmSet = realmSetOf() // var binarySetField: RealmSet = realmSetOf() // var decimal128SetField: RealmSet = realmSetOf() -// var objectSetField: RealmSet = realmSetOf() -// -// var nullableStringSetField: RealmSet = realmSetOf() + @TypeAdapter(ReferencedObjectRealmSetAdapter::class) + var objectSetField: RealmSet = realmSetOf() + + @TypeAdapter(NullableStringRealmSetAdapter::class) + var nullableStringSetField: RealmSet = realmSetOf() // var nullableByteSetField: RealmSet = realmSetOf() // var nullableCharSetField: RealmSet = realmSetOf() // var nullableShortSetField: RealmSet = realmSetOf() @@ -159,12 +198,11 @@ class AllTypes : RealmObject { // var nullableBinarySetField: RealmSet = realmSetOf() // var nullableDecimal128SetField: RealmSet = realmSetOf() // var nullableRealmAnySetField: RealmSet = realmSetOf() -// @TypeAdapter(StringRealmDictionaryAdapter::class) var stringDictionaryField: RealmDictionary = realmDictionaryOf() - // var byteDictionaryField: RealmDictionary = realmDictionaryOf() +// var byteDictionaryField: RealmDictionary = realmDictionaryOf() // var charDictionaryField: RealmDictionary = realmDictionaryOf() // var shortDictionaryField: RealmDictionary = realmDictionaryOf() // var intDictionaryField: RealmDictionary = realmDictionaryOf() @@ -178,8 +216,9 @@ class AllTypes : RealmObject { // var uuidDictionaryField: RealmDictionary = realmDictionaryOf() // var binaryDictionaryField: RealmDictionary = realmDictionaryOf() // var decimal128DictionaryField: RealmDictionary = realmDictionaryOf() -// -// var nullableStringDictionaryField: RealmDictionary = realmDictionaryOf() + + @TypeAdapter(NullableStringRealmDictionaryAdapter::class) + var nullableStringDictionaryField: RealmDictionary = realmDictionaryOf() // var nullableByteDictionaryField: RealmDictionary = realmDictionaryOf() // var nullableCharDictionaryField: RealmDictionary = realmDictionaryOf() // var nullableShortDictionaryField: RealmDictionary = realmDictionaryOf() @@ -195,105 +234,117 @@ class AllTypes : RealmObject { // var nullableBinaryDictionaryField: RealmDictionary = realmDictionaryOf() // var nullableDecimal128DictionaryField: RealmDictionary = realmDictionaryOf() // var nullableRealmAnyDictionaryField: RealmDictionary = realmDictionaryOf() -// var nullableObjectDictionaryFieldNotNull: RealmDictionary = realmDictionaryOf() -// var nullableObjectDictionaryFieldNull: RealmDictionary = realmDictionaryOf() -// -// val objectBacklinks by backlinks(Sample::nullableObject) -// val listBacklinks by backlinks(Sample::objectListField) -// val setBacklinks by backlinks(Sample::objectSetField) -// -// @PersistedName("persistedStringField") -// var publicStringField = "Realm" -// -// // For verification that references inside class is also using our modified accessors and are -// // not optimized to use the backing field directly. -// fun stringFieldGetter(): String { -// return stringField -// } -// -// fun stringFieldSetter(s: String) { -// stringField = s -// } - var adaptedStringListField: RealmList = realmListOf() - var adaptedStringSetField: RealmSet = realmSetOf() - var adaptedStringDictionaryField: RealmDictionary = realmDictionaryOf() +// var nullableObjectDictionaryFieldNotNull: RealmDictionary = realmDictionaryOf() + @TypeAdapter(ReferencedObjectRealmDictionaryAdapter::class) + var nullableObjectDictionaryFieldNull: RealmDictionary = realmDictionaryOf() - companion object { - // Empty object required by SampleTests - } - - @Suppress("ComplexMethod") - override fun equals(other: Any?): Boolean { - if (this === other) return true - if (other == null || this::class != other::class) return false + var adaptedStringListField: RealmList = realmListOf() + var adaptedStringSetField: RealmSet = realmSetOf() + var adaptedStringDictionaryField: RealmDictionary = realmDictionaryOf() - other as AllTypes + var adaptedObjectListField: RealmList = realmListOf() + var adaptedObjectSetField: RealmSet = realmSetOf() + var adaptedObjectDictionaryField: RealmDictionary = + realmDictionaryOf() - if (stringField != other.stringField) return false - if (booleanField != other.booleanField) return false - if (floatField != other.floatField) return false - if (doubleField != other.doubleField) return false - if (decimal128Field != other.decimal128Field) return false - if (timestampField != other.timestampField) return false - if (objectIdField != other.objectIdField) return false - if (bsonObjectIdField != other.bsonObjectIdField) return false - if (uuidField != other.uuidField) return false - if (!binaryField.contentEquals(other.binaryField)) return false - if (nullableStringField != other.nullableStringField) return false - if (nullableBooleanField != other.nullableBooleanField) return false - if (nullableFloatField != other.nullableFloatField) return false - if (nullableDoubleField != other.nullableDoubleField) return false - if (nullableDecimal128Field != other.nullableDecimal128Field) return false - if (nullableTimestampField != other.nullableTimestampField) return false - if (nullableObjectIdField != other.nullableObjectIdField) return false - if (nullableBsonObjectIdField != other.nullableBsonObjectIdField) return false - if (nullableUuidField != other.nullableUuidField) return false - if (nullableBinaryField != null) { - if (other.nullableBinaryField == null) return false - if (!nullableBinaryField.contentEquals(other.nullableBinaryField)) return false - } else if (other.nullableBinaryField != null) return false - if (nullableRealmAnyField != other.nullableRealmAnyField) return false - if (nullableObject != other.nullableObject) return false - if (stringListField != other.stringListField) return false - if (stringSetField != other.stringSetField) return false - if (stringDictionaryField != other.stringDictionaryField) return false - if (adaptedStringListField != other.adaptedStringListField) return false - if (adaptedStringSetField != other.adaptedStringSetField) return false - if (adaptedStringDictionaryField != other.adaptedStringDictionaryField) return false - return true - } - - override fun hashCode(): Int { - var result = stringField.hashCode() - result = 31 * result + booleanField.hashCode() - result = 31 * result + floatField.hashCode() - result = 31 * result + doubleField.hashCode() - result = 31 * result + decimal128Field.hashCode() - result = 31 * result + timestampField.hashCode() - result = 31 * result + objectIdField.hashCode() - result = 31 * result + bsonObjectIdField.hashCode() - result = 31 * result + uuidField.hashCode() - result = 31 * result + binaryField.contentHashCode() - result = 31 * result + (nullableStringField?.hashCode() ?: 0) - result = 31 * result + (nullableBooleanField?.hashCode() ?: 0) - result = 31 * result + (nullableFloatField?.hashCode() ?: 0) - result = 31 * result + (nullableDoubleField?.hashCode() ?: 0) - result = 31 * result + (nullableDecimal128Field?.hashCode() ?: 0) - result = 31 * result + (nullableTimestampField?.hashCode() ?: 0) - result = 31 * result + (nullableObjectIdField?.hashCode() ?: 0) - result = 31 * result + (nullableBsonObjectIdField?.hashCode() ?: 0) - result = 31 * result + (nullableUuidField?.hashCode() ?: 0) - result = 31 * result + (nullableBinaryField?.contentHashCode() ?: 0) - result = 31 * result + (nullableRealmAnyField?.hashCode() ?: 0) - result = 31 * result + (nullableObject?.hashCode() ?: 0) - result = 31 * result + stringListField.hashCode() - result = 31 * result + stringSetField.hashCode() - result = 31 * result + stringDictionaryField.hashCode() - result = 31 * result + adaptedStringListField.hashCode() - result = 31 * result + adaptedStringSetField.hashCode() - result = 31 * result + adaptedStringDictionaryField.hashCode() - return result + companion object { + val properties: Map> + + init { + val fieldProperties = (listOf( + String::class to AllTypes::stringField, + Long::class to AllTypes::longField, + Boolean::class to AllTypes::booleanField, + Float::class to AllTypes::floatField, + Double::class to AllTypes::doubleField, + Decimal128::class to AllTypes::decimal128Field, + RealmInstant::class to AllTypes::timestampField, + ObjectId::class to AllTypes::objectIdField, + BsonObjectId::class to AllTypes::bsonObjectIdField, + RealmUUID::class to AllTypes::uuidField, + ByteArray::class to AllTypes::binaryField, + ).map { pair -> + TypeDescriptor.ElementType(pair.first, false) to pair.second + } + listOf( + String::class to AllTypes::nullableStringField, + Long::class to AllTypes::nullableLongField, + Boolean::class to AllTypes::nullableBooleanField, + Float::class to AllTypes::nullableFloatField, + Double::class to AllTypes::nullableDoubleField, + Decimal128::class to AllTypes::nullableDecimal128Field, + RealmInstant::class to AllTypes::nullableTimestampField, + ObjectId::class to AllTypes::nullableObjectIdField, + BsonObjectId::class to AllTypes::nullableBsonObjectIdField, + RealmUUID::class to AllTypes::nullableUuidField, + ByteArray::class to AllTypes::nullableBinaryField, + RealmAny::class to AllTypes::nullableRealmAnyField, + RealmObject::class to AllTypes::nullableObject, + ).map { pair -> + TypeDescriptor.ElementType(pair.first, true) to pair.second + }).associate { pair -> + TypeDescriptor.RealmFieldType( + collectionType = CollectionType.RLM_COLLECTION_TYPE_NONE, + elementType = pair.first + ) to pair.second + } + + val listProperties = (listOf( + // NON NULLABLE CLASSIFIERS TO LISTS + String::class to AllTypes::stringListField, + RealmObject::class to AllTypes::objectListField, + ).map { pair -> + TypeDescriptor.ElementType(pair.first, false) to pair.second + } + listOf( + // NULLABLE CLASSIFIERS TO LISTS + String::class to AllTypes::nullableStringListField, + ).map { pair -> + TypeDescriptor.ElementType(pair.first, true) to pair.second + }).associate { pair -> + TypeDescriptor.RealmFieldType( + collectionType = CollectionType.RLM_COLLECTION_TYPE_LIST, + elementType = pair.first + ) to pair.second + } + + val setProperties = (listOf( + // NON NULLABLE CLASSIFIERS TO SETS + String::class to AllTypes::stringSetField, + RealmObject::class to AllTypes::objectSetField, + ).map { pair -> + TypeDescriptor.ElementType(pair.first, false) to pair.second + } + listOf( + // NULLABLE CLASSIFIERS TO SETS + String::class to AllTypes::nullableStringSetField, + ).map { pair -> + TypeDescriptor.ElementType(pair.first, true) to pair.second + }).associate { pair -> + TypeDescriptor.RealmFieldType( + collectionType = CollectionType.RLM_COLLECTION_TYPE_SET, + elementType = pair.first + ) to pair.second + } + + val dictionaryProperties = (listOf( + // NON NULLABLE CLASSIFIERS TO DICTIONARY + String::class to AllTypes::stringDictionaryField, + ).map { pair -> + TypeDescriptor.ElementType(pair.first, false) to pair.second + } + listOf( + // NULLABLE CLASSIFIERS TO DICTIONARY + String::class to AllTypes::nullableStringDictionaryField, + RealmObject::class to AllTypes::nullableObjectDictionaryFieldNull, + ).map { pair -> + TypeDescriptor.ElementType(pair.first, true) to pair.second + }).associate { pair -> + TypeDescriptor.RealmFieldType( + collectionType = CollectionType.RLM_COLLECTION_TYPE_DICTIONARY, + elementType = pair.first + ) to pair.second + } + + properties = fieldProperties + listProperties + setProperties + dictionaryProperties + } } } @@ -304,13 +355,10 @@ object StringAdapter : RealmTypeAdapter { override fun toRealm(value: String): String = value.toString() } -typealias RealmBsonString = @TypeAdapter(BsonStringAdapter::class) BsonString +typealias AdaptedString = @TypeAdapter(StringAdapter::class) String -object BsonStringAdapter : RealmTypeAdapter { - override fun fromRealm(realmValue: String): BsonString = BsonString(realmValue) - - override fun toRealm(value: BsonString): String = value.value -} +typealias RealmReferencedObject = @TypeAdapter(ReferencedObjectAdapter::class) ReferencedObject +typealias NullableRealmReferencedObject = @TypeAdapter(NullableReferencedObjectAdapter::class) ReferencedObject? object BooleanAdapter : RealmTypeAdapter { override fun fromRealm(realmValue: Boolean): Boolean = realmValue.not().not() @@ -318,6 +366,12 @@ object BooleanAdapter : RealmTypeAdapter { override fun toRealm(value: Boolean): Boolean = value.not().not() } +object LongAdapter : RealmTypeAdapter { + override fun fromRealm(realmValue: Long): Long = realmValue + + override fun toRealm(value: Long): Long = value +} + object FloatAdapter : RealmTypeAdapter { override fun fromRealm(realmValue: Float): Float = realmValue.toFloat() @@ -385,6 +439,12 @@ object NullableBooleanAdapter : RealmTypeAdapter { override fun toRealm(value: Boolean?): Boolean? = value?.not()?.not() } +object NullableLongAdapter : RealmTypeAdapter { + override fun fromRealm(realmValue: Long?): Long? = realmValue + + override fun toRealm(value: Long?): Long? = value +} + object NullableFloatAdapter : RealmTypeAdapter { override fun fromRealm(realmValue: Float?): Float? = realmValue?.toFloat() @@ -454,10 +514,20 @@ object RealmAnyAdapter : RealmTypeAdapter { override fun toRealm(value: RealmAny?): RealmAny? = value?.let { value.clone() } } -object AllTypesObjectAdapter : RealmTypeAdapter { - override fun fromRealm(realmValue: AllTypes?): AllTypes? = realmValue?.let { AllTypes() } +object ReferencedObjectAdapter : RealmTypeAdapter { + override fun fromRealm(realmValue: ReferencedObject): ReferencedObject = + realmValue.let { ReferencedObject().apply { stringField = realmValue.stringField } } + + override fun toRealm(value: ReferencedObject): ReferencedObject = + value.let { ReferencedObject().apply { stringField = value.stringField } } +} + +object NullableReferencedObjectAdapter : RealmTypeAdapter { + override fun fromRealm(realmValue: ReferencedObject?): ReferencedObject? = + realmValue?.let { ReferencedObject().apply { stringField = realmValue.stringField } } - override fun toRealm(value: AllTypes?): AllTypes? = value?.let { AllTypes() } + override fun toRealm(value: ReferencedObject?): ReferencedObject? = + value?.let { ReferencedObject().apply { stringField = value.stringField } } } object StringRealmListAdapter : RealmTypeAdapter, RealmList> { @@ -468,6 +538,23 @@ object StringRealmListAdapter : RealmTypeAdapter, RealmList().apply { addAll(value) } } +object NullableStringRealmListAdapter : RealmTypeAdapter, RealmList> { + override fun fromRealm(realmValue: RealmList): RealmList = + realmListOf().apply { addAll(realmValue) } + + override fun toRealm(value: RealmList): RealmList = + realmListOf().apply { addAll(value) } +} + +object ReferencedObjectRealmListAdapter : + RealmTypeAdapter, RealmList> { + override fun fromRealm(realmValue: RealmList): RealmList = + realmListOf().apply { addAll(realmValue) } + + override fun toRealm(value: RealmList): RealmList = + realmListOf().apply { addAll(value) } +} + object StringRealmSetAdapter : RealmTypeAdapter, RealmSet> { override fun fromRealm(realmValue: RealmSet): RealmSet = realmSetOf().apply { addAll(realmValue) } @@ -476,6 +563,23 @@ object StringRealmSetAdapter : RealmTypeAdapter, RealmSet().apply { addAll(value) } } +object NullableStringRealmSetAdapter : RealmTypeAdapter, RealmSet> { + override fun fromRealm(realmValue: RealmSet): RealmSet = + realmSetOf().apply { addAll(realmValue) } + + override fun toRealm(value: RealmSet): RealmSet = + realmSetOf().apply { addAll(value) } +} + +object ReferencedObjectRealmSetAdapter : + RealmTypeAdapter, RealmSet> { + override fun fromRealm(realmValue: RealmSet): RealmSet = + realmSetOf().apply { addAll(realmValue) } + + override fun toRealm(value: RealmSet): RealmSet = + realmSetOf().apply { addAll(value) } +} + object StringRealmDictionaryAdapter : RealmTypeAdapter, RealmDictionary> { override fun fromRealm(realmValue: RealmDictionary): RealmDictionary = @@ -485,6 +589,24 @@ object StringRealmDictionaryAdapter : realmDictionaryOf().apply { putAll(value) } } +object ReferencedObjectRealmDictionaryAdapter : + RealmTypeAdapter, RealmDictionary> { + override fun fromRealm(realmValue: RealmDictionary): RealmDictionary = + realmDictionaryOf().apply { putAll(realmValue) } + + override fun toRealm(value: RealmDictionary): RealmDictionary = + realmDictionaryOf().apply { putAll(value) } +} + +object NullableStringRealmDictionaryAdapter : + RealmTypeAdapter, RealmDictionary> { + override fun fromRealm(realmValue: RealmDictionary): RealmDictionary = + realmDictionaryOf().apply { putAll(realmValue) } + + override fun toRealm(value: RealmDictionary): RealmDictionary = + realmDictionaryOf().apply { putAll(value) } +} + internal fun RealmAny.clone() = when (type) { RealmAny.Type.INT -> RealmAny.create(asInt()) RealmAny.Type.BOOL -> RealmAny.create(asBoolean()) diff --git a/packages/test-base/src/commonTest/kotlin/io/realm/kotlin/test/common/TypeAdapterTests.kt b/packages/test-base/src/commonTest/kotlin/io/realm/kotlin/test/common/TypeAdapterTests.kt index 52fff15381..12f5634296 100644 --- a/packages/test-base/src/commonTest/kotlin/io/realm/kotlin/test/common/TypeAdapterTests.kt +++ b/packages/test-base/src/commonTest/kotlin/io/realm/kotlin/test/common/TypeAdapterTests.kt @@ -19,36 +19,39 @@ import io.realm.kotlin.Realm import io.realm.kotlin.RealmConfiguration import io.realm.kotlin.entities.adapters.AllTypes import io.realm.kotlin.entities.adapters.RealmInstantBsonDateTimeAdapterInstanced +import io.realm.kotlin.entities.adapters.ReferencedObject import io.realm.kotlin.entities.adapters.UsingInstancedAdapter import io.realm.kotlin.entities.adapters.UsingSingletonAdapter import io.realm.kotlin.ext.realmDictionaryOf import io.realm.kotlin.ext.realmListOf import io.realm.kotlin.ext.realmSetOf +import io.realm.kotlin.internal.interop.CollectionType +import io.realm.kotlin.schema.RealmStorageType import io.realm.kotlin.test.platform.PlatformUtils +import io.realm.kotlin.test.util.TypeDescriptor +import io.realm.kotlin.test.util.TypeDescriptor.unsupportedRealmTypeAdaptersClassifiers +import io.realm.kotlin.types.ObjectId +import io.realm.kotlin.types.RealmAny +import io.realm.kotlin.types.RealmInstant +import io.realm.kotlin.types.RealmObject +import io.realm.kotlin.types.RealmUUID import org.mongodb.kbson.BsonDateTime -import org.mongodb.kbson.BsonString +import org.mongodb.kbson.BsonObjectId +import org.mongodb.kbson.Decimal128 +import kotlin.reflect.KMutableProperty1 import kotlin.test.AfterTest import kotlin.test.BeforeTest import kotlin.test.Test +import kotlin.test.assertContentEquals import kotlin.test.assertEquals /** - * This test suite should cover these points - * Schema validation - * Singleton / instanced adapters - * All types including collections - * Nullability - * Default values - * Compatibility with other annotations: - * - PrimaryKey - * - Index - * - Fulltext search - * - PersistedName - * - Ignore - * Backlinks - * missing instance type adapters - * copyFromRealm - * access objects realm? + * This test suite should cover these points: + * - [x] Schema validation + * - [x] Singleton / instanced adapters + * - [-] All types including collections + * - [x] Default values + * - [x] copyFromRealm */ class TypeAdapterTests { private lateinit var tmpDir: String @@ -59,7 +62,14 @@ class TypeAdapterTests { @BeforeTest fun setup() { tmpDir = PlatformUtils.createTempDir() - configuration = RealmConfiguration.Builder(setOf(UsingSingletonAdapter::class, UsingInstancedAdapter::class, AllTypes::class)) + configuration = RealmConfiguration.Builder( + setOf( + UsingSingletonAdapter::class, + UsingInstancedAdapter::class, + AllTypes::class, + ReferencedObject::class + ) + ) .directory(tmpDir) .typeAdapters { add(RealmInstantBsonDateTimeAdapterInstanced()) @@ -76,6 +86,13 @@ class TypeAdapterTests { PlatformUtils.deleteTempDir(tmpDir) } + @Test + fun schemaValidation() { + val realmProperty = + realm.schema()[UsingSingletonAdapter::class.simpleName!!]!![UsingSingletonAdapter::date.name]!! + assertEquals(RealmStorageType.TIMESTAMP, realmProperty.type.storageType) + } + @Test fun useSingletonAdapter() { val expectedDate = BsonDateTime() @@ -109,18 +126,131 @@ class TypeAdapterTests { } @Test - fun allTypes() { - val unmanagedObject = AllTypes().apply { - this.stringListField = realmListOf("hello", "world", "www") - this.adaptedStringListField = realmListOf(BsonString("hello")) - this.adaptedStringSetField = realmSetOf(BsonString("hello")) - this.adaptedStringDictionaryField = realmDictionaryOf("test" to BsonString("hello")) - } + fun roundTripAllTypes() { + TypeDescriptor.allFieldTypes + .filterNot { fieldType -> + fieldType.elementType.classifier in unsupportedRealmTypeAdaptersClassifiers + } + .filter { fieldType -> + fieldType in AllTypes.properties + } + .forEach { fieldType: TypeDescriptor.RealmFieldType -> + val testProperty: KMutableProperty1 = + AllTypes.properties[fieldType]!! as KMutableProperty1 - val managedObject = realm.writeBlocking { - copyToRealm(unmanagedObject) - } + val testClassifier = fieldType.elementType.classifier + + val unmanaged = AllTypes() - assertEquals(unmanagedObject, managedObject) + val testValues = testValues[testClassifier]!! + + when (fieldType.collectionType) { + CollectionType.RLM_COLLECTION_TYPE_NONE -> { + if (fieldType.elementType.nullable) { + testValues + null + } else { + testValues + } + } + + CollectionType.RLM_COLLECTION_TYPE_LIST -> { + if (fieldType.elementType.nullable) { + listOf( + realmListOf().apply { + addAll(testValues) + add(null) + } + ) + } else { + listOf( + realmListOf().apply { + addAll(testValues) + } + ) + } + } + CollectionType.RLM_COLLECTION_TYPE_SET -> { + if (fieldType.elementType.nullable) { + listOf( + realmSetOf().apply { + addAll(testValues) + add(null) + } + ) + } else { + listOf( + realmSetOf().apply { + addAll(testValues) + } + ) + } + } + + CollectionType.RLM_COLLECTION_TYPE_DICTIONARY -> { + val dictValues = testValues + .mapIndexed { index, any -> + "$index" to any + } + + if (fieldType.elementType.nullable) { + listOf( + realmDictionaryOf().apply { + putAll(dictValues) + put("", null) + } + ) + } else { + listOf( + realmDictionaryOf().apply { + putAll(dictValues) + } + ) + } + } + else -> throw IllegalStateException("Unhandled case") + }.forEach { expected -> + testProperty.set(unmanaged, expected) + + val managed = realm.writeBlocking { + copyToRealm(unmanaged) + } + + val actual = testProperty.get(managed) + + when (testClassifier) { + ByteArray::class -> { + assertContentEquals( + expected = expected as ByteArray?, + actual = actual as ByteArray?, + message = "non matching values for property ${testProperty.name}" + ) + } + + else -> { + assertEquals( + expected = expected, + actual = actual, + message = "non matching values for property ${testProperty.name}" + ) + } + } + } + } } } + +private val testValues = mapOf( + String::class to listOf("adfasdf"), + Long::class to listOf(Long.MIN_VALUE, Long.MAX_VALUE), + Boolean::class to listOf(false, true), + Float::class to listOf(Float.MIN_VALUE, Float.MAX_VALUE), + Double::class to listOf(Double.MIN_VALUE, Double.MAX_VALUE), + Decimal128::class to listOf(Decimal128("0")), + RealmInstant::class to listOf(RealmInstant.MAX), + ObjectId::class to listOf(ObjectId.create()), + BsonObjectId::class to listOf(BsonObjectId()), + RealmUUID::class to listOf(RealmUUID.random()), + ByteArray::class to listOf(byteArrayOf(0, 0, 0, 0)), + RealmAny::class to listOf(RealmAny.create("")), + RealmObject::class to listOf(ReferencedObject().apply { stringField = "hello world" }), +) \ No newline at end of file From b4686c0811a21f0cc0769e3eac97a9466665fd6d Mon Sep 17 00:00:00 2001 From: Clemente Date: Wed, 20 Dec 2023 23:45:00 +0100 Subject: [PATCH 28/32] Add roundtrip for adapted type parameters --- .../kotlin/internal/RealmListInternal.kt | 4 +- .../realm/kotlin/internal/RealmMapInternal.kt | 2 +- .../realm/kotlin/internal/RealmSetInternal.kt | 2 +- .../kotlin/entities/adapters/AllTypes.kt | 198 +++++++++++------- .../kotlin/test/common/TypeAdapterTests.kt | 11 +- 5 files changed, 138 insertions(+), 79 deletions(-) diff --git a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmListInternal.kt b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmListInternal.kt index 23b56e6f69..802f8b0f2c 100644 --- a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmListInternal.kt +++ b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmListInternal.kt @@ -21,7 +21,6 @@ import io.realm.kotlin.Versioned import io.realm.kotlin.internal.RealmValueArgumentConverter.convertToQueryArgs import io.realm.kotlin.internal.interop.Callback import io.realm.kotlin.internal.interop.ClassKey -import io.realm.kotlin.internal.interop.MemTrackingAllocator import io.realm.kotlin.internal.interop.RealmChangesPointer import io.realm.kotlin.internal.interop.RealmInterop import io.realm.kotlin.internal.interop.RealmInterop.realm_list_get @@ -30,7 +29,6 @@ import io.realm.kotlin.internal.interop.RealmKeyPathArrayPointer import io.realm.kotlin.internal.interop.RealmListPointer import io.realm.kotlin.internal.interop.RealmNotificationTokenPointer import io.realm.kotlin.internal.interop.RealmObjectInterop -import io.realm.kotlin.internal.interop.RealmValue import io.realm.kotlin.internal.interop.getterScope import io.realm.kotlin.internal.interop.inputScope import io.realm.kotlin.internal.query.ObjectBoundQuery @@ -259,7 +257,7 @@ internal class TypeAdaptedListOperator( override val nativePointer: RealmListPointer by listOperator::nativePointer override val mediator: Mediator by listOperator::mediator override val realmReference: RealmReference by listOperator::realmReference - override val valueConverter: RealmValueConverter by lazy { throw RuntimeException("TypeAdaptedListOperator does not have a valueConverter") } + override val valueConverter: RealmValueConverter by lazy { throw IllegalStateException("TypeAdaptedListOperator does not have a valueConverter") } override fun get(index: Int): E = typeAdapter.fromRealm(listOperator.get(index)) diff --git a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmMapInternal.kt b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmMapInternal.kt index 56a2159fef..cc01e4bb18 100644 --- a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmMapInternal.kt +++ b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmMapInternal.kt @@ -333,7 +333,7 @@ internal class TypeAdaptedMapOperator( override val mediator: Mediator by mapOperator::mediator override val realmReference: RealmReference by mapOperator::realmReference - override val valueConverter: RealmValueConverter by lazy { throw RuntimeException("TypeAdaptedMapOperator does not have a valueConverter") } + override val valueConverter: RealmValueConverter by lazy { throw IllegalStateException("TypeAdaptedMapOperator does not have a valueConverter") } } internal open class PrimitiveMapOperator constructor( diff --git a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmSetInternal.kt b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmSetInternal.kt index 5e04d1029f..2b9305ffa0 100644 --- a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmSetInternal.kt +++ b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmSetInternal.kt @@ -313,7 +313,7 @@ internal class TypeAdaptedSetOperator( override val mediator: Mediator by setOperator::mediator override val realmReference: RealmReference by setOperator::realmReference - override val valueConverter: RealmValueConverter by lazy { throw RuntimeException("TypeAdaptedSetOperator does not have a valueConverter") } + override val valueConverter: RealmValueConverter by lazy { throw IllegalStateException("TypeAdaptedSetOperator does not have a valueConverter") } override fun get(index: Int): E = typeAdapter.fromRealm(setOperator.get(index)) diff --git a/packages/test-base/src/commonMain/kotlin/io/realm/kotlin/entities/adapters/AllTypes.kt b/packages/test-base/src/commonMain/kotlin/io/realm/kotlin/entities/adapters/AllTypes.kt index f7a8b83a65..6a817ca610 100644 --- a/packages/test-base/src/commonMain/kotlin/io/realm/kotlin/entities/adapters/AllTypes.kt +++ b/packages/test-base/src/commonMain/kotlin/io/realm/kotlin/entities/adapters/AllTypes.kt @@ -20,7 +20,6 @@ import io.realm.kotlin.types.annotations.PersistedName import io.realm.kotlin.types.annotations.TypeAdapter import org.mongodb.kbson.BsonDecimal128 import org.mongodb.kbson.BsonObjectId -import org.mongodb.kbson.BsonString import org.mongodb.kbson.Decimal128 import kotlin.reflect.KMutableProperty1 @@ -41,8 +40,6 @@ class ReferencedObject : RealmObject { override fun hashCode(): Int { return stringField.hashCode() } - - } @Suppress("MagicNumber") @@ -247,96 +244,104 @@ class AllTypes : RealmObject { var adaptedObjectDictionaryField: RealmDictionary = realmDictionaryOf() - companion object { val properties: Map> + val adaptedTypeParameterProperties: Map> init { - val fieldProperties = (listOf( - String::class to AllTypes::stringField, - Long::class to AllTypes::longField, - Boolean::class to AllTypes::booleanField, - Float::class to AllTypes::floatField, - Double::class to AllTypes::doubleField, - Decimal128::class to AllTypes::decimal128Field, - RealmInstant::class to AllTypes::timestampField, - ObjectId::class to AllTypes::objectIdField, - BsonObjectId::class to AllTypes::bsonObjectIdField, - RealmUUID::class to AllTypes::uuidField, - ByteArray::class to AllTypes::binaryField, - ).map { pair -> - TypeDescriptor.ElementType(pair.first, false) to pair.second - } + listOf( - String::class to AllTypes::nullableStringField, - Long::class to AllTypes::nullableLongField, - Boolean::class to AllTypes::nullableBooleanField, - Float::class to AllTypes::nullableFloatField, - Double::class to AllTypes::nullableDoubleField, - Decimal128::class to AllTypes::nullableDecimal128Field, - RealmInstant::class to AllTypes::nullableTimestampField, - ObjectId::class to AllTypes::nullableObjectIdField, - BsonObjectId::class to AllTypes::nullableBsonObjectIdField, - RealmUUID::class to AllTypes::nullableUuidField, - ByteArray::class to AllTypes::nullableBinaryField, - RealmAny::class to AllTypes::nullableRealmAnyField, - RealmObject::class to AllTypes::nullableObject, - ).map { pair -> - TypeDescriptor.ElementType(pair.first, true) to pair.second - }).associate { pair -> + val fieldProperties = ( + listOf( + String::class to AllTypes::stringField, + Long::class to AllTypes::longField, + Boolean::class to AllTypes::booleanField, + Float::class to AllTypes::floatField, + Double::class to AllTypes::doubleField, + Decimal128::class to AllTypes::decimal128Field, + RealmInstant::class to AllTypes::timestampField, + ObjectId::class to AllTypes::objectIdField, + BsonObjectId::class to AllTypes::bsonObjectIdField, + RealmUUID::class to AllTypes::uuidField, + ByteArray::class to AllTypes::binaryField, + ).map { pair -> + TypeDescriptor.ElementType(pair.first, false) to pair.second + } + listOf( + String::class to AllTypes::nullableStringField, + Long::class to AllTypes::nullableLongField, + Boolean::class to AllTypes::nullableBooleanField, + Float::class to AllTypes::nullableFloatField, + Double::class to AllTypes::nullableDoubleField, + Decimal128::class to AllTypes::nullableDecimal128Field, + RealmInstant::class to AllTypes::nullableTimestampField, + ObjectId::class to AllTypes::nullableObjectIdField, + BsonObjectId::class to AllTypes::nullableBsonObjectIdField, + RealmUUID::class to AllTypes::nullableUuidField, + ByteArray::class to AllTypes::nullableBinaryField, + RealmAny::class to AllTypes::nullableRealmAnyField, + RealmObject::class to AllTypes::nullableObject, + ).map { pair -> + TypeDescriptor.ElementType(pair.first, true) to pair.second + } + ).associate { pair -> TypeDescriptor.RealmFieldType( collectionType = CollectionType.RLM_COLLECTION_TYPE_NONE, elementType = pair.first ) to pair.second } - val listProperties = (listOf( - // NON NULLABLE CLASSIFIERS TO LISTS - String::class to AllTypes::stringListField, - RealmObject::class to AllTypes::objectListField, - ).map { pair -> - TypeDescriptor.ElementType(pair.first, false) to pair.second - } + listOf( - // NULLABLE CLASSIFIERS TO LISTS - String::class to AllTypes::nullableStringListField, - ).map { pair -> - TypeDescriptor.ElementType(pair.first, true) to pair.second - }).associate { pair -> + val listProperties = ( + listOf( + // NON NULLABLE CLASSIFIERS TO LISTS + String::class to AllTypes::stringListField, + RealmObject::class to AllTypes::objectListField, + ).map { pair -> + TypeDescriptor.ElementType(pair.first, false) to pair.second + } + listOf( + // NULLABLE CLASSIFIERS TO LISTS + String::class to AllTypes::nullableStringListField, + ).map { pair -> + TypeDescriptor.ElementType(pair.first, true) to pair.second + } + ).associate { pair -> TypeDescriptor.RealmFieldType( collectionType = CollectionType.RLM_COLLECTION_TYPE_LIST, elementType = pair.first ) to pair.second } - val setProperties = (listOf( - // NON NULLABLE CLASSIFIERS TO SETS - String::class to AllTypes::stringSetField, - RealmObject::class to AllTypes::objectSetField, - ).map { pair -> - TypeDescriptor.ElementType(pair.first, false) to pair.second - } + listOf( - // NULLABLE CLASSIFIERS TO SETS - String::class to AllTypes::nullableStringSetField, - ).map { pair -> - TypeDescriptor.ElementType(pair.first, true) to pair.second - }).associate { pair -> + val setProperties = ( + listOf( + // NON NULLABLE CLASSIFIERS TO SETS + String::class to AllTypes::stringSetField, + RealmObject::class to AllTypes::objectSetField, + ).map { pair -> + TypeDescriptor.ElementType(pair.first, false) to pair.second + } + listOf( + // NULLABLE CLASSIFIERS TO SETS + String::class to AllTypes::nullableStringSetField, + ).map { pair -> + TypeDescriptor.ElementType(pair.first, true) to pair.second + } + ).associate { pair -> TypeDescriptor.RealmFieldType( collectionType = CollectionType.RLM_COLLECTION_TYPE_SET, elementType = pair.first ) to pair.second } - val dictionaryProperties = (listOf( - // NON NULLABLE CLASSIFIERS TO DICTIONARY - String::class to AllTypes::stringDictionaryField, - ).map { pair -> - TypeDescriptor.ElementType(pair.first, false) to pair.second - } + listOf( - // NULLABLE CLASSIFIERS TO DICTIONARY - String::class to AllTypes::nullableStringDictionaryField, - RealmObject::class to AllTypes::nullableObjectDictionaryFieldNull, - ).map { pair -> - TypeDescriptor.ElementType(pair.first, true) to pair.second - }).associate { pair -> + val dictionaryProperties = ( + listOf( + // NON NULLABLE CLASSIFIERS TO DICTIONARY + String::class to AllTypes::stringDictionaryField, + ).map { pair -> + TypeDescriptor.ElementType(pair.first, false) to pair.second + } + listOf( + // NULLABLE CLASSIFIERS TO DICTIONARY + String::class to AllTypes::nullableStringDictionaryField, + RealmObject::class to AllTypes::nullableObjectDictionaryFieldNull, + ).map { pair -> + TypeDescriptor.ElementType(pair.first, true) to pair.second + } + ).associate { pair -> TypeDescriptor.RealmFieldType( collectionType = CollectionType.RLM_COLLECTION_TYPE_DICTIONARY, elementType = pair.first @@ -344,6 +349,57 @@ class AllTypes : RealmObject { } properties = fieldProperties + listProperties + setProperties + dictionaryProperties + + val adaptedListProperties = ( + listOf( + // NON NULLABLE CLASSIFIERS TO LISTS + String::class to AllTypes::adaptedStringListField, + RealmObject::class to AllTypes::adaptedObjectListField, + ).map { pair -> + TypeDescriptor.ElementType(pair.first, false) to pair.second + } + ).associate { pair -> + TypeDescriptor.RealmFieldType( + collectionType = CollectionType.RLM_COLLECTION_TYPE_LIST, + elementType = pair.first + ) to pair.second + } + + val adaptedSetProperties = ( + listOf( + // NON NULLABLE CLASSIFIERS TO SETS + String::class to AllTypes::adaptedStringSetField, + RealmObject::class to AllTypes::adaptedObjectSetField, + ).map { pair -> + TypeDescriptor.ElementType(pair.first, false) to pair.second + } + ).associate { pair -> + TypeDescriptor.RealmFieldType( + collectionType = CollectionType.RLM_COLLECTION_TYPE_SET, + elementType = pair.first + ) to pair.second + } + + val adaptedDictionaryProperties = ( + listOf( + // NON NULLABLE CLASSIFIERS TO DICTIONARY + String::class to AllTypes::adaptedStringDictionaryField, + ).map { pair -> + TypeDescriptor.ElementType(pair.first, false) to pair.second + } + listOf( + // NULLABLE CLASSIFIERS TO DICTIONARY + RealmObject::class to AllTypes::adaptedObjectDictionaryField, + ).map { pair -> + TypeDescriptor.ElementType(pair.first, true) to pair.second + } + ).associate { pair -> + TypeDescriptor.RealmFieldType( + collectionType = CollectionType.RLM_COLLECTION_TYPE_DICTIONARY, + elementType = pair.first + ) to pair.second + } + + adaptedTypeParameterProperties = adaptedListProperties + adaptedSetProperties + adaptedDictionaryProperties } } } diff --git a/packages/test-base/src/commonTest/kotlin/io/realm/kotlin/test/common/TypeAdapterTests.kt b/packages/test-base/src/commonTest/kotlin/io/realm/kotlin/test/common/TypeAdapterTests.kt index 12f5634296..3238c3cc3e 100644 --- a/packages/test-base/src/commonTest/kotlin/io/realm/kotlin/test/common/TypeAdapterTests.kt +++ b/packages/test-base/src/commonTest/kotlin/io/realm/kotlin/test/common/TypeAdapterTests.kt @@ -127,16 +127,21 @@ class TypeAdapterTests { @Test fun roundTripAllTypes() { + validateProperties(AllTypes.properties) + validateProperties(AllTypes.adaptedTypeParameterProperties) + } + + private fun validateProperties(properties: Map>) { TypeDescriptor.allFieldTypes .filterNot { fieldType -> fieldType.elementType.classifier in unsupportedRealmTypeAdaptersClassifiers } .filter { fieldType -> - fieldType in AllTypes.properties + fieldType in properties } .forEach { fieldType: TypeDescriptor.RealmFieldType -> val testProperty: KMutableProperty1 = - AllTypes.properties[fieldType]!! as KMutableProperty1 + properties[fieldType]!! as KMutableProperty1 val testClassifier = fieldType.elementType.classifier @@ -253,4 +258,4 @@ private val testValues = mapOf( ByteArray::class to listOf(byteArrayOf(0, 0, 0, 0)), RealmAny::class to listOf(RealmAny.create("")), RealmObject::class to listOf(ReferencedObject().apply { stringField = "hello world" }), -) \ No newline at end of file +) From f3b0407895a4e822d8af1e67610b5bc9b7580628 Mon Sep 17 00:00:00 2001 From: Clemente Date: Thu, 21 Dec 2023 00:26:22 +0100 Subject: [PATCH 29/32] Disable RealmSet tests on TypedAdapter --- .../kotlin/io/realm/kotlin/test/common/TypeAdapterTests.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/test-base/src/commonTest/kotlin/io/realm/kotlin/test/common/TypeAdapterTests.kt b/packages/test-base/src/commonTest/kotlin/io/realm/kotlin/test/common/TypeAdapterTests.kt index 3238c3cc3e..936024e95a 100644 --- a/packages/test-base/src/commonTest/kotlin/io/realm/kotlin/test/common/TypeAdapterTests.kt +++ b/packages/test-base/src/commonTest/kotlin/io/realm/kotlin/test/common/TypeAdapterTests.kt @@ -133,6 +133,10 @@ class TypeAdapterTests { private fun validateProperties(properties: Map>) { TypeDescriptor.allFieldTypes + .filterNot { + // TODO Deactivated because a bug with contains on RealmSet + it.collectionType == CollectionType.RLM_COLLECTION_TYPE_SET + } .filterNot { fieldType -> fieldType.elementType.classifier in unsupportedRealmTypeAdaptersClassifiers } From 4ba7dab71eedf5987db02e2ca5bee2e2092f8f77 Mon Sep 17 00:00:00 2001 From: Clemente Date: Thu, 21 Dec 2023 01:11:10 +0100 Subject: [PATCH 30/32] Add changelog entry --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 223128527d..45adb851ad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ * None. ### Enhancements -* None. +* Add support for persisting custom types using Realm type adapters. (Issue [#587](https://github.com/realm/realm-kotlin/issues/587)) ### Fixed * None. From 3b76bee706a1663df9af18ec8215ac275e29b264 Mon Sep 17 00:00:00 2001 From: Clemente Date: Thu, 21 Dec 2023 13:06:59 +0100 Subject: [PATCH 31/32] Add documentation --- .../kotlin/io/realm/kotlin/Configuration.kt | 4 +- .../io/realm/kotlin/RealmConfiguration.kt | 2 +- .../io/realm/kotlin/internal/Converters.kt | 2 +- .../kotlin/internal/RealmListInternal.kt | 4 +- .../realm/kotlin/internal/RealmMapInternal.kt | 8 +- .../realm/kotlin/internal/RealmSetInternal.kt | 2 +- .../io/realm/kotlin/types/RealmTypeAdapter.kt | 92 ++++++++++++- .../kotlin/types/annotations/TypeAdapter.kt | 47 ++++++- .../kotlin/compiler/RealmPluginContext.kt | 15 ++ .../src/test/resources/sample/input/Sample.kt | 4 +- .../kotlin/entities/adapters/AllTypes.kt | 129 ++++++++++-------- .../adapters/UsingInstancedAdapter.kt | 4 +- .../adapters/UsingSingletonAdapter.kt | 4 +- .../test/common/RealmConfigurationTests.kt | 4 +- .../kotlin/test/common/TypeAdapterTests.kt | 2 +- ...peAdaptersTests.kt => TypeAdapterTests.kt} | 2 +- 16 files changed, 239 insertions(+), 86 deletions(-) rename packages/test-base/src/jvmTest/kotlin/io/realm/kotlin/test/compiler/{TypeAdaptersTests.kt => TypeAdapterTests.kt} (99%) diff --git a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/Configuration.kt b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/Configuration.kt index bd4ed2b698..1df547a9ed 100644 --- a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/Configuration.kt +++ b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/Configuration.kt @@ -51,7 +51,7 @@ public fun interface CompactOnLaunchCallback { } /** - * TODO + * Builder for setting up any runtime type adapters. */ public class TypeAdapterBuilder { internal val typeAdapters: MutableList> = mutableListOf() @@ -208,7 +208,7 @@ public interface Configuration { public val initialRealmFileConfiguration: InitialRealmFileConfiguration? /** - * TODO + * List of types adapters that would be available in runtime. */ public val typeAdapters: List> diff --git a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/RealmConfiguration.kt b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/RealmConfiguration.kt index 7b53255c15..65fe6a270b 100644 --- a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/RealmConfiguration.kt +++ b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/RealmConfiguration.kt @@ -90,7 +90,7 @@ public interface RealmConfiguration : Configuration { apply { this.directory = directoryPath } /** - * TODO + * Sets the type adapters that would be available in runtime. */ public fun typeAdapters(block: TypeAdapterBuilder.() -> Unit): Builder = apply { diff --git a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/Converters.kt b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/Converters.kt index 5371d999a7..e6194ef8bb 100644 --- a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/Converters.kt +++ b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/Converters.kt @@ -281,7 +281,7 @@ public inline fun fromRealm( obj: RealmObjectReference, adapterClass: KClass<*>, realmValue: Any, -): Any? = getTypeAdapter(obj, adapterClass).fromRealm(realmValue) +): Any? = getTypeAdapter(obj, adapterClass).toPublic(realmValue) internal object RealmInstantConverter : PassThroughPublicConverter() { override inline fun fromRealmValue(realmValue: RealmValue): RealmInstant? = diff --git a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmListInternal.kt b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmListInternal.kt index 802f8b0f2c..9a0b0e5c3b 100644 --- a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmListInternal.kt +++ b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmListInternal.kt @@ -259,7 +259,7 @@ internal class TypeAdaptedListOperator( override val realmReference: RealmReference by listOperator::realmReference override val valueConverter: RealmValueConverter by lazy { throw IllegalStateException("TypeAdaptedListOperator does not have a valueConverter") } - override fun get(index: Int): E = typeAdapter.fromRealm(listOperator.get(index)) + override fun get(index: Int): E = typeAdapter.toPublic(listOperator.get(index)) override fun copy( realmReference: RealmReference, @@ -271,7 +271,7 @@ internal class TypeAdaptedListOperator( element: E, updatePolicy: UpdatePolicy, cache: UnmanagedToManagedObjectCache, - ): E = typeAdapter.fromRealm(listOperator.set(index, typeAdapter.toRealm(element), updatePolicy, cache)) + ): E = typeAdapter.toPublic(listOperator.set(index, typeAdapter.toRealm(element), updatePolicy, cache)) override fun insert( index: Int, diff --git a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmMapInternal.kt b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmMapInternal.kt index cc01e4bb18..62343039d9 100644 --- a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmMapInternal.kt +++ b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmMapInternal.kt @@ -298,7 +298,7 @@ internal class TypeAdaptedMapOperator( override fun getEntryInternal(position: Int): Pair = mapOperator .getEntryInternal(position) .run { - Pair(first, typeAdapter.fromRealm(second)) + Pair(first, typeAdapter.toPublic(second)) } override fun copy( @@ -313,10 +313,10 @@ internal class TypeAdaptedMapOperator( override fun containsValueInternal(value: E): Boolean = mapOperator.containsValueInternal(typeAdapter.toRealm(value)) override fun getInternal(key: K): E? = mapOperator.getInternal(key) - ?.let { typeAdapter.fromRealm(it) } + ?.let { typeAdapter.toPublic(it) } override fun eraseInternal(key: K): Pair = mapOperator.eraseInternal(key).run { - Pair(first?.let { typeAdapter.fromRealm(it) }, second) + Pair(first?.let { typeAdapter.toPublic(it) }, second) } override fun insertInternal( @@ -328,7 +328,7 @@ internal class TypeAdaptedMapOperator( key, value?.let { typeAdapter.toRealm(it) }, updatePolicy, cache ).run { - Pair(first?.let { typeAdapter.fromRealm(it) }, second) + Pair(first?.let { typeAdapter.toPublic(it) }, second) } override val mediator: Mediator by mapOperator::mediator diff --git a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmSetInternal.kt b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmSetInternal.kt index 2b9305ffa0..d3fcc3e753 100644 --- a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmSetInternal.kt +++ b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/internal/RealmSetInternal.kt @@ -315,7 +315,7 @@ internal class TypeAdaptedSetOperator( override val realmReference: RealmReference by setOperator::realmReference override val valueConverter: RealmValueConverter by lazy { throw IllegalStateException("TypeAdaptedSetOperator does not have a valueConverter") } - override fun get(index: Int): E = typeAdapter.fromRealm(setOperator.get(index)) + override fun get(index: Int): E = typeAdapter.toPublic(setOperator.get(index)) override fun copy( realmReference: RealmReference, diff --git a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/types/RealmTypeAdapter.kt b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/types/RealmTypeAdapter.kt index 5065ffd2e0..9492e30889 100644 --- a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/types/RealmTypeAdapter.kt +++ b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/types/RealmTypeAdapter.kt @@ -1,14 +1,94 @@ +/* + * Copyright 2023 Realm Inc. + * + * 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 io.realm.kotlin.types +import io.realm.kotlin.RealmConfiguration +import io.realm.kotlin.types.annotations.TypeAdapter + /** - * TODO + * Interface that defines how to translate from a persisted Realm type to a user-defined one. + * + * In conjunction with the [TypeAdapter] annotation allows using non Realm types in Realm + * models. It takes to type parameters, the Realm type [R] that is the type that Realm + * would use to persist the data, and the public type [P] that would be adapted. + * + * Defining a type adapter with an invalid [R] Realm type would throw at compilation time. + * + * The type adapter resolution depending if the type adapter has been defined as a class or an + * object. When defined as an object the type adapter is resolved in compile time, whereas if defined + * as a class it will be resolved in runtime requiring the RealmConfiguration to hold an instance of + * the type adapter, see [RealmConfiguration.Builder.typeAdapters]. + * + * Example of a compile time adapter: + * + * ``` + * object RealmInstantDateAdapter: RealmTypeAdapter { + * override fun fromRealm(realmValue: RealmInstant): Date = TODO() + * + * override fun toRealm(value: Date): RealmInstant = TODO() + * } + * + * class MyObject: RealmObject { + * @TypeAdapter(RealmInstantDateAdapter::class) + * var date: Date = Date() + * } + * ``` + * + * Example of a runtime adapter: + * + * ``` + * class EncryptedStringAdapter( + * val encryptionKey: String, + * ) : RealmTypeAdapter { + * override fun fromRealm(realmValue: ByteArray): String = TODO() + * + * override fun toRealm(value: String): ByteArray = TODO() + * } + * + * class MyObject : RealmObject { + * @TypeAdapter(EncryptedStringAdapter::class) + * var secureString: String = "some content" + * } + * + * fun createRealmConfig() = + * RealmConfiguration + * .Builder(setOf(MyObject::class)) + * .typeAdapters { + * add(EncryptedStringAdapter("my encryption key")) + * } + * .build() + * ``` * - * @param S storage type. - * @param U user type. + * @param R Realm type. + * @param P Public type. */ -public interface RealmTypeAdapter { // where S is a supported realm type +public interface RealmTypeAdapter { // where S is a supported realm type - public fun fromRealm(realmValue: S): U + /** + * Converts a value from Realm to the public type. + * + * @param value value to convert + */ + public fun toPublic(value: R): P - public fun toRealm(value: U): S + /** + * Converts a value from a public type to Realm. + * + * @param value value to convert + */ + public fun toRealm(value: P): R } diff --git a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/types/annotations/TypeAdapter.kt b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/types/annotations/TypeAdapter.kt index 9ecdce8a3b..e2828dbe0b 100644 --- a/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/types/annotations/TypeAdapter.kt +++ b/packages/library-base/src/commonMain/kotlin/io/realm/kotlin/types/annotations/TypeAdapter.kt @@ -1,5 +1,5 @@ /* - * Copyright 2022 Realm Inc. + * Copyright 2023 Realm Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,6 +23,49 @@ import kotlin.reflect.KClass @Target(AnnotationTarget.PROPERTY, AnnotationTarget.CLASS, AnnotationTarget.TYPE) @MustBeDocumented /** - * TODO + * Annotations marking a field to use a type adapter. + * + * [RealmTypeAdapter] allows using non Realm types in Realm schema models. Data would automatically be + * converted in and out using the type adapter defined by this annotation. + * + * Example of a compile time adapter: + * + * ``` + * object RealmInstantDateAdapter: RealmTypeAdapter { + * override fun fromRealm(realmValue: RealmInstant): Date = TODO() + * + * override fun toRealm(value: Date): RealmInstant = TODO() + * } + * + * class MyObject: RealmObject { + * @TypeAdapter(RealmInstantDateAdapter::class) + * var date: Date = Date() + * } + * ``` + * + * Example of a runtime adapter: + * + * ``` + * class EncryptedStringAdapter( + * val encryptionKey: String, + * ) : RealmTypeAdapter { + * override fun fromRealm(realmValue: ByteArray): String = TODO() + * + * override fun toRealm(value: String): ByteArray = TODO() + * } + * + * class MyObject : RealmObject { + * @TypeAdapter(EncryptedStringAdapter::class) + * var secureString: String = "some content" + * } + * + * fun createRealmConfig() = + * RealmConfiguration + * .Builder(setOf(MyObject::class)) + * .typeAdapters { + * add(EncryptedStringAdapter("my encryption key")) + * } + * .build() + * ``` */ public annotation class TypeAdapter(val adapter: KClass>) diff --git a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/RealmPluginContext.kt b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/RealmPluginContext.kt index 5e76801ef0..47b4d1cc4e 100644 --- a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/RealmPluginContext.kt +++ b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/RealmPluginContext.kt @@ -1,3 +1,18 @@ +/* + * Copyright 2023 Realm Inc. + * + * 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 io.realm.kotlin.compiler import org.jetbrains.kotlin.backend.common.extensions.IrPluginContext diff --git a/packages/plugin-compiler/src/test/resources/sample/input/Sample.kt b/packages/plugin-compiler/src/test/resources/sample/input/Sample.kt index 7f2dc24682..40dd472f33 100644 --- a/packages/plugin-compiler/src/test/resources/sample/input/Sample.kt +++ b/packages/plugin-compiler/src/test/resources/sample/input/Sample.kt @@ -214,13 +214,13 @@ class Sample : RealmObject { } object RealmInstantBsonDateTimeAdapterSingleton: RealmTypeAdapter { - override fun fromRealm(realmValue: RealmInstant): BsonDateTime = BsonDateTime(100) + override fun toPublic(value: RealmInstant): BsonDateTime = BsonDateTime(100) override fun toRealm(value: BsonDateTime): RealmInstant = RealmInstant.now() } class RealmInstantBsonDateTimeAdapterInstanced: RealmTypeAdapter { - override fun fromRealm(realmValue: RealmInstant): BsonDateTime = BsonDateTime(100) + override fun toPublic(value: RealmInstant): BsonDateTime = BsonDateTime(100) override fun toRealm(value: BsonDateTime): RealmInstant = RealmInstant.now() } diff --git a/packages/test-base/src/commonMain/kotlin/io/realm/kotlin/entities/adapters/AllTypes.kt b/packages/test-base/src/commonMain/kotlin/io/realm/kotlin/entities/adapters/AllTypes.kt index 6a817ca610..66874558fe 100644 --- a/packages/test-base/src/commonMain/kotlin/io/realm/kotlin/entities/adapters/AllTypes.kt +++ b/packages/test-base/src/commonMain/kotlin/io/realm/kotlin/entities/adapters/AllTypes.kt @@ -1,3 +1,18 @@ +/* + * Copyright 2023 Realm Inc. + * + * 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 io.realm.kotlin.entities.adapters import io.realm.kotlin.ext.asBsonObjectId @@ -406,7 +421,7 @@ class AllTypes : RealmObject { // Passthrough converters, we could use BsonTypes, but passthrough is also a case to test. object StringAdapter : RealmTypeAdapter { - override fun fromRealm(realmValue: String): String = realmValue.toString() + override fun toPublic(value: String): String = value.toString() override fun toRealm(value: String): String = value.toString() } @@ -417,115 +432,115 @@ typealias RealmReferencedObject = @TypeAdapter(ReferencedObjectAdapter::class) R typealias NullableRealmReferencedObject = @TypeAdapter(NullableReferencedObjectAdapter::class) ReferencedObject? object BooleanAdapter : RealmTypeAdapter { - override fun fromRealm(realmValue: Boolean): Boolean = realmValue.not().not() + override fun toPublic(realmValue: Boolean): Boolean = realmValue.not().not() override fun toRealm(value: Boolean): Boolean = value.not().not() } object LongAdapter : RealmTypeAdapter { - override fun fromRealm(realmValue: Long): Long = realmValue + override fun toPublic(realmValue: Long): Long = realmValue override fun toRealm(value: Long): Long = value } object FloatAdapter : RealmTypeAdapter { - override fun fromRealm(realmValue: Float): Float = realmValue.toFloat() + override fun toPublic(realmValue: Float): Float = realmValue.toFloat() override fun toRealm(value: Float): Float = value.toFloat() } object DoubleAdapter : RealmTypeAdapter { - override fun fromRealm(realmValue: Double): Double = realmValue.toDouble() + override fun toPublic(realmValue: Double): Double = realmValue.toDouble() override fun toRealm(value: Double): Double = value.toDouble() } object Decimal128Adapter : RealmTypeAdapter { - override fun fromRealm(realmValue: Decimal128): Decimal128 = - Decimal128.fromIEEE754BIDEncoding(realmValue.high, realmValue.low) + override fun toPublic(value: Decimal128): Decimal128 = + Decimal128.fromIEEE754BIDEncoding(value.high, value.low) override fun toRealm(value: Decimal128): Decimal128 = Decimal128.fromIEEE754BIDEncoding(value.high, value.low) } object TimestampAdapter : RealmTypeAdapter { - override fun fromRealm(realmValue: RealmInstant): RealmInstant = - RealmInstant.from(realmValue.epochSeconds, realmValue.nanosecondsOfSecond) + override fun toPublic(value: RealmInstant): RealmInstant = + RealmInstant.from(value.epochSeconds, value.nanosecondsOfSecond) override fun toRealm(value: RealmInstant): RealmInstant = RealmInstant.from(value.epochSeconds, value.nanosecondsOfSecond) } object ObjectIdAdapter : RealmTypeAdapter { - override fun fromRealm(realmValue: ObjectId): ObjectId = - ObjectId.from(realmValue.asBsonObjectId().toHexString()) + override fun toPublic(value: ObjectId): ObjectId = + ObjectId.from(value.asBsonObjectId().toHexString()) override fun toRealm(value: ObjectId): ObjectId = ObjectId.from(value.asBsonObjectId().toHexString()) } object BsonObjectIdAdapter : RealmTypeAdapter { - override fun fromRealm(realmValue: BsonObjectId): BsonObjectId = - BsonObjectId(realmValue.toHexString()) + override fun toPublic(value: BsonObjectId): BsonObjectId = + BsonObjectId(value.toHexString()) override fun toRealm(value: BsonObjectId): BsonObjectId = BsonObjectId(value.toHexString()) } object UuidAdapter : RealmTypeAdapter { - override fun fromRealm(realmValue: RealmUUID): RealmUUID = RealmUUID.from(realmValue.bytes) + override fun toPublic(value: RealmUUID): RealmUUID = RealmUUID.from(value.bytes) override fun toRealm(value: RealmUUID): RealmUUID = RealmUUID.from(value.bytes) } object BinaryAdapter : RealmTypeAdapter { - override fun fromRealm(realmValue: ByteArray): ByteArray = realmValue.copyOf() + override fun toPublic(value: ByteArray): ByteArray = value.copyOf() override fun toRealm(value: ByteArray): ByteArray = value.copyOf() } object NullableStringAdapter : RealmTypeAdapter { - override fun fromRealm(realmValue: String?): String? = realmValue?.toString() + override fun toPublic(value: String?): String? = value?.toString() override fun toRealm(value: String?): String? = value?.toString() } object NullableBooleanAdapter : RealmTypeAdapter { - override fun fromRealm(realmValue: Boolean?): Boolean? = realmValue?.not()?.not() + override fun toPublic(value: Boolean?): Boolean? = value?.not()?.not() override fun toRealm(value: Boolean?): Boolean? = value?.not()?.not() } object NullableLongAdapter : RealmTypeAdapter { - override fun fromRealm(realmValue: Long?): Long? = realmValue + override fun toPublic(value: Long?): Long? = value override fun toRealm(value: Long?): Long? = value } object NullableFloatAdapter : RealmTypeAdapter { - override fun fromRealm(realmValue: Float?): Float? = realmValue?.toFloat() + override fun toPublic(value: Float?): Float? = value?.toFloat() override fun toRealm(value: Float?): Float? = value?.toFloat() } object NullableDoubleAdapter : RealmTypeAdapter { - override fun fromRealm(realmValue: Double?): Double? = realmValue?.toDouble() + override fun toPublic(value: Double?): Double? = value?.toDouble() override fun toRealm(value: Double?): Double? = value?.toDouble() } object NullableDecimal128Adapter : RealmTypeAdapter { - override fun fromRealm(realmValue: Decimal128?): Decimal128? = - realmValue?.let { Decimal128.fromIEEE754BIDEncoding(realmValue.high, realmValue.low) } + override fun toPublic(value: Decimal128?): Decimal128? = + value?.let { Decimal128.fromIEEE754BIDEncoding(value.high, value.low) } override fun toRealm(value: Decimal128?): Decimal128? = value?.let { Decimal128.fromIEEE754BIDEncoding(value.high, value.low) } } object NullableTimestampAdapter : RealmTypeAdapter { - override fun fromRealm(realmValue: RealmInstant?): RealmInstant? = realmValue?.let { + override fun toPublic(value: RealmInstant?): RealmInstant? = value?.let { RealmInstant.from( - realmValue.epochSeconds, - realmValue.nanosecondsOfSecond + value.epochSeconds, + value.nanosecondsOfSecond ) } @@ -534,69 +549,69 @@ object NullableTimestampAdapter : RealmTypeAdapter } object NullableObjectIdAdapter : RealmTypeAdapter { - override fun fromRealm(realmValue: ObjectId?): ObjectId? = - realmValue?.let { ObjectId.from(realmValue.asBsonObjectId().toHexString()) } + override fun toPublic(value: ObjectId?): ObjectId? = + value?.let { ObjectId.from(value.asBsonObjectId().toHexString()) } override fun toRealm(value: ObjectId?): ObjectId? = value?.let { ObjectId.from(value.asBsonObjectId().toHexString()) } } object NullableBsonObjectIdAdapter : RealmTypeAdapter { - override fun fromRealm(realmValue: BsonObjectId?): BsonObjectId? = - realmValue?.let { BsonObjectId(realmValue.toHexString()) } + override fun toPublic(value: BsonObjectId?): BsonObjectId? = + value?.let { BsonObjectId(value.toHexString()) } override fun toRealm(value: BsonObjectId?): BsonObjectId? = value?.let { BsonObjectId(value.toHexString()) } } object NullableUuidAdapter : RealmTypeAdapter { - override fun fromRealm(realmValue: RealmUUID?): RealmUUID? = - realmValue?.let { RealmUUID.from(realmValue.bytes) } + override fun toPublic(value: RealmUUID?): RealmUUID? = + value?.let { RealmUUID.from(value.bytes) } override fun toRealm(value: RealmUUID?): RealmUUID? = value?.let { RealmUUID.from(value.bytes) } } object NullableBinaryAdapter : RealmTypeAdapter { - override fun fromRealm(realmValue: ByteArray?): ByteArray? = - realmValue?.let { realmValue.copyOf() } + override fun toPublic(value: ByteArray?): ByteArray? = + value?.let { value.copyOf() } override fun toRealm(value: ByteArray?): ByteArray? = value?.let { value.copyOf() } } object RealmAnyAdapter : RealmTypeAdapter { - override fun fromRealm(realmValue: RealmAny?): RealmAny? = - realmValue?.let { realmValue.clone() } + override fun toPublic(value: RealmAny?): RealmAny? = + value?.let { value.clone() } override fun toRealm(value: RealmAny?): RealmAny? = value?.let { value.clone() } } object ReferencedObjectAdapter : RealmTypeAdapter { - override fun fromRealm(realmValue: ReferencedObject): ReferencedObject = - realmValue.let { ReferencedObject().apply { stringField = realmValue.stringField } } + override fun toPublic(value: ReferencedObject): ReferencedObject = + value.let { ReferencedObject().apply { stringField = value.stringField } } override fun toRealm(value: ReferencedObject): ReferencedObject = value.let { ReferencedObject().apply { stringField = value.stringField } } } object NullableReferencedObjectAdapter : RealmTypeAdapter { - override fun fromRealm(realmValue: ReferencedObject?): ReferencedObject? = - realmValue?.let { ReferencedObject().apply { stringField = realmValue.stringField } } + override fun toPublic(value: ReferencedObject?): ReferencedObject? = + value?.let { ReferencedObject().apply { stringField = value.stringField } } override fun toRealm(value: ReferencedObject?): ReferencedObject? = value?.let { ReferencedObject().apply { stringField = value.stringField } } } object StringRealmListAdapter : RealmTypeAdapter, RealmList> { - override fun fromRealm(realmValue: RealmList): RealmList = - realmListOf().apply { addAll(realmValue) } + override fun toPublic(value: RealmList): RealmList = + realmListOf().apply { addAll(value) } override fun toRealm(value: RealmList): RealmList = realmListOf().apply { addAll(value) } } object NullableStringRealmListAdapter : RealmTypeAdapter, RealmList> { - override fun fromRealm(realmValue: RealmList): RealmList = - realmListOf().apply { addAll(realmValue) } + override fun toPublic(value: RealmList): RealmList = + realmListOf().apply { addAll(value) } override fun toRealm(value: RealmList): RealmList = realmListOf().apply { addAll(value) } @@ -604,24 +619,24 @@ object NullableStringRealmListAdapter : RealmTypeAdapter, Rea object ReferencedObjectRealmListAdapter : RealmTypeAdapter, RealmList> { - override fun fromRealm(realmValue: RealmList): RealmList = - realmListOf().apply { addAll(realmValue) } + override fun toPublic(value: RealmList): RealmList = + realmListOf().apply { addAll(value) } override fun toRealm(value: RealmList): RealmList = realmListOf().apply { addAll(value) } } object StringRealmSetAdapter : RealmTypeAdapter, RealmSet> { - override fun fromRealm(realmValue: RealmSet): RealmSet = - realmSetOf().apply { addAll(realmValue) } + override fun toPublic(value: RealmSet): RealmSet = + realmSetOf().apply { addAll(value) } override fun toRealm(value: RealmSet): RealmSet = realmSetOf().apply { addAll(value) } } object NullableStringRealmSetAdapter : RealmTypeAdapter, RealmSet> { - override fun fromRealm(realmValue: RealmSet): RealmSet = - realmSetOf().apply { addAll(realmValue) } + override fun toPublic(value: RealmSet): RealmSet = + realmSetOf().apply { addAll(value) } override fun toRealm(value: RealmSet): RealmSet = realmSetOf().apply { addAll(value) } @@ -629,8 +644,8 @@ object NullableStringRealmSetAdapter : RealmTypeAdapter, Realm object ReferencedObjectRealmSetAdapter : RealmTypeAdapter, RealmSet> { - override fun fromRealm(realmValue: RealmSet): RealmSet = - realmSetOf().apply { addAll(realmValue) } + override fun toPublic(value: RealmSet): RealmSet = + realmSetOf().apply { addAll(value) } override fun toRealm(value: RealmSet): RealmSet = realmSetOf().apply { addAll(value) } @@ -638,8 +653,8 @@ object ReferencedObjectRealmSetAdapter : object StringRealmDictionaryAdapter : RealmTypeAdapter, RealmDictionary> { - override fun fromRealm(realmValue: RealmDictionary): RealmDictionary = - realmDictionaryOf().apply { putAll(realmValue) } + override fun toPublic(value: RealmDictionary): RealmDictionary = + realmDictionaryOf().apply { putAll(value) } override fun toRealm(value: RealmDictionary): RealmDictionary = realmDictionaryOf().apply { putAll(value) } @@ -647,8 +662,8 @@ object StringRealmDictionaryAdapter : object ReferencedObjectRealmDictionaryAdapter : RealmTypeAdapter, RealmDictionary> { - override fun fromRealm(realmValue: RealmDictionary): RealmDictionary = - realmDictionaryOf().apply { putAll(realmValue) } + override fun toPublic(value: RealmDictionary): RealmDictionary = + realmDictionaryOf().apply { putAll(value) } override fun toRealm(value: RealmDictionary): RealmDictionary = realmDictionaryOf().apply { putAll(value) } @@ -656,8 +671,8 @@ object ReferencedObjectRealmDictionaryAdapter : object NullableStringRealmDictionaryAdapter : RealmTypeAdapter, RealmDictionary> { - override fun fromRealm(realmValue: RealmDictionary): RealmDictionary = - realmDictionaryOf().apply { putAll(realmValue) } + override fun toPublic(value: RealmDictionary): RealmDictionary = + realmDictionaryOf().apply { putAll(value) } override fun toRealm(value: RealmDictionary): RealmDictionary = realmDictionaryOf().apply { putAll(value) } diff --git a/packages/test-base/src/commonMain/kotlin/io/realm/kotlin/entities/adapters/UsingInstancedAdapter.kt b/packages/test-base/src/commonMain/kotlin/io/realm/kotlin/entities/adapters/UsingInstancedAdapter.kt index 04e8911970..37eb0461d0 100644 --- a/packages/test-base/src/commonMain/kotlin/io/realm/kotlin/entities/adapters/UsingInstancedAdapter.kt +++ b/packages/test-base/src/commonMain/kotlin/io/realm/kotlin/entities/adapters/UsingInstancedAdapter.kt @@ -1,5 +1,5 @@ /* - * Copyright 2021 Realm Inc. + * Copyright 2023 Realm Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,7 +32,7 @@ class UsingInstancedAdapter : RealmObject { } class RealmInstantBsonDateTimeAdapterInstanced : RealmTypeAdapter { - override fun fromRealm(realmValue: RealmInstant): BsonDateTime = realmValue.asBsonDateTime() + override fun toPublic(value: RealmInstant): BsonDateTime = value.asBsonDateTime() override fun toRealm(value: BsonDateTime): RealmInstant = value.value.milliseconds.toRealmInstant() diff --git a/packages/test-base/src/commonMain/kotlin/io/realm/kotlin/entities/adapters/UsingSingletonAdapter.kt b/packages/test-base/src/commonMain/kotlin/io/realm/kotlin/entities/adapters/UsingSingletonAdapter.kt index e787fbfb76..f038162bdf 100644 --- a/packages/test-base/src/commonMain/kotlin/io/realm/kotlin/entities/adapters/UsingSingletonAdapter.kt +++ b/packages/test-base/src/commonMain/kotlin/io/realm/kotlin/entities/adapters/UsingSingletonAdapter.kt @@ -1,5 +1,5 @@ /* - * Copyright 2021 Realm Inc. + * Copyright 2023 Realm Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,7 +32,7 @@ class UsingSingletonAdapter : RealmObject { } object RealmInstantBsonDateTimeAdapterSingleton : RealmTypeAdapter { - override fun fromRealm(realmValue: RealmInstant): BsonDateTime = realmValue.asBsonDateTime() + override fun toPublic(value: RealmInstant): BsonDateTime = value.asBsonDateTime() override fun toRealm(value: BsonDateTime): RealmInstant = value.value.milliseconds.toRealmInstant() diff --git a/packages/test-base/src/commonTest/kotlin/io/realm/kotlin/test/common/RealmConfigurationTests.kt b/packages/test-base/src/commonTest/kotlin/io/realm/kotlin/test/common/RealmConfigurationTests.kt index 110548073c..1f53cf3b9e 100644 --- a/packages/test-base/src/commonTest/kotlin/io/realm/kotlin/test/common/RealmConfigurationTests.kt +++ b/packages/test-base/src/commonTest/kotlin/io/realm/kotlin/test/common/RealmConfigurationTests.kt @@ -498,7 +498,7 @@ class RealmConfigurationTests { @Test fun customTypeAdapters_defaultEmpty() { val typeAdapter = object : RealmTypeAdapter { - override fun fromRealm(realmValue: String): String = TODO("Not yet implemented") + override fun toPublic(value: String): String = TODO("Not yet implemented") override fun toRealm(value: String): String = TODO("Not yet implemented") } @@ -512,7 +512,7 @@ class RealmConfigurationTests { @Test fun defineCustomTypeAdapters() { val typeAdapter = object : RealmTypeAdapter { - override fun fromRealm(realmValue: String): String = TODO("Not yet implemented") + override fun toPublic(value: String): String = TODO("Not yet implemented") override fun toRealm(value: String): String = TODO("Not yet implemented") } diff --git a/packages/test-base/src/commonTest/kotlin/io/realm/kotlin/test/common/TypeAdapterTests.kt b/packages/test-base/src/commonTest/kotlin/io/realm/kotlin/test/common/TypeAdapterTests.kt index 936024e95a..345bc257c4 100644 --- a/packages/test-base/src/commonTest/kotlin/io/realm/kotlin/test/common/TypeAdapterTests.kt +++ b/packages/test-base/src/commonTest/kotlin/io/realm/kotlin/test/common/TypeAdapterTests.kt @@ -1,5 +1,5 @@ /* - * Copyright 2021 Realm Inc. + * Copyright 2023 Realm Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/packages/test-base/src/jvmTest/kotlin/io/realm/kotlin/test/compiler/TypeAdaptersTests.kt b/packages/test-base/src/jvmTest/kotlin/io/realm/kotlin/test/compiler/TypeAdapterTests.kt similarity index 99% rename from packages/test-base/src/jvmTest/kotlin/io/realm/kotlin/test/compiler/TypeAdaptersTests.kt rename to packages/test-base/src/jvmTest/kotlin/io/realm/kotlin/test/compiler/TypeAdapterTests.kt index cc9d027f11..8a569a1820 100644 --- a/packages/test-base/src/jvmTest/kotlin/io/realm/kotlin/test/compiler/TypeAdaptersTests.kt +++ b/packages/test-base/src/jvmTest/kotlin/io/realm/kotlin/test/compiler/TypeAdapterTests.kt @@ -46,7 +46,7 @@ import kotlin.test.assertTrue * - [x] Other annotations Ignore, Index etc * - [x] Star projections in persistable types */ -class TypeAdaptersTests { +class TypeAdapterTests { private val typeAdapterTypes = listOf("object", "class") From faab0ab38323e7f4ac9cb75c65c830f602cfde15 Mon Sep 17 00:00:00 2001 From: Clemente Date: Thu, 21 Dec 2023 13:29:35 +0100 Subject: [PATCH 32/32] Update compiler plugin tests --- .../compiler/AccessorModifierIrGeneration.kt | 4 ++-- .../io/realm/kotlin/compiler/Identifiers.kt | 2 +- .../01_AFTER.ValidateIrBeforeLowering.ir | 24 +++++++++---------- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/AccessorModifierIrGeneration.kt b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/AccessorModifierIrGeneration.kt index 2c9c3be277..4d08c62a58 100644 --- a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/AccessorModifierIrGeneration.kt +++ b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/AccessorModifierIrGeneration.kt @@ -21,7 +21,7 @@ import io.realm.kotlin.compiler.ClassIds.TRANSIENT_ANNOTATION import io.realm.kotlin.compiler.ClassIds.TYPE_ADAPTER_ANNOTATION import io.realm.kotlin.compiler.Names.OBJECT_REFERENCE import io.realm.kotlin.compiler.Names.REALM_SYNTHETIC_PROPERTY_PREFIX -import io.realm.kotlin.compiler.Names.REALM_TYPE_ADAPTER_FROM_REALM +import io.realm.kotlin.compiler.Names.REALM_TYPE_ADAPTER_TO_PUBLIC import io.realm.kotlin.compiler.Names.REALM_TYPE_ADAPTER_TO_REALM import org.jetbrains.kotlin.descriptors.ClassKind import org.jetbrains.kotlin.ir.IrStatement @@ -219,7 +219,7 @@ class AccessorModifierIrGeneration(realmPluginContext: RealmPluginContext) : Rea ClassKind.OBJECT -> { val fromRealm = - adapterClass.lookupFunction(REALM_TYPE_ADAPTER_FROM_REALM) + adapterClass.lookupFunction(REALM_TYPE_ADAPTER_TO_PUBLIC) val toRealm = adapterClass.lookupFunction(REALM_TYPE_ADAPTER_TO_REALM) diff --git a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/Identifiers.kt b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/Identifiers.kt index 0df6d6e92c..87f3e34722 100644 --- a/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/Identifiers.kt +++ b/packages/plugin-compiler/src/main/kotlin/io/realm/kotlin/compiler/Identifiers.kt @@ -69,7 +69,7 @@ internal object Names { val REALM_OBJECT_HELPER_SET_OBJECT = Name.identifier("setObject") val REALM_OBJECT_HELPER_SET_EMBEDDED_REALM_OBJECT = Name.identifier("setEmbeddedRealmObject") - val REALM_TYPE_ADAPTER_FROM_REALM = Name.identifier("fromRealm") + val REALM_TYPE_ADAPTER_TO_PUBLIC = Name.identifier("toPublic") val REALM_TYPE_ADAPTER_TO_REALM = Name.identifier("toRealm") // C-interop methods diff --git a/packages/plugin-compiler/src/test/resources/sample/expected/01_AFTER.ValidateIrBeforeLowering.ir b/packages/plugin-compiler/src/test/resources/sample/expected/01_AFTER.ValidateIrBeforeLowering.ir index 301442443f..e057f83e2f 100644 --- a/packages/plugin-compiler/src/test/resources/sample/expected/01_AFTER.ValidateIrBeforeLowering.ir +++ b/packages/plugin-compiler/src/test/resources/sample/expected/01_AFTER.ValidateIrBeforeLowering.ir @@ -6642,9 +6642,9 @@ MODULE_FRAGMENT name:
receiver: GET_VAR ': sample.input.Sample declared in sample.input.Sample.' type=sample.input.Sample origin=null BRANCH if: CONST Boolean type=kotlin.Boolean value=true - then: CALL 'public open fun fromRealm (realmValue: io.realm.kotlin.types.RealmInstant): org.mongodb.kbson.BsonDateTime declared in sample.input.RealmInstantBsonDateTimeAdapterSingleton' type=org.mongodb.kbson.BsonDateTime origin=null + then: CALL 'public open fun toPublic (value: io.realm.kotlin.types.RealmInstant): org.mongodb.kbson.BsonDateTime declared in sample.input.RealmInstantBsonDateTimeAdapterSingleton' type=org.mongodb.kbson.BsonDateTime origin=null $this: GET_OBJECT 'CLASS OBJECT name:RealmInstantBsonDateTimeAdapterSingleton modality:FINAL visibility:public superTypes:[io.realm.kotlin.types.RealmTypeAdapter]' type=sample.input.RealmInstantBsonDateTimeAdapterSingleton - realmValue: CALL 'internal final fun getInstant (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.types.RealmInstant? [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.types.RealmInstant? origin=GET_PROPERTY + value: CALL 'internal final fun getInstant (obj: io.realm.kotlin.internal.RealmObjectReference, propertyName: kotlin.String): io.realm.kotlin.types.RealmInstant? [inline] declared in io.realm.kotlin.internal.RealmObjectHelper' type=io.realm.kotlin.types.RealmInstant? origin=GET_PROPERTY $this: GET_OBJECT 'CLASS IR_EXTERNAL_DECLARATION_STUB OBJECT name:RealmObjectHelper modality:FINAL visibility:internal superTypes:[kotlin.Any]' type=io.realm.kotlin.internal.RealmObjectHelper obj: GET_VAR 'val tmp0_objectReference: io.realm.kotlin.internal.RealmObjectReference? [val] declared in sample.input.Sample.' type=io.realm.kotlin.internal.RealmObjectReference? origin=null propertyName: CONST String type=kotlin.String value="singletonAdaptedRealmInstant" @@ -8908,18 +8908,18 @@ MODULE_FRAGMENT name:
BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS OBJECT name:RealmInstantBsonDateTimeAdapterSingleton modality:FINAL visibility:public superTypes:[io.realm.kotlin.types.RealmTypeAdapter]' - FUN name:fromRealm visibility:public modality:OPEN <> ($this:sample.input.RealmInstantBsonDateTimeAdapterSingleton, realmValue:io.realm.kotlin.types.RealmInstant) returnType:org.mongodb.kbson.BsonDateTime + FUN name:toPublic visibility:public modality:OPEN <> ($this:sample.input.RealmInstantBsonDateTimeAdapterSingleton, value:io.realm.kotlin.types.RealmInstant) returnType:org.mongodb.kbson.BsonDateTime overridden: - public abstract fun fromRealm (realmValue: S of io.realm.kotlin.types.RealmTypeAdapter): U of io.realm.kotlin.types.RealmTypeAdapter declared in io.realm.kotlin.types.RealmTypeAdapter + public abstract fun toPublic (value: R of io.realm.kotlin.types.RealmTypeAdapter): P of io.realm.kotlin.types.RealmTypeAdapter declared in io.realm.kotlin.types.RealmTypeAdapter $this: VALUE_PARAMETER name: type:sample.input.RealmInstantBsonDateTimeAdapterSingleton - VALUE_PARAMETER name:realmValue index:0 type:io.realm.kotlin.types.RealmInstant + VALUE_PARAMETER name:value index:0 type:io.realm.kotlin.types.RealmInstant BLOCK_BODY - RETURN type=kotlin.Nothing from='public open fun fromRealm (realmValue: io.realm.kotlin.types.RealmInstant): org.mongodb.kbson.BsonDateTime declared in sample.input.RealmInstantBsonDateTimeAdapterSingleton' + RETURN type=kotlin.Nothing from='public open fun toPublic (value: io.realm.kotlin.types.RealmInstant): org.mongodb.kbson.BsonDateTime declared in sample.input.RealmInstantBsonDateTimeAdapterSingleton' CONSTRUCTOR_CALL 'public constructor (value: kotlin.Long) [primary] declared in org.mongodb.kbson.BsonDateTime' type=org.mongodb.kbson.BsonDateTime origin=null value: CONST Long type=kotlin.Long value=100 FUN name:toRealm visibility:public modality:OPEN <> ($this:sample.input.RealmInstantBsonDateTimeAdapterSingleton, value:org.mongodb.kbson.BsonDateTime) returnType:io.realm.kotlin.types.RealmInstant overridden: - public abstract fun toRealm (value: U of io.realm.kotlin.types.RealmTypeAdapter): S of io.realm.kotlin.types.RealmTypeAdapter declared in io.realm.kotlin.types.RealmTypeAdapter + public abstract fun toRealm (value: P of io.realm.kotlin.types.RealmTypeAdapter): R of io.realm.kotlin.types.RealmTypeAdapter declared in io.realm.kotlin.types.RealmTypeAdapter $this: VALUE_PARAMETER name: type:sample.input.RealmInstantBsonDateTimeAdapterSingleton VALUE_PARAMETER name:value index:0 type:org.mongodb.kbson.BsonDateTime BLOCK_BODY @@ -8945,18 +8945,18 @@ MODULE_FRAGMENT name:
BLOCK_BODY DELEGATING_CONSTRUCTOR_CALL 'public constructor () [primary] declared in kotlin.Any' INSTANCE_INITIALIZER_CALL classDescriptor='CLASS CLASS name:RealmInstantBsonDateTimeAdapterInstanced modality:FINAL visibility:public superTypes:[io.realm.kotlin.types.RealmTypeAdapter]' - FUN name:fromRealm visibility:public modality:OPEN <> ($this:sample.input.RealmInstantBsonDateTimeAdapterInstanced, realmValue:io.realm.kotlin.types.RealmInstant) returnType:org.mongodb.kbson.BsonDateTime + FUN name:toPublic visibility:public modality:OPEN <> ($this:sample.input.RealmInstantBsonDateTimeAdapterInstanced, value:io.realm.kotlin.types.RealmInstant) returnType:org.mongodb.kbson.BsonDateTime overridden: - public abstract fun fromRealm (realmValue: S of io.realm.kotlin.types.RealmTypeAdapter): U of io.realm.kotlin.types.RealmTypeAdapter declared in io.realm.kotlin.types.RealmTypeAdapter + public abstract fun toPublic (value: R of io.realm.kotlin.types.RealmTypeAdapter): P of io.realm.kotlin.types.RealmTypeAdapter declared in io.realm.kotlin.types.RealmTypeAdapter $this: VALUE_PARAMETER name: type:sample.input.RealmInstantBsonDateTimeAdapterInstanced - VALUE_PARAMETER name:realmValue index:0 type:io.realm.kotlin.types.RealmInstant + VALUE_PARAMETER name:value index:0 type:io.realm.kotlin.types.RealmInstant BLOCK_BODY - RETURN type=kotlin.Nothing from='public open fun fromRealm (realmValue: io.realm.kotlin.types.RealmInstant): org.mongodb.kbson.BsonDateTime declared in sample.input.RealmInstantBsonDateTimeAdapterInstanced' + RETURN type=kotlin.Nothing from='public open fun toPublic (value: io.realm.kotlin.types.RealmInstant): org.mongodb.kbson.BsonDateTime declared in sample.input.RealmInstantBsonDateTimeAdapterInstanced' CONSTRUCTOR_CALL 'public constructor (value: kotlin.Long) [primary] declared in org.mongodb.kbson.BsonDateTime' type=org.mongodb.kbson.BsonDateTime origin=null value: CONST Long type=kotlin.Long value=100 FUN name:toRealm visibility:public modality:OPEN <> ($this:sample.input.RealmInstantBsonDateTimeAdapterInstanced, value:org.mongodb.kbson.BsonDateTime) returnType:io.realm.kotlin.types.RealmInstant overridden: - public abstract fun toRealm (value: U of io.realm.kotlin.types.RealmTypeAdapter): S of io.realm.kotlin.types.RealmTypeAdapter declared in io.realm.kotlin.types.RealmTypeAdapter + public abstract fun toRealm (value: P of io.realm.kotlin.types.RealmTypeAdapter): R of io.realm.kotlin.types.RealmTypeAdapter declared in io.realm.kotlin.types.RealmTypeAdapter $this: VALUE_PARAMETER name: type:sample.input.RealmInstantBsonDateTimeAdapterInstanced VALUE_PARAMETER name:value index:0 type:org.mongodb.kbson.BsonDateTime BLOCK_BODY