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

Internal compiler error #791

Closed
sheinin opened this issue Apr 17, 2022 · 5 comments
Closed

Internal compiler error #791

sheinin opened this issue Apr 17, 2022 · 5 comments
Labels
Needs-Attention Reporter has responded. Review comment. O-Community

Comments

@sheinin
Copy link

sheinin commented Apr 17, 2022

java.lang.AssertionError: Recursion detected in a lazy value under LockBasedStorageManager@594a64dc (TopDownAnalyzer for JVM) at org.jetbrains.kotlin.resolve.lazy.descriptors.LazyClassDescriptor.getCompanionObjectDescriptor(LazyClassDescriptor.java:474) at org.jetbrains.kotlin.resolve.lazy.descriptors.LazyClassDescriptor.getCompanionObjectDescriptor(LazyClassDescriptor.java:64) at org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt.getClassValueTypeDescriptor(DescriptorUtils.kt:118) at org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt.getClassValueType(DescriptorUtils.kt:124) at org.jetbrains.kotlin.resolve.scopes.receivers.ClassQualifier.<init>(Qualifier.kt:69) at org.jetbrains.kotlin.resolve.QualifiedExpressionResolver.storeQualifier(QualifiedExpressionResolver.kt:802) at org.jetbrains.kotlin.resolve.QualifiedExpressionResolver.storeResult(QualifiedExpressionResolver.kt:791) at org.jetbrains.kotlin.resolve.QualifiedExpressionResolver.storeResult$default(QualifiedExpressionResolver.kt:761) at org.jetbrains.kotlin.resolve.QualifiedExpressionResolver.resolveToPackageOrClassPrefix(QualifiedExpressionResolver.kt:520) at org.jetbrains.kotlin.resolve.QualifiedExpressionResolver.resolveToPackageOrClassPrefix$default(QualifiedExpressionResolver.kt:481) at org.jetbrains.kotlin.resolve.QualifiedExpressionResolver.resolveToPackageOrClass(QualifiedExpressionResolver.kt:469) at org.jetbrains.kotlin.resolve.QualifiedExpressionResolver.resolveQualifierPartListForType(QualifiedExpressionResolver.kt:141) at org.jetbrains.kotlin.resolve.QualifiedExpressionResolver.resolveDescriptorForType(QualifiedExpressionResolver.kt:129) at org.jetbrains.kotlin.resolve.TypeResolver.resolveDescriptorForType(TypeResolver.kt:1020) at org.jetbrains.kotlin.resolve.TypeResolver$resolveTypeElement$1.visitUserType(TypeResolver.kt:245) at org.jetbrains.kotlin.psi.KtVisitorVoid.visitUserType(KtVisitorVoid.java:937) at org.jetbrains.kotlin.psi.KtVisitorVoid.visitUserType(KtVisitorVoid.java:21) at org.jetbrains.kotlin.psi.KtUserType.accept(KtUserType.java:42) at org.jetbrains.kotlin.psi.KtElementImplStub.accept(KtElementImplStub.java:49) at org.jetbrains.kotlin.resolve.TypeResolver.resolveTypeElement(TypeResolver.kt:243) at org.jetbrains.kotlin.resolve.TypeResolver.resolvePossiblyBareType(TypeResolver.kt:122) at org.jetbrains.kotlin.resolve.TypeResolver.resolveType(TypeResolver.kt:112) at org.jetbrains.kotlin.resolve.TypeResolver.resolveTypeProjections(TypeResolver.kt:973) at org.jetbrains.kotlin.resolve.TypeResolver.resolveTypeForClass(TypeResolver.kt:595) at org.jetbrains.kotlin.resolve.TypeResolver.resolveTypeForClassifier(TypeResolver.kt:562) at org.jetbrains.kotlin.resolve.TypeResolver$resolveTypeElement$1.visitUserType(TypeResolver.kt:261) at org.jetbrains.kotlin.psi.KtVisitorVoid.visitUserType(KtVisitorVoid.java:937) at org.jetbrains.kotlin.psi.KtVisitorVoid.visitUserType(KtVisitorVoid.java:21) at org.jetbrains.kotlin.psi.KtUserType.accept(KtUserType.java:42) at org.jetbrains.kotlin.psi.KtElementImplStub.accept(KtElementImplStub.java:49) at org.jetbrains.kotlin.resolve.TypeResolver.resolveTypeElement(TypeResolver.kt:243) at org.jetbrains.kotlin.resolve.TypeResolver.resolvePossiblyBareType(TypeResolver.kt:122) at org.jetbrains.kotlin.resolve.TypeResolver.resolveType(TypeResolver.kt:112) at org.jetbrains.kotlin.resolve.TypeResolver.resolveType(TypeResolver.kt:83) at org.jetbrains.kotlin.resolve.DescriptorResolver.resolveSuperTypeListEntries(DescriptorResolver.java:214) at org.jetbrains.kotlin.resolve.DescriptorResolver.resolveSupertypes(DescriptorResolver.java:150) at org.jetbrains.kotlin.resolve.lazy.descriptors.LazyClassDescriptor.computeSupertypes(LazyClassDescriptor.java:825) at org.jetbrains.kotlin.resolve.lazy.descriptors.LazyClassDescriptor$LazyClassTypeConstructor.computeSupertypes(LazyClassDescriptor.java:722) at org.jetbrains.kotlin.types.AbstractTypeConstructor$supertypes$1.invoke(AbstractTypeConstructor.kt:77) at org.jetbrains.kotlin.types.AbstractTypeConstructor$supertypes$1.invoke(AbstractTypeConstructor.kt:76) at org.jetbrains.kotlin.storage.LockBasedStorageManager$LockBasedLazyValue.invoke(LockBasedStorageManager.java:408) at org.jetbrains.kotlin.storage.LockBasedStorageManager$LockBasedLazyValueWithPostCompute.invoke(LockBasedStorageManager.java:481) at org.jetbrains.kotlin.storage.LockBasedStorageManager$LockBasedNotNullLazyValueWithPostCompute.invoke(LockBasedStorageManager.java:512) at org.jetbrains.kotlin.types.AbstractTypeConstructor.getSupertypes(AbstractTypeConstructor.kt:26) at org.jetbrains.kotlin.types.AbstractTypeConstructor.getSupertypes(AbstractTypeConstructor.kt:25) at org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt.getSuperInterfaces(DescriptorUtils.kt:160) at io.realm.compiler.IrUtilsKt.getHasRealmModelInterface(IrUtils.kt:110) at io.realm.compiler.RealmModelSyntheticCompanionExtension.getSyntheticCompanionObjectNameIfNeeded(RealmModelSyntheticCompanionExtension.kt:45) at org.jetbrains.kotlin.resolve.lazy.descriptors.LazyClassDescriptor.createSyntheticCompanionObjectDescriptor(LazyClassDescriptor.java:524) at org.jetbrains.kotlin.resolve.lazy.descriptors.LazyClassDescriptor.computeCompanionObjectDescriptor(LazyClassDescriptor.java:505) at org.jetbrains.kotlin.resolve.lazy.descriptors.LazyClassDescriptor.lambda$new$3(LazyClassDescriptor.java:216) at org.jetbrains.kotlin.storage.LockBasedStorageManager$LockBasedLazyValue.invoke(LockBasedStorageManager.java:408) at org.jetbrains.kotlin.resolve.lazy.descriptors.LazyClassDescriptor.getCompanionObjectDescriptor(LazyClassDescriptor.java:474) at org.jetbrains.kotlin.resolve.lazy.descriptors.LazyClassDescriptor.resolveMemberHeaders(LazyClassDescriptor.java:679) at org.jetbrains.kotlin.resolve.lazy.descriptors.LazyClassDescriptor.doForceResolveAllContents(LazyClassDescriptor.java:661) at org.jetbrains.kotlin.resolve.lazy.descriptors.LazyClassDescriptor.lambda$new$4(LazyClassDescriptor.java:220) at org.jetbrains.kotlin.storage.LockBasedStorageManager$LockBasedLazyValue.invoke(LockBasedStorageManager.java:408) at org.jetbrains.kotlin.resolve.lazy.descriptors.LazyClassDescriptor.forceResolveAllContents(LazyClassDescriptor.java:657) at org.jetbrains.kotlin.resolve.lazy.ForceResolveUtil.doForceResolveAllContents(ForceResolveUtil.java:78) at org.jetbrains.kotlin.resolve.lazy.ForceResolveUtil.forceResolveAllContents(ForceResolveUtil.java:42) at org.jetbrains.kotlin.resolve.jvm.extensions.PartialAnalysisHandlerExtension$doAnalysis$1.invoke(PartialAnalysisHandlerExtension.kt:72) at org.jetbrains.kotlin.resolve.jvm.extensions.PartialAnalysisHandlerExtension$doAnalysis$1.invoke(PartialAnalysisHandlerExtension.kt:67) at org.jetbrains.kotlin.resolve.jvm.extensions.PartialAnalysisHandlerExtension.doForEachDeclaration(PartialAnalysisHandlerExtension.kt:123) at org.jetbrains.kotlin.resolve.jvm.extensions.PartialAnalysisHandlerExtension.doForEachDeclaration(PartialAnalysisHandlerExtension.kt:138) at org.jetbrains.kotlin.resolve.jvm.extensions.PartialAnalysisHandlerExtension.doAnalysis(PartialAnalysisHandlerExtension.kt:67) at org.jetbrains.kotlin.kapt3.AbstractKapt3Extension.doAnalysis(Kapt3Extension.kt:152) at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration(TopDownAnalyzerFacadeForJVM.kt:123) at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration$default(TopDownAnalyzerFacadeForJVM.kt:99) at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler$analyze$1.invoke(KotlinToJVMBytecodeCompiler.kt:301) at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler$analyze$1.invoke(KotlinToJVMBytecodeCompiler.kt:55) at org.jetbrains.kotlin.cli.common.messages.AnalyzerWithCompilerReport.analyzeAndReport(AnalyzerWithCompilerReport.kt:113) at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.analyze(KotlinToJVMBytecodeCompiler.kt:292) at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules$cli(KotlinToJVMBytecodeCompiler.kt:102) at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules$cli$default(KotlinToJVMBytecodeCompiler.kt:60) at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:172) at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:54) at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:91) at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:43) at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:93) at org.jetbrains.kotlin.incremental.IncrementalJvmCompilerRunner.runCompiler(IncrementalJvmCompilerRunner.kt:471) at org.jetbrains.kotlin.incremental.IncrementalJvmCompilerRunner.runCompiler(IncrementalJvmCompilerRunner.kt:123) at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compileIncrementally(IncrementalCompilerRunner.kt:367) at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compileIncrementally$default(IncrementalCompilerRunner.kt:309) at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compileImpl$rebuild(IncrementalCompilerRunner.kt:115) at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compileImpl(IncrementalCompilerRunner.kt:167) at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compile(IncrementalCompilerRunner.kt:77) at org.jetbrains.kotlin.daemon.CompileServiceImplBase.execIncrementalCompiler(CompileServiceImpl.kt:623) at org.jetbrains.kotlin.daemon.CompileServiceImplBase.access$execIncrementalCompiler(CompileServiceImpl.kt:101) at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:1718) at jdk.internal.reflect.GeneratedMethodAccessor123.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:359) at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:200) at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:197) at java.base/java.security.AccessController.doPrivileged(Native Method) at java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196) at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:562) at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:796) at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:677) at java.base/java.security.AccessController.doPrivileged(Native Method) at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:676) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:829)

@nhachicha
Copy link
Collaborator

Hi @sheinin can you please share the following to be able to reproduce:

  • Library version
  • Kotlin version
  • Model classes
  • Gradle configuration
  • KMM or Android project?

@sheinin
Copy link
Author

sheinin commented Apr 18, 2022

Realm Kotlin: 0.10.2 (0.10.0)
Kotlin: 1.6.20
Several model classes in an existing application
Android project

The error occurs when upgrading an existing project from Realm Java to Kotlin, although it worked in a clean project.

@sheinin
Copy link
Author

sheinin commented Apr 27, 2022

The error appears when there is a RecyclerView class in app

class CustomAdapter(private val mList: List<ItemsViewModel>) : RecyclerView.Adapter<CustomAdapter.ViewHolder>() {...}

@cmelchior
Copy link
Contributor

Hi @sheinin
Sorry for the late reply. This looks like a duplicate of #339 (comment) . Unfortunately it is an issue with the Kotlin Compiler and how it handles inner classes and generics.

Can you try to move your ViewHolder outside the CustomAdapter so:

class ViewHolder { } 
class CustomAdapter(private val mList: List<ItemsViewModel>) : RecyclerView.Adapter<ViewHolder>() {...}

@sync-by-unito sync-by-unito bot added the Waiting-For-Reporter Waiting for more information from the reporter before we can proceed label May 2, 2022
@sheinin
Copy link
Author

sheinin commented May 4, 2022

It's working, sorry took long to test. Many thanks!

@sheinin sheinin closed this as completed May 4, 2022
@github-actions github-actions bot added Needs-Attention Reporter has responded. Review comment. and removed Waiting-For-Reporter Waiting for more information from the reporter before we can proceed labels May 4, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Needs-Attention Reporter has responded. Review comment. O-Community
Projects
None yet
Development

No branches or pull requests

3 participants