google / ksp

Kotlin Symbol Processing API
https://github.com/google/ksp
Apache License 2.0
2.81k stars 265 forks source link

[1.9.20-1.0.14] Error: Rewrite at slice LEXICAL_SCOPE key: ANNOTATION_ENTRY old value #1591

Closed chrisbanes closed 10 months ago

chrisbanes commented 10 months ago
error: java.lang.AssertionError: Rewrite at slice LEXICAL_SCOPE key: ANNOTATION_ENTRY old value:
org.jetbrains.kotlin.resolve.scopes.LexicalScope$Base@6f93355@116994901
new value: org.jetbrains.kotlin.resolve.scopes.LexicalScope$Base@3568912a@896045354

Seems to only happen on iOS (maybe all Kotlin Native).

Repro: https://github.com/chrisbanes/tivi/pull/1620

rjaros commented 10 months ago

I've got the same problem on Kotlin/JS.

bitspittle commented 10 months ago

Same issue on Linux with Kotlin/JS as well. Didn't happen in 1.0.13 but happens with 1.0.14.

Repro steps

Initial setup

First, make sure compilation works:

Finally, see that 1.0.14 breaks things:

taetae98coding commented 10 months ago

I've got the same problem on Kotlin/JS.

me too.

robertfmurdock commented 10 months ago

I'm also seeing this (observed in kotlin js).

GuilhE commented 10 months ago

Me too, failing for iOS

neetopia commented 10 months ago

To facilitate investigation, are all issues happening on non jvm targets only?

sumit-jha-Pw commented 10 months ago

Yes @neetopia , getting issues while compiling IOS applications only. Caused by: java.lang.Throwable: Rewrite at slice LEXICAL_SCOPE key: ANNOTATION_ENTRY old value: org.jetbrains.kotlin.resolve.scopes.LexicalScope$Base@6320831a@1663075098 new value: org.jetbrains.kotlin.resolve.scopes.LexicalScope$Base@16f23d31@384974129

farhazulmullick-pw commented 10 months ago

@neetopia I have got the same exact issue while compiling against iOS. Works smoothly with Android.

kotlin = "1.9.20" ksp = "1.9.20-1.0.14"

neetopia commented 10 months ago

offending commit seems to be d1e080fa4a4cfb271ef7680b87f0dcc253f6e153, however this does not look to be a KMP specific commit, my guess is this commit exposed some underlying issues.

GuilhE commented 10 months ago

offending commit seems to be d1e080f, however this does not look to be a KMP specific commit, my guess is this commit exposed some underlying issues.

Will it be available as 1.0.15 version? Any ETA? Thanks 🙏🏼

neetopia commented 10 months ago

it is expected to be shipped next week

GuilhE commented 9 months ago

Any estimation?

bitspittle commented 9 months ago

https://github.com/google/ksp/releases/tag/1.9.21-1.0.15 was released a few hours ago and I can confirm that it's working for me.

GuilhE commented 9 months ago

I confirm too 👍🏼

jschneider commented 9 months ago

I still have the issue. But the error message changed slightly:

e: java.lang.AssertionError: Rewrite at slice LEXICAL_SCOPE key: ANNOTATION_ENTRY old value: org.jetbrains.kotlin.resolve.scopes.LexicalScope$Base@7537dc33@1966595123 new value: org.jetbrains.kotlin.resolve.scopes.LexicalScope$Base@1af47f86@452231046
<File name: MeisterCharts.kt, Physical: true>
/**
 * Creates the [BarChartStacked] as a child of [element].
 * @see [createBarChartStacked]h
 */
<ELEMENT>@JsExport</ELEMENT>
@JsName("createBarChartStackedFromElement")
@Suppress("unused")
fun createBarChartStackedFromElement(
  element: Element
): BarChartStacked {
  val barChartStacked = createBarChartStacked()
  element.appendChild(barChartStacked.holder)
  return barChartStacked
}
        at org.jetbrains.kotlin.com.intellij.openapi.diagnostic.DefaultLogger.error(DefaultLogger.java:54)
        at org.jetbrains.kotlin.com.intellij.openapi.diagnostic.Logger.error(Logger.java:182)
        at org.jetbrains.kotlin.util.slicedMap.Slices.logErrorAboutRewritingNonEqualObjects(Slices.java:158)
        at org.jetbrains.kotlin.util.slicedMap.Slices.access$000(Slices.java:30)
        at org.jetbrains.kotlin.util.slicedMap.Slices$1.processRewrite(Slices.java:42)
        at org.jetbrains.kotlin.util.slicedMap.SlicedMapImpl.put(SlicedMapImpl.java:65)
        at org.jetbrains.kotlin.resolve.BindingTraceContext.record(BindingTraceContext.java:150)
        at org.jetbrains.kotlin.storage.LockBasedLazyResolveStorageManager$LockProtectedTrace$record$1.invoke(LockBasedLazyResolveStorageManager.kt:70)
        at org.jetbrains.kotlin.storage.LockBasedLazyResolveStorageManager$LockProtectedTrace$record$1.invoke(LockBasedLazyResolveStorageManager.kt:70)
        at org.jetbrains.kotlin.storage.LockBasedStorageManager.compute(LockBasedStorageManager.java:290)
        at org.jetbrains.kotlin.storage.LockBasedLazyResolveStorageManager$LockProtectedTrace.record(LockBasedLazyResolveStorageManager.kt:70)
        at org.jetbrains.kotlin.resolve.calls.CallResolver.resolveCallForConstructor(CallResolver.java:380)
        at org.jetbrains.kotlin.resolve.calls.CallResolver.resolveFunctionCall(CallResolver.java:334)
        at org.jetbrains.kotlin.resolve.calls.CallResolver.resolveFunctionCall(CallResolver.java:303)
        at org.jetbrains.kotlin.resolve.AnnotationResolverImpl.resolveAnnotationCall(AnnotationResolverImpl.java:167)
        at org.jetbrains.kotlin.resolve.lazy.descriptors.LazyAnnotationDescriptor$valueArgumentsWithSourceInfo$2.invoke(LazyAnnotations.kt:107)
        at org.jetbrains.kotlin.resolve.lazy.descriptors.LazyAnnotationDescriptor$valueArgumentsWithSourceInfo$2.invoke(LazyAnnotations.kt:106)
        at org.jetbrains.kotlin.storage.LockBasedStorageManager$LockBasedLazyValue.invoke(LockBasedStorageManager.java:408)
        at org.jetbrains.kotlin.storage.LockBasedStorageManager$LockBasedNotNullLazyValue.invoke(LockBasedStorageManager.java:527)
        at org.jetbrains.kotlin.storage.StorageKt.getValue(storage.kt:42)
        at org.jetbrains.kotlin.resolve.lazy.descriptors.LazyAnnotationDescriptor.getValueArgumentsWithSourceInfo(LazyAnnotations.kt:106)
        at org.jetbrains.kotlin.resolve.lazy.descriptors.LazyAnnotationDescriptor.access$getValueArgumentsWithSourceInfo(LazyAnnotations.kt:76)
        at org.jetbrains.kotlin.resolve.lazy.descriptors.LazyAnnotationDescriptor$allValueArguments$2.invoke(LazyAnnotations.kt:121)
        at org.jetbrains.kotlin.resolve.lazy.descriptors.LazyAnnotationDescriptor$allValueArguments$2.invoke(LazyAnnotations.kt:120)
        at org.jetbrains.kotlin.storage.LockBasedStorageManager$LockBasedLazyValue.invoke(LockBasedStorageManager.java:408)
        at org.jetbrains.kotlin.storage.LockBasedStorageManager$LockBasedNotNullLazyValue.invoke(LockBasedStorageManager.java:527)
        at org.jetbrains.kotlin.storage.StorageKt.getValue(storage.kt:42)
        at org.jetbrains.kotlin.resolve.lazy.descriptors.LazyAnnotationDescriptor.getAllValueArguments(LazyAnnotations.kt:120)
        at org.jetbrains.kotlin.resolve.lazy.descriptors.LazyAnnotationDescriptor.forceResolveAllContents(LazyAnnotations.kt:138)
        at org.jetbrains.kotlin.resolve.lazy.ForceResolveUtil.doForceResolveAllContents(ForceResolveUtil.java:78)
        at org.jetbrains.kotlin.resolve.lazy.ForceResolveUtil.forceResolveAllContents(ForceResolveUtil.java:69)
        at org.jetbrains.kotlin.resolve.lazy.ForceResolveUtil.doForceResolveAllContents(ForceResolveUtil.java:97)
        at org.jetbrains.kotlin.resolve.lazy.ForceResolveUtil.forceResolveAllContents(ForceResolveUtil.java:42)
        at com.google.devtools.ksp.processing.impl.ResolverImpl.resolveDeclarationForLocal(ResolverImpl.kt:834)
        at com.google.devtools.ksp.processing.impl.ResolverImpl.resolveDeclaration(ResolverImpl.kt:494)
        at com.google.devtools.ksp.symbol.impl.kotlin.KSPropertyDeclarationImpl$propertyDescriptor$2.invoke(KSPropertyDeclarationImpl.kt:45)
        at com.google.devtools.ksp.symbol.impl.kotlin.KSPropertyDeclarationImpl$propertyDescriptor$2.invoke(KSPropertyDeclarationImpl.kt:44)
        at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
        at com.google.devtools.ksp.symbol.impl.kotlin.KSPropertyDeclarationImpl.getPropertyDescriptor(KSPropertyDeclarationImpl.kt:44)
        at com.google.devtools.ksp.symbol.impl.kotlin.KSPropertyDeclarationImpl.access$getPropertyDescriptor(KSPropertyDeclarationImpl.kt:36)
        at com.google.devtools.ksp.symbol.impl.kotlin.KSPropertyDeclarationImpl$type$2$1.invoke(KSPropertyDeclarationImpl.kt:98)
        at com.google.devtools.ksp.symbol.impl.kotlin.KSPropertyDeclarationImpl$type$2$1.invoke(KSPropertyDeclarationImpl.kt:97)
        at com.google.devtools.ksp.symbol.impl.kotlin.KSTypeReferenceDeferredImpl$resolved$2.invoke(KSTypeReferenceDeferredImpl.kt:57)
        at com.google.devtools.ksp.symbol.impl.kotlin.KSTypeReferenceDeferredImpl$resolved$2.invoke(KSTypeReferenceDeferredImpl.kt:56)
        at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
        at com.google.devtools.ksp.symbol.impl.kotlin.KSTypeReferenceDeferredImpl.getResolved(KSTypeReferenceDeferredImpl.kt:56)
        at com.google.devtools.ksp.symbol.impl.kotlin.KSTypeReferenceDeferredImpl.toString(KSTypeReferenceDeferredImpl.kt:67)
        at java.base/java.lang.String.valueOf(String.java:4225)
        at java.base/java.lang.StringBuilder.append(StringBuilder.java:173)
        at it.neckar.ksp.ts.LoggerVisitor.visitTypeReference(LoggerVisitor.kt:156)
        at it.neckar.ksp.ts.LoggerVisitor.visitTypeReference(LoggerVisitor.kt:34)
        at com.google.devtools.ksp.symbol.impl.kotlin.KSTypeReferenceDeferredImpl.accept(KSTypeReferenceDeferredImpl.kt:63)
        at com.google.devtools.ksp.visitor.KSTopDownVisitor.accept(KSTopDownVisitor.kt:34)
        at com.google.devtools.ksp.visitor.KSTopDownVisitor.visitPropertyDeclaration(KSTopDownVisitor.kt:37)
        at it.neckar.ksp.ts.LoggerVisitor.visitPropertyDeclaration(LoggerVisitor.kt:52)
        at it.neckar.ksp.ts.LoggerVisitor.visitPropertyDeclaration(LoggerVisitor.kt:34)
        at com.google.devtools.ksp.symbol.impl.kotlin.KSPropertyDeclarationImpl.accept(KSPropertyDeclarationImpl.kt:115)
        at com.google.devtools.ksp.visitor.KSTopDownVisitor.accept(KSTopDownVisitor.kt:28)
        at com.google.devtools.ksp.visitor.KSTopDownVisitor.visitDeclarationContainer(KSTopDownVisitor.kt:60)
        at it.neckar.ksp.ts.LoggerVisitor.visitDeclarationContainer(LoggerVisitor.kt:92)
        at it.neckar.ksp.ts.LoggerVisitor.visitDeclarationContainer(LoggerVisitor.kt:34)
        at com.google.devtools.ksp.visitor.KSDefaultVisitor.visitFunctionDeclaration(KSDefaultVisitor.kt:38)
        at com.google.devtools.ksp.visitor.KSTopDownVisitor.visitFunctionDeclaration(KSTopDownVisitor.kt:74)
        at it.neckar.ksp.ts.LoggerVisitor.visitFunctionDeclaration(LoggerVisitor.kt:107)
        at it.neckar.ksp.ts.LoggerVisitor.visitFunctionDeclaration(LoggerVisitor.kt:34)
        at com.google.devtools.ksp.symbol.impl.kotlin.KSFunctionDeclarationImpl.accept(KSFunctionDeclarationImpl.kt:118)
        at it.neckar.ksp.ts.TypeScriptGeneratorProcessor.process(TypeScriptGeneratorProcessor.kt:66)
        at com.google.devtools.ksp.AbstractKotlinSymbolProcessingExtension$doAnalysis$8$1.invoke(KotlinSymbolProcessingExtension.kt:306)
        at com.google.devtools.ksp.AbstractKotlinSymbolProcessingExtension$doAnalysis$8$1.invoke(KotlinSymbolProcessingExtension.kt:304)
        at com.google.devtools.ksp.AbstractKotlinSymbolProcessingExtension.handleException(KotlinSymbolProcessingExtension.kt:410)
        at com.google.devtools.ksp.AbstractKotlinSymbolProcessingExtension.doAnalysis(KotlinSymbolProcessingExtension.kt:304)
        at org.jetbrains.kotlin.js.analyze.AbstractTopDownAnalyzerFacadeForWeb.analyzeFilesWithGivenTrace(TopDownAnalyzerFacadeForJS.kt:142)
        at org.jetbrains.kotlin.js.analyze.AbstractTopDownAnalyzerFacadeForWeb.analyzeFiles(TopDownAnalyzerFacadeForJS.kt:94)
        at org.jetbrains.kotlin.ir.backend.js.ModulesStructure$runAnalysis$1.invoke(klib.kt:534)
        at org.jetbrains.kotlin.ir.backend.js.ModulesStructure$runAnalysis$1.invoke(klib.kt:533)
        at org.jetbrains.kotlin.cli.common.messages.AnalyzerWithCompilerReport.analyzeAndReport(AnalyzerWithCompilerReport.kt:115)
        at org.jetbrains.kotlin.ir.backend.js.ModulesStructure.runAnalysis(klib.kt:533)
        at org.jetbrains.kotlin.ir.backend.js.PrepareAnalyzedSourceModuleKt.prepareAnalyzedSourceModule(prepareAnalyzedSourceModule.kt:30)
        at org.jetbrains.kotlin.ir.backend.js.PrepareAnalyzedSourceModuleKt.prepareAnalyzedSourceModule$default(prepareAnalyzedSourceModule.kt:17)
        at org.jetbrains.kotlin.cli.js.K2JsIrCompiler.processSourceModule(K2JsIrCompiler.kt:427)
        at org.jetbrains.kotlin.cli.js.K2JsIrCompiler.doExecute(K2JsIrCompiler.kt:273)
        at org.jetbrains.kotlin.cli.js.K2JSCompiler.doExecute(K2JSCompiler.java:181)
        at org.jetbrains.kotlin.cli.js.K2JSCompiler.doExecute(K2JSCompiler.java:72)
        at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:104)
        at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:48)
        at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:101)
        at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:1523)
        at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
        at java.base/java.lang.reflect.Method.invoke(Method.java:578)
        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:598)
        at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:844)
        at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:721)
        at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
        at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:720)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
        at java.base/java.lang.Thread.run(Thread.java:1589)

Everything builds fine with 1.9.20-1.0.13