arrow-kt / arrow-kt/arrow-analysis

[BUG] Compile Error

Open
#53 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Kotlin
Stars
30
Forks
3
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
Build with a lateinit var that has a private set eg:
```kotlin
public lateinit var committedAt: Instant; private set
```

**Expected behavior**
No error during build process.

**Environment (please complete the following information):**
- Kotlin version: 1.7.21
- Kotlin Intellij IDEA plugin version: 222-1.7.21-release-272-IJ4167.29
- Intellij IDEA version: IntelliJ IDEA 2022.2.3 (Ultimate Edition)

**Additional context**
The full error output:

```log
e: /home/racci/Documents/Coding/Minecraft/Terix/Terix-API/src/main/kotlin/dev/racci/terix/api/data/TemporaryReplacement.kt: (17, 5): exception during analysis: java.lang.ClassCastException
class arrow.meta.plugins.analysis.phases.analysis.solver.ast.kotlin.descriptors.KotlinPropertyAccessorDescriptor cannot be cast to class arrow.meta.plugins.analysis.phases.analysis.solver.ast.context.descriptors.PropertyDescriptor (arrow.meta.plugins.analysis.phases.analysis.solver.ast.kotlin.descriptors.KotlinPropertyAccessorDescriptor and arrow.meta.plugins.analysis.phases.analysis.solver.ast.context.descriptors.PropertyDescriptor are in unnamed module of loader java.net.URLClassLoader @7e210660)
java.lang.ClassCastException: class arrow.meta.plugins.analysis.phases.analysis.solver.ast.kotlin.descriptors.KotlinPropertyAccessorDescriptor cannot be cast to class arrow.meta.plugins.analysis.phases.analysis.solver.ast.context.descriptors.PropertyDescriptor (arrow.meta.plugins.analysis.phases.analysis.solver.ast.kotlin.descriptors.KotlinPropertyAccessorDescriptor and arrow.meta.plugins.analysis.phases.analysis.solver.ast.context.descriptors.PropertyDescriptor are in unnamed module of loader java.net.URLClassLoader @7e210660)
at arrow.meta.plugins.analysis.phases.analysis.solver.check.EntryPointKt.checkDeclarationConstraints(EntryPoint.kt:94)
at arrow.meta.plugins.analysis.phases.PhasesKt$analysisPhases$4.invoke(Phases.kt:136)
at arrow.meta.plugins.analysis.phases.PhasesKt$analysisPhases$4.invoke(Phases.kt:129)
at arrow.meta.dsl.config.ConfigSyntax$storageComponent$1.check(ConfigSyntax.kt:72)
at arrow.meta.internal.registry.InternalRegistry$DelegatingContributor$registerModuleComponents$2.check(InternalRegistry.kt:651)
at org.jetbrains.kotlin.resolve.ModifiersChecker$ModifiersCheckingProcedure.runDeclarationCheckers(ModifiersChecker.java:285)
at org.jetbrains.kotlin.resolve.DeclarationsChecker.checkAccessors(DeclarationsChecker.kt:914)
at org.jetbrains.kotlin.resolve.DeclarationsChecker.checkProperty(DeclarationsChecker.kt:610)
at org.jetbrains.kotlin.resolve.DeclarationsChecker.process(DeclarationsChecker.kt:107)
at org.jetbrains.kotlin.resolve.BodyResolver.resolveBodies(BodyResolver.java:258)
at org.jetbrains.kotlin.resolve.LazyTopDownAnalyzer.analyzeDeclarations(LazyTopDownAnalyzer.kt:227)
at org.jetbrains.kotlin.resolve.LazyTopDownAnalyzer.analyzeDeclarations$default(LazyTopDownAnalyzer.kt:58)
at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration(TopDownAnalyzerFacadeForJVM.kt:131)
at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration$default(TopDownAnalyzerFacadeForJVM.kt:100)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler$analyze$1.invoke(KotlinToJVMBytecodeCompiler.kt:265)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler$analyze$1.invoke(KotlinToJVMBytecodeCompiler.kt:53)
at org.jetbrains.kotlin.cli.common.messages.AnalyzerWithCompilerReport.analyzeAndReport(AnalyzerWithCompilerReport.kt:115)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.analyze(KotlinToJVMBytecodeCompiler.kt:256)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.repeatAnalysisIfNeeded(KotlinToJVMBytecodeCompiler.kt:187)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.repeatAnalysisIfNeeded(KotlinToJVMBytecodeCompiler.kt:187)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.repeatAnalysisIfNeeded(KotlinToJVMBytecodeCompiler.kt:187)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules$cli(KotlinToJVMBytecodeCompiler.kt:99)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules$cli$default(KotlinToJVMBytecodeCompiler.kt:58)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:158)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:53)
at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:99)
at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:47)
at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:101)
at org.jetbrains.kotlin.incremental.IncrementalJvmCompilerRunner.runCompiler(IncrementalJvmCompilerRunner.kt:475)
at org.jetbrains.kotlin.incremental.IncrementalJvmCompilerRunner.runCompiler(IncrementalJvmCompilerRunner.kt:125)
at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compileIncrementally(IncrementalCompilerRunner.kt:373)
at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compileIncrementally$default(IncrementalCompilerRunner.kt:318)
at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.rebuild(IncrementalCompilerRunner.kt:114)
at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compileImpl(IncrementalCompilerRunner.kt:207)
at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compile(IncrementalCompilerRunner.kt:79)
at org.jetbrains.kotlin.daemon.CompileServiceImplBase.execIncrementalCompiler(CompileServiceImpl.kt:625)
at org.jetbrains.kotlin.daemon.CompileServiceImplBase.access$execIncrementalCompiler(CompileServiceImpl.kt:101)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:1746)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:360)
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(AccessController.java:712)
at java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196)
at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:587)
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:828)
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:705)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:704)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:833)```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the failing Kotlin declaration in TemporaryReplacement.kt and trace the reported failure to checkDeclarationConstraints in EntryPoint.kt:94. Read the surrounding analysis flow in Phases.kt and ConfigSyntax.kt to understand how private property accessors are handled. Done means the shown lateinit property with private set builds without the ClassCastException.

Written by the indexing model from the issue text.

Assessment

Tech stack
kotlin
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.