realm / realm-kotlin

Kotlin Multiplatform and Android SDK for the Realm Mobile Database: Build Better Apps Faster.
Apache License 2.0
958 stars 61 forks source link

java.lang.NoSuchMethodError at io.realm.kotlin.compiler.RealmModelLowering.lowerFromModuleFragment #1828

Open BlueCobold opened 1 month ago

BlueCobold commented 1 month ago

How frequently does the bug occur?

Always

Description

Hi.

I upgraded my Android project to RealmKotlin 2.1.0 and increased my kotlin version to 2.0.20 and gradle to 8.7.

But when I am building, I get an error in my RealmObject classes:

Stacktrace & log output

java.lang.NoSuchMethodError: 'java.lang.RuntimeException org.jetbrains.kotlin.backend.common.CompilationExceptionKt.wrapWithCompilationException(java.lang.Throwable, java.lang.String, org.jetbrains.kotlin.ir.declarations.IrFile, org.jetbrains.kotlin.ir.IrElement)'
    at io.realm.kotlin.compiler.RealmModelLowering.lowerFromModuleFragment(RealmModelLoweringExtension.kt:83)
    at io.realm.kotlin.compiler.RealmModelLoweringExtension.generate(RealmModelLoweringExtension.kt:53)
    at org.jetbrains.kotlin.fir.pipeline.ConvertToIrKt.applyIrGenerationExtensions(convertToIr.kt:437)
    at org.jetbrains.kotlin.fir.pipeline.Fir2IrPipeline.runActualizationPipeline(convertToIr.kt:246)
    at org.jetbrains.kotlin.fir.pipeline.Fir2IrPipeline.convertToIrAndActualize(convertToIr.kt:130)
    at org.jetbrains.kotlin.fir.pipeline.ConvertToIrKt.convertToIrAndActualize(convertToIr.kt:99)
    at org.jetbrains.kotlin.fir.pipeline.ConvertToIrKt.convertToIrAndActualize$default(convertToIr.kt:72)
    at org.jetbrains.kotlin.cli.jvm.compiler.pipeline.JvmCompilerPipelineKt.convertToIrAndActualizeForJvm(jvmCompilerPipeline.kt:196)
    at org.jetbrains.kotlin.cli.jvm.compiler.pipeline.JvmCompilerPipelineKt.convertAnalyzedFirToIr(jvmCompilerPipeline.kt:169)
    at org.jetbrains.kotlin.cli.jvm.compiler.pipeline.JvmCompilerPipelineKt.compileModulesUsingFrontendIrAndLightTree(jvmCompilerPipeline.kt:140)
    at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:148)
    at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:43)
    at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:103)
    at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:49)
    at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:101)
    at org.jetbrains.kotlin.incremental.IncrementalJvmCompilerRunner.runCompiler(IncrementalJvmCompilerRunner.kt:464)
    at org.jetbrains.kotlin.incremental.IncrementalJvmCompilerRunner.runCompiler(IncrementalJvmCompilerRunner.kt:73)
    at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.doCompile(IncrementalCompilerRunner.kt:506)
    at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compileImpl(IncrementalCompilerRunner.kt:423)
    at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compileNonIncrementally(IncrementalCompilerRunner.kt:301)
    at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compile(IncrementalCompilerRunner.kt:129)
    at org.jetbrains.kotlin.daemon.CompileServiceImplBase.execIncrementalCompiler(CompileServiceImpl.kt:675)
    at org.jetbrains.kotlin.daemon.CompileServiceImplBase.access$execIncrementalCompiler(CompileServiceImpl.kt:92)
    at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:1660)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.base/java.lang.reflect.Method.invoke(Unknown Source)
    at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
    at java.rmi/sun.rmi.transport.Transport$1.run(Unknown Source)
    at java.rmi/sun.rmi.transport.Transport$1.run(Unknown Source)
    at java.base/java.security.AccessController.doPrivileged(Unknown Source)
    at java.rmi/sun.rmi.transport.Transport.serviceCall(Unknown Source)
    at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
    at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(Unknown Source)
    at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(Unknown Source)
    at java.base/java.security.AccessController.doPrivileged(Unknown Source)
    at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.base/java.lang.Thread.run(Unknown Source)

Can you reproduce the bug?

Always

Reproduction Steps

The bug just occurs when compiling the project. It doesn't even tell anymore which file exactly, it did so in lower kotlin versions, but it happened for any of my RealmObjects, no matter how simple they were.

Version

2.1.0

What Atlas App Services are you using?

Local Database only

Are you using encryption?

Yes

Platform OS and version(s)

MacOS Sonoma

Build environment

Android Studio version: 2024.1.2 Android Build Tools version: 34 Gradle version: 8.7

sync-by-unito[bot] commented 1 month ago

➤ PM Bot commented:

Jira ticket: RKOTLIN-1125

BlueCobold commented 1 month ago

It's working with Kotlin set to 2.0.0.

BlueCobold commented 1 month ago

Closed. Duplicate of https://github.com/realm/realm-kotlin/issues/1825