Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StackOverflowError during compilation after updating both kotlin and realm-kotlin to 2.0.0 #1847

Open
TwoEightNine opened this issue Oct 17, 2024 · 3 comments

Comments

@TwoEightNine
Copy link

How frequently does the bug occur?

Always

Description

hello! i'm trying to update my project to kotlin 2.0 and therefore have to update my realm-kotlin version. but at the compilation step i always receive StackOverflowError. (full stacktrace: https://pastebin.com/raw/fHyjEmZK.)

i tried different versions (2.0.0, 2.1.0, 2.2.0, 2.3.0) with correspondent kotlin versions, it doesn't help.

since i see realm plugin there in stacktrace, i decided to create the issue.

Stacktrace & log output

e: java.lang.StackOverflowError
        <omitted since repeated>
        at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
	at org.jetbrains.kotlin.fir.java.declarations.FirJavaClass.getSuperTypeRefs(FirJavaClass.kt:72)
	at io.realm.kotlin.compiler.IrUtilsKt.isBaseRealmObject(IrUtils.kt:211)
	at io.realm.kotlin.compiler.fir.model.CompanionExtension.getNestedClassifiersNames(CompanionExtension.kt:45)
	at org.jetbrains.kotlin.fir.scopes.impl.FirGeneratedMemberDeclarationsStorage.getClassifierStorage$providers(FirGeneratedScopes.kt:155)
	at org.jetbrains.kotlin.fir.scopes.impl.FirGeneratedClassNestedClassifierScope$Companion.create(FirGeneratedScopes.kt:116)
	at org.jetbrains.kotlin.fir.scopes.impl.FirDeclaredMemberScopeProvider.createNestedClassifierScope(FirDeclaredMemberScopeProvider.kt:120)
	at org.jetbrains.kotlin.fir.scopes.impl.FirDeclaredMemberScopeProvider.access$createNestedClassifierScope(FirDeclaredMemberScopeProvider.kt:26)
	at org.jetbrains.kotlin.fir.scopes.impl.FirDeclaredMemberScopeProvider$nestedClassifierCache$1.invoke(FirDeclaredMemberScopeProvider.kt:39)
	at org.jetbrains.kotlin.fir.scopes.impl.FirDeclaredMemberScopeProvider$nestedClassifierCache$1.invoke(FirDeclaredMemberScopeProvider.kt:39)
	at org.jetbrains.kotlin.fir.caches.FirThreadUnsafeCache.getValue(FirThreadUnsafeCachesFactory.kt:40)
	at org.jetbrains.kotlin.fir.scopes.impl.FirDeclaredMemberScopeProvider.nestedClassifierScope(FirDeclaredMemberScopeProvider.kt:182)
	at org.jetbrains.kotlin.fir.scopes.impl.FirDeclaredMemberScopeProviderKt.nestedClassifierScope(FirDeclaredMemberScopeProvider.kt:167)
	at org.jetbrains.kotlin.fir.extensions.FirExtensionDeclarationsSymbolProvider.generateClassLikeDeclaration(FirExtensionDeclarationsSymbolProvider.kt:106)
	at org.jetbrains.kotlin.fir.extensions.FirExtensionDeclarationsSymbolProvider.access$generateClassLikeDeclaration(FirExtensionDeclarationsSymbolProvider.kt:27)
	at org.jetbrains.kotlin.fir.extensions.FirExtensionDeclarationsSymbolProvider$classCache$1.invoke(FirExtensionDeclarationsSymbolProvider.kt:44)
	at org.jetbrains.kotlin.fir.extensions.FirExtensionDeclarationsSymbolProvider$classCache$1.invoke(FirExtensionDeclarationsSymbolProvider.kt:43)
	at org.jetbrains.kotlin.fir.caches.FirThreadUnsafeCache.getValue(FirThreadUnsafeCachesFactory.kt:40)
	at org.jetbrains.kotlin.fir.extensions.FirExtensionDeclarationsSymbolProvider.getClassLikeSymbolByClassId(FirExtensionDeclarationsSymbolProvider.kt:246)
	at org.jetbrains.kotlin.fir.extensions.FirSwitchableExtensionDeclarationsSymbolProvider.getClassLikeSymbolByClassId(FirSwitchableExtensionDeclarationsSymbolProvider.kt:62)
	at org.jetbrains.kotlin.fir.resolve.providers.impl.FirCachingCompositeSymbolProvider.computeClass(FirCachingCompositeSymbolProvider.kt:147)
	at org.jetbrains.kotlin.fir.resolve.providers.impl.FirCachingCompositeSymbolProvider.access$computeClass(FirCachingCompositeSymbolProvider.kt:27)
	at org.jetbrains.kotlin.fir.resolve.providers.impl.FirCachingCompositeSymbolProvider$special$$inlined$createCache$1.invoke(FirCachesFactory.kt:71)
	at org.jetbrains.kotlin.fir.resolve.providers.impl.FirCachingCompositeSymbolProvider$special$$inlined$createCache$1.invoke(FirCachesFactory.kt:69)
	at org.jetbrains.kotlin.fir.caches.FirThreadUnsafeCache.getValue(FirThreadUnsafeCachesFactory.kt:40)
	at org.jetbrains.kotlin.fir.resolve.providers.impl.FirCachingCompositeSymbolProvider.getClassLikeSymbolByClassId(FirCachingCompositeSymbolProvider.kt:174)
	at org.jetbrains.kotlin.fir.resolve.LookupTagUtilsKt.toSymbol(LookupTagUtils.kt:59)
	at org.jetbrains.kotlin.fir.types.ConeTypeContext.toClassLikeSymbol(ConeTypeContext.kt:286)
	at org.jetbrains.kotlin.fir.types.ConeTypeContext.getParameters(ConeTypeContext.kt:278)
	at org.jetbrains.kotlin.load.java.typeEnhancement.AbstractSignatureParts.toIndexed$lambda$23$lambda$22(AbstractSignatureParts.kt:215)
	at org.jetbrains.kotlin.load.java.typeEnhancement.AbstractSignatureParts.flattenTree(AbstractSignatureParts.kt:201)
	at org.jetbrains.kotlin.load.java.typeEnhancement.AbstractSignatureParts.flattenTree(AbstractSignatureParts.kt:201)
	at org.jetbrains.kotlin.load.java.typeEnhancement.AbstractSignatureParts.flattenTree(AbstractSignatureParts.kt:205)
	at org.jetbrains.kotlin.load.java.typeEnhancement.AbstractSignatureParts.toIndexed(AbstractSignatureParts.kt:211)
	at org.jetbrains.kotlin.load.java.typeEnhancement.AbstractSignatureParts.computeIndexedQualifiers(AbstractSignatureParts.kt:174)
	at org.jetbrains.kotlin.load.java.typeEnhancement.AbstractSignatureParts.computeIndexedQualifiers$default(AbstractSignatureParts.kt:169)
	at org.jetbrains.kotlin.fir.java.enhancement.FirSignatureEnhancement.enhance(SignatureEnhancement.kt:834)
	at org.jetbrains.kotlin.fir.java.enhancement.FirSignatureEnhancement.enhance$default(SignatureEnhancement.kt:828)
	at org.jetbrains.kotlin.fir.java.enhancement.FirSignatureEnhancement.enhanceSuperType(SignatureEnhancement.kt:636)
	at org.jetbrains.kotlin.fir.java.enhancement.FirSignatureEnhancement.enhanceSuperTypes(SignatureEnhancement.kt:591)
	at org.jetbrains.kotlin.fir.java.declarations.FirJavaClass.superTypeRefs_delegate$lambda$1(FirJavaClass.kt:74)

Can you reproduce the bug?

Always

Reproduction Steps

  1. update kotlin up to 2.0.*
  2. update realm-kotlin up to 2.*.0 (correspondingly to the kotlin version)
  3. sync project
  4. build the app

Version

2.0.0+

What Atlas App Services are you using?

Local Database only

Are you using encryption?

Yes

Platform OS and version(s)

I wasn't able to even launch

Build environment

Android Studio version: 2024.2.1 Patch 1
Android Build Tools version: not specified
Gradle version: 8.10.2 (AGP 8.7.0)

Copy link

sync-by-unito bot commented Oct 17, 2024

➤ PM Bot commented:

Jira ticket: RKOTLIN-1135

@DmytroSkopiuk
Copy link

Same error with Protobuf dependency (all versions). Without Protobuf works fine in Kotlin2.

@tinoue
Copy link

tinoue commented Dec 22, 2024

The same error occurs with Kotlin 2.0, Realm 2.3, and protobuf-kotlin-lite 4.29.2.
I hope that supporting for Kotlin 2.1.0 will fix the issue, as it seems to be caused by Kotlin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants