-
Notifications
You must be signed in to change notification settings - Fork 215
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
Code generation (for Java interop) throws exception on recent Kotlin versions #500
Comments
Looks like these errors are thrown mostly when the syntax tree is already broken (and apparently therefore contains nulls), e.g. kotlin-language-server/server/src/test/resources/completions/BackquotedFunction.kt Lines 1 to 3 in 8f96c29
|
@fwcd Thanks for the heads up! I hope to find some time to look at this soon. I like your idea here though: |
Yeah, that fixes some of the errors, but not all unfortunately. Feel free to dig deeper if you find the time, that branch contained a few experiments in that direction. |
Not sure if this is related, but it is a I'm getting this with both the 1.3.7 version downloaded automatically by the VSCode extension, and with a server built from from a7bc925 (1.3.5), so the cause for my issue may not be the Kotlin version as I believe that was changed in 1.3.6. Click below for the error message. DetailsThe root cause java.lang.IllegalStateException was thrown at: org.jetbrains.kotlin.codegen.state.KotlinTypeMapper$typeMappingConfiguration$1.processErrorType(KotlinTypeMapper.kt:124) [Error - 4:39:19 PM] at org.jetbrains.kotlin.codegen.MemberCodegen.genSimpleMember(MemberCodegen.java:217) [Error - 4:39:19 PM] at org.jetbrains.kotlin.codegen.ClassBodyCodegen.generateDeclaration(ClassBodyCodegen.java:170) [Error - 4:39:19 PM] at org.jetbrains.kotlin.codegen.ClassBodyCodegen.generateBody(ClassBodyCodegen.java:88) [Error - 4:39:19 PM] at org.jetbrains.kotlin.codegen.MemberCodegen.generate(MemberCodegen.java:132) [Error - 4:39:19 PM] at org.jetbrains.kotlin.codegen.MemberCodegen.genClassOrObject(MemberCodegen.java:305) [Error - 4:39:19 PM] at org.jetbrains.kotlin.codegen.MemberCodegen.genClassOrObject(MemberCodegen.java:289) [Error - 4:39:19 PM] at org.jetbrains.kotlin.codegen.PackageCodegenImpl.generateClassesAndObjectsInFile(PackageCodegenImpl.java:119) [Error - 4:39:19 PM] at org.jetbrains.kotlin.codegen.PackageCodegenImpl.generateFile(PackageCodegenImpl.java:138) [Error - 4:39:19 PM] at org.jetbrains.kotlin.codegen.PackageCodegenImpl.generate(PackageCodegenImpl.java:70) [Error - 4:39:19 PM] at org.jetbrains.kotlin.codegen.DefaultCodegenFactory.generatePackage(CodegenFactory.kt:143) [Error - 4:39:19 PM] at org.jetbrains.kotlin.codegen.DefaultCodegenFactory.invokeLowerings(CodegenFactory.kt:122) [Error - 4:39:19 PM] at org.jetbrains.kotlin.codegen.CodegenFactory.generateModule(CodegenFactory.kt:44) [Error - 4:39:19 PM] at org.jetbrains.kotlin.codegen.KotlinCodegenFacade.compileCorrectFiles(KotlinCodegenFacade.java:45) [Error - 4:39:19 PM] at org.jetbrains.kotlin.codegen.KotlinCodegenFacade.compileCorrectFiles(KotlinCodegenFacade.java:54) [Error - 4:39:19 PM] at org.javacs.kt.compiler.Compiler.generateCode(Compiler.kt:580) [Error - 4:39:19 PM] at org.javacs.kt.SourcePath.save(SourcePath.kt:277) [Error - 4:39:19 PM] at org.javacs.kt.SourcePath.saveAllFiles(SourcePath.kt:289) [Error - 4:39:19 PM] at org.javacs.kt.KotlinTextDocumentService$lintAll$1.invoke(KotlinTextDocumentService.kt:270) [Error - 4:39:19 PM] at org.javacs.kt.KotlinTextDocumentService$lintAll$1.invoke(KotlinTextDocumentService.kt:268) [Error - 4:39:19 PM] at org.javacs.kt.util.Debouncer.submitImmediately$lambda$1(Debouncer.kt:27) [Error - 4:39:19 PM] at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) [Error - 4:39:19 PM] at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) [Error - 4:39:19 PM] at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) [Error - 4:39:19 PM] at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) [Error - 4:39:19 PM] at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) [Error - 4:39:19 PM] at java.base/java.lang.Thread.run(Thread.java:840) [Error - 4:39:19 PM] Caused by: java.lang.IllegalStateException: Error type encountered: [Error type: Unresolved type for MethodChannel] (ErrorType). [Error - 4:39:19 PM] at org.jetbrains.kotlin.codegen.state.KotlinTypeMapper$typeMappingConfiguration$1.processErrorType(KotlinTypeMapper.kt:124) [Error - 4:39:19 PM] at org.jetbrains.kotlin.load.kotlin.DescriptorBasedTypeSignatureMappingKt.mapType(descriptorBasedTypeSignatureMapping.kt:83) [Error - 4:39:19 PM] at org.jetbrains.kotlin.codegen.state.KotlinTypeMapper.mapType(KotlinTypeMapper.kt:276) [Error - 4:39:19 PM] at org.jetbrains.kotlin.codegen.state.KotlinTypeMapper.mapType$default(KotlinTypeMapper.kt:267) [Error - 4:39:19 PM] at org.jetbrains.kotlin.codegen.state.KotlinTypeMapper.mapType(KotlinTypeMapper.kt) [Error - 4:39:19 PM] at org.jetbrains.kotlin.codegen.PropertyCodegen.generateBackingField(PropertyCodegen.java:409) [Error - 4:39:19 PM] at org.jetbrains.kotlin.codegen.PropertyCodegen.generateBackingField(PropertyCodegen.java:360) [Error - 4:39:19 PM] at org.jetbrains.kotlin.codegen.PropertyCodegen.genBackingFieldAndAnnotations(PropertyCodegen.java:170) [Error - 4:39:19 PM] at org.jetbrains.kotlin.codegen.PropertyCodegen.gen(PropertyCodegen.java:138) [Error - 4:39:19 PM] at org.jetbrains.kotlin.codegen.PropertyCodegen.gen(PropertyCodegen.java:101) [Error - 4:39:19 PM] at org.jetbrains.kotlin.codegen.MemberCodegen.genSimpleMember(MemberCodegen.java:211) [Error - 4:39:19 PM] ... 25 more This is a gradle project that is part of a flutter plugin, and it seems that the error occurs during code generation for the |
I have gated code generation behind the Once we figure out how to make this more stable, I would be more than happy to enable codegen by default again. |
While tinkering with #493, I've noticed that code generation seems to be broken when compiling the language server with Kotlin 1.9.10; the Kotlin compiler's JVM backend throws a lot of
CompilationException
s (see details for full stack trace).The codegen is invoked here:
kotlin-language-server/server/src/main/kotlin/org/javacs/kt/SourcePath.kt
Lines 272 to 283 in ba66720
@daplf From what I can tell, you've added this for the JDT.LS extension, any thoughts? My best guess would be that a lot of internals changed due to the IR-based JVM backend.
The text was updated successfully, but these errors were encountered: