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

Exception while analyzing expression useEffect from kotlin-react #2327

Closed
goncalossilva opened this issue Jan 25, 2022 · 4 comments
Closed
Labels
Milestone

Comments

@goncalossilva
Copy link

Describe the bug
When running Dokka tasks on a Kotlin/JS codebase using kotlin-react's useEffect, it fails with multiple exceptions like:

ERROR: Exception while analyzing expression at (22,5) in /Users/goncalossilva/Code/Doist/ffs/ffs-dashboard/src/main/kotlin/components/Landing.kt

Attachments:
expression.kt
useEffect {
    (...)
}
...
Caused by: java.lang.IllegalStateException: Illegal use of flexible type deserializer.

Expected behaviour
It should not fail.

To Reproduce

git clone git@github.com:Doist/ffs.git && cd ffs
./gradlew :ffs-dashboard:dokkaHtml # or any other

Dokka configuration
There's not much to it:

// Apply and configure dokka in all subprojects.
apply(plugin = libs.plugins.dokka.get().pluginId)
tasks.withType<DokkaTaskPartial>().configureEach {
    moduleName.set(project.name.removePrefix("ffs-").replace('-', ' ').capitalize())
    dokkaSourceSets {
        configureEach {
            sourceLink {
                localDirectory.set(rootDir)
                remoteUrl.set(java.net.URL("https://github.com/Doist/ffs/blob/main"))
                remoteLineSuffix.set("#L")
            }
        }
    }
}

Installation

  • Operating system: any
  • Build tool: Gradle v7.3.3
  • Dokka version: 1.6.10
@goncalossilva
Copy link
Author

I'm unsure if it's relevant, but useEffect's implementation is:

/**
 * Only works inside [fc]
 * @see <a href="https://reactjs.org/docs/hooks-state.html#hooks-and-function-components">Hooks and Function Components</a>
 */
fun useEffect(
    vararg dependencies: dynamic,
    effect: EffectBuilder.() -> Unit,
) {
    val callback = createEffectCallback(effect)
    rawUseEffect(callback, dependencies)
}

@vmishenev
Copy link
Member

vmishenev commented Aug 26, 2022

@goncalossilva Is this still actual?
I can't reproduce it due to

> Task :ffs-shared:env:compileKotlinJs
e: java.lang.NoClassDefFoundError: org/jetbrains/kotlin/ir/declarations/IrFileKt
        at com.bnorm.power.PowerAssertIrGenerationExtension.generate(PowerAssertIrGenerationExtension.kt:33)
        at org.jetbrains.kotlin.ir.backend.js.KlibKt.generateModuleFragmentWithPlugins$lambda-20(klib.kt:538)
        at org.jetbrains.kotlin.psi2ir.Psi2IrTranslator.generateModuleFragment(Psi2IrTranslator.kt:99)
        at org.jetbrains.kotlin.psi2ir.Psi2IrTranslator.generateModuleFragment$default(Psi2IrTranslator.kt:75)
        at org.jetbrains.kotlin.ir.backend.js.KlibKt.generateModuleFragmentWithPlugins(klib.kt:543)
        at org.jetbrains.kotlin.ir.backend.js.KlibKt.generateIrForKlibSerialization(klib.kt:173)
        at org.jetbrains.kotlin.ir.backend.js.KlibKt.generateKLib(klib.kt:208)
        at org.jetbrains.kotlin.ir.backend.js.KlibKt.generateKLib$default(klib.kt:190)
        at org.jetbrains.kotlin.cli.js.K2JsIrCompiler.doExecute(K2JsIrCompiler.kt:281)
        at org.jetbrains.kotlin.cli.js.K2JSCompiler.doExecute(K2JSCompiler.java:183)
        at org.jetbrains.kotlin.cli.js.K2JSCompiler.doExecute(K2JSCompiler.java:72)
        at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:94)
        at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:43)
        at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:101)
        at org.jetbrains.kotlin.incremental.IncrementalJsCompilerRunner.runCompiler(IncrementalJsCompilerRunner.kt:208)
        at org.jetbrains.kotlin.incremental.IncrementalJsCompilerRunner.runCompiler(IncrementalJsCompilerRunner.kt:83)
        at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compileIncrementally(IncrementalCompilerRunner.kt:366)
        at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compileIncrementally$default(IncrementalCompilerRunner.kt:311)
        at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.rebuild(IncrementalCompilerRunner.kt:110)
        at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compileImpl(IncrementalCompilerRunner.kt:200)
        at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compile(IncrementalCompilerRunner.kt:75)
        at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compile$default(IncrementalCompilerRunner.kt:65)
        at org.jetbrains.kotlin.daemon.CompileServiceImplBase.execJsIncrementalCompiler(CompileServiceImpl.kt:566)
        at org.jetbrains.kotlin.daemon.CompileServiceImplBase.access$execJsIncrementalCompiler(CompileServiceImpl.kt:101)
        at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:1830)
        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)
Caused by: java.lang.ClassNotFoundException: org.jetbrains.kotlin.ir.declarations.IrFileKt
        at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:440)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:587)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
        ... 42 more

@goncalossilva
Copy link
Author

I'm no longer actively working on this project, unfortunately.

@vmishenev
Copy link
Member

vmishenev commented Aug 29, 2022

I have reproduced it on your old commit.
Now this is #2592.

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

No branches or pull requests

3 participants