Skip to content

Getting Funny ?compatibility with Kotlin? #1868

@Morons

Description

@Morons

How frequently does the bug occur?

Always

Description

WHY is Realm so far behind?

Using

kotlin-android = "2.1.21"
realm = "3.0.0"

Error

org.jetbrains.kotlin.util.FileAnalysisException: Somewhere in file D:/Development/CupioProjects/Cupio/app/src/main/java/za/co/cupio/core/data/cache/realm/services/EntityRoService.kt: java.lang.NoSuchMethodError: 'org.jetbrains.kotlin.fir.types.ConeKotlinType org.jetbrains.kotlin.fir.types.FirResolvedTypeRef.getType()'

Caused by: java.lang.NoSuchMethodError: 'org.jetbrains.kotlin.fir.types.ConeKotlinType org.jetbrains.kotlin.fir.types.FirResolvedTypeRef.getType()'

Code

class EntityRoService(private val realm: Realm)  {
	
	suspend fun clearEntities() {
		realm.write { delete(schemaClass = EntityRo::class) }
	}
	
	suspend fun upsertEntity(entityRo: EntityRo) {
		realm.write {
			val entity = query(EntityRo::class,"entityId == $0", entityRo.entityId).find()
			if (entity.isEmpty()) copyToRealm(instance = entityRo, updatePolicy = UpdatePolicy.ALL)
			else entityRo.apply {
				val entityToUpdate = EntityRo(
					_id = entity.first()._id,
					entityId = entityId,
                                                ...
					timestamp = timestamp
				)
				copyToRealm(instance = entityToUpdate, updatePolicy = UpdatePolicy.ALL)
			}
		}
	}
	
	fun getEntityById(entityId: String): Entity? {
		val entity =
			realm.query(clazz = EntityRo::class, query = "entityId == $0", entityId).find()
		return if (entity.isNotEmpty()) entity.first().toEntity() else null
	}
}

Stacktrace & log output

Can you reproduce the bug?

-- select --

Reproduction Steps

No response

Version

3.0.0

What Atlas App Services are you using?

Local Database only

Are you using encryption?

No

Platform OS and version(s)

Win 11 64

Build environment

Android Studio version: Android Studio Meerkat Feature Drop | 2024.3.2
Build #AI-243.25659.59.2432.13423653, built on April 29, 2025
Runtime version: 21.0.6+-13368085-b895.109 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Toolkit: sun.awt.windows.WToolkit
Windows 11.0
Kotlin plugin: K2 mode
GC: G1 Young Generation, G1 Concurrent GC, G1 Old Generation
Memory: 6144M
Cores: 12
Registry:
ide.instant.shutdown=false
ide.balloon.shadow.size=0
debugger.new.tool.window.layout=true
ide.experimental.ui=true
Non-Bundled Plugins:
com.intellij.marketplace (243.26574.105)
Statistic (4.4.1)
izhangzhihao.rainbow.brackets (2024.2.15-241)
JProfiler (21.0.1)
com.jetbrains.kmm (0.8.5(243)-7)
org.jetbrains.settingsRepository (243.23654.19)

Android Build Tools version: Temurin 21.0.7+6-LTS, Windows 64 bit
Gradle version: 8.14.2

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions