kotlin-power-assert icon indicating copy to clipboard operation
kotlin-power-assert copied to clipboard

[Kotlin 2.0.0-Beta2] - NoClassDefFoundError

Open sureshg opened this issue 1 year ago • 1 comments

I understand that the plugin doesn't support Kotlin 2.x officially, but things have been working fine until 2.0.0-Beta1 and it throws the following error with the latest update. I am creating this issue to just bring attention to the project maintainer... Feel free to close this if it's not the right channel to bring this issue. Thanks for all the work.

> Task :common:compileTestKotlinJs FAILED
e: java.lang.NoClassDefFoundError: org/jetbrains/kotlin/ir/expressions/IrStatementOrigin$NOT_IN
        at com.bnorm.power.diagram.ExpressionTreeKt$buildTree$1.visitCall(ExpressionTree.kt:117)
        at com.bnorm.power.diagram.ExpressionTreeKt$buildTree$1.visitCall(ExpressionTree.kt:79)
        at org.jetbrains.kotlin.ir.expressions.IrCall.accept(IrCall.kt:26)
        at com.bnorm.power.diagram.ExpressionTreeKt.buildTree(ExpressionTree.kt:78)
        at com.bnorm.power.PowerAssertCallTransformer.visitCall(PowerAssertCallTransformer.kt:118)
        at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitCall(IrElementTransformerVoid.kt:299)
        at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitCall(IrElementTransformerVoid.kt:19)
        at org.jetbrains.kotlin.ir.expressions.IrCall.accept(IrCall.kt:26)
        at org.jetbrains.kotlin.ir.expressions.IrExpression.transform(IrExpression.kt:30)
        at org.jetbrains.kotlin.ir.expressions.IrExpression.transform(IrExpression.kt:22)

sureshg avatar Dec 20 '23 18:12 sureshg

Thanks for the report! Looks like the object IrStatementOrigin.NOT_IN changed to a property in 2.0.0 so I cannot use origin is IrStatementOrigin.NOT_IN anymore, but will need to do an equality check. Might be something I can fix now so it is supported automatically in 2.0.0, but I doubt I will get so lucky in general with 2.0.0, so I will probably just fix it then.

bnorm avatar Jan 04 '24 15:01 bnorm

As of Kotlin 2.0.0-Beta5, this compiler plugin now ships with Kotlin! I will be releasing one more version which will be some kind of transition version. I'm not sure yet how it will work, it could add the built-in Kotlin compiler plugin or fail the build with an error message to upgrade, but I want some kind of upgrade path for those that use automation like Renovate.

import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi

plugins {
    kotlin("jvm") version "2.0.0-Beta5"
    kotlin("plugin.power-assert") version "2.0.0-Beta5"
}

@OptIn(ExperimentalKotlinGradlePluginApi::class)
powerAssert {
    functions = listOf("kotlin.assert", "kotlin.test.assertTrue")
    excludedSourceSets = listOf("main")
}

bnorm avatar Mar 22 '24 21:03 bnorm

@bnorm thanks for bundling this awesome plugin with Kotlin...this is working fine in 2.0.0-Beta5.

sureshg avatar Mar 23 '24 17:03 sureshg