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

Incompatible with Kotlin 1.6 #50

Closed
mikehearn opened this issue Nov 17, 2021 · 6 comments · Fixed by #51
Closed

Incompatible with Kotlin 1.6 #50

mikehearn opened this issue Nov 17, 2021 · 6 comments · Fixed by #51

Comments

@mikehearn
Copy link

Seems to have been an API change?

e: java.lang.NoSuchMethodError: 'org.jetbrains.kotlin.ir.descriptors.IrBuiltIns org.jetbrains.kotlin.backend.common.extensions.IrPluginContext.getIrBuiltIns()'
        at com.bnorm.power.PowerAssertCallTransformer.isAssignableTo(PowerAssertCallTransformer.kt:206)
        at com.bnorm.power.PowerAssertCallTransformer.findDelegates(PowerAssertCallTransformer.kt:183)
        at com.bnorm.power.PowerAssertCallTransformer.visitCall(PowerAssertCallTransformer.kt:80)
        at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitCall(IrElementTransformerVoid.kt:199)
        at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitCall(IrElementTransformerVoid.kt:24)
        at org.jetbrains.kotlin.ir.expressions.impl.IrCallImpl.accept(IrCallImpl.kt:47)
        at org.jetbrains.kotlin.ir.expressions.IrExpression.transform(IrExpression.kt:33)
        at org.jetbrains.kotlin.ir.expressions.IrExpression.transform(IrExpression.kt:26)
        at org.jetbrains.kotlin.ir.expressions.IrBlockBody.transformChildren(IrBody.kt:62)
        at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitBody(IrElementTransformerVoid.kt:108)
        at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitBlockBody(IrElementTransformerVoid.kt:117)
        at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitBlockBody(IrElementTransformerVoid.kt:118)
        at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitBlockBody(IrElementTransformerVoid.kt:24)
        at org.jetbrains.kotlin.ir.expressions.IrBlockBody.accept(IrBody.kt:54)
        at org.jetbrains.kotlin.ir.expressions.IrBody.transform(IrBody.kt:27)
        at org.jetbrains.kotlin.ir.declarations.IrFunction.transformChildren(IrFunction.kt:68)
        at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitDeclaration(IrElementTransformerVoid.kt:57)
        at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitFunction(IrElementTransformerVoid.kt:69)
        at org.jetbrains.kotlin.backend.common.IrElementTransformerVoidWithContext.visitFunctionNew(IrElementTransformerVoidWithContext.kt:115)
        at org.jetbrains.kotlin.backend.common.IrElementTransformerVoidWithContext.visitFunction(IrElementTransformerVoidWithContext.kt:68)
        at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitSimpleFunction(IrElementTransformerVoid.kt:72)
        at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitSimpleFunction(IrElementTransformerVoid.kt:73)
        at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitSimpleFunction(IrElementTransformerVoid.kt:24)
        at org.jetbrains.kotlin.ir.declarations.IrSimpleFunction.accept(IrSimpleFunction.kt:28)
        at org.jetbrains.kotlin.ir.IrElement$DefaultImpls.transform(IrElement.kt:32)
        at org.jetbrains.kotlin.ir.IrElementBase.transform(IrElementBase.kt:19)
@bnorm
Copy link
Owner

bnorm commented Nov 17, 2021

Not surprising. I was hoping to check compatibility and perform any required updates in the next couple days.

@bnorm
Copy link
Owner

bnorm commented Nov 19, 2021

Just release version 0.11.0 to support Kotlin 1.6.0. Let me know if you run into any other issues.

@mikehearn
Copy link
Author

Brilliant, thanks. I use this plugin all the time and it's just so helpful - when I saw it wasn't compatible I rolled back the 1.6 upgrade. Thanks so much for your efforts. Power asserts are actually more useful than most of the new features!

@gnawf
Copy link

gnawf commented Nov 25, 2021

Just a heads up for others, it seems that version 0.11.0 of this plugin doesn't work with Kotlin 1.5.x.

You have to either upgrade to Kotlin 1.6.x or downgrade this plugin to 0.10.0

I'm getting the following stacktrace with version 0.11.0 of this plugin and Kotlin 1.5.31

java.lang.NoSuchMethodError: 'org.jetbrains.kotlin.ir.IrBuiltIns org.jetbrains.kotlin.backend.common.extensions.IrPluginContext.getIrBuiltIns()'
	at com.bnorm.power.PowerAssertCallTransformer.<init>(PowerAssertCallTransformer.kt:72)
	at com.bnorm.power.PowerAssertIrGenerationExtension.generate(PowerAssertIrGenerationExtension.kt:36)
	at org.jetbrains.kotlin.backend.jvm.JvmIrCodegenFactory.convertToIr$lambda-1(JvmIrCodegenFactory.kt:126)
	at org.jetbrains.kotlin.psi2ir.Psi2IrTranslator.generateModuleFragment(Psi2IrTranslator.kt:89)
	at org.jetbrains.kotlin.backend.jvm.JvmIrCodegenFactory.convertToIr(JvmIrCodegenFactory.kt:146)
	at org.jetbrains.kotlin.backend.jvm.JvmIrCodegenFactory.convertToIr$default(JvmIrCodegenFactory.kt:64)
	at org.jetbrains.kotlin.backend.jvm.JvmIrCodegenFactory.generateModule(JvmIrCodegenFactory.kt:59)
	at org.jetbrains.kotlin.codegen.KotlinCodegenFacade.compileCorrectFiles(KotlinCodegenFacade.java:35)
	at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.generate(KotlinToJVMBytecodeCompiler.kt:321)
	at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules$cli(KotlinToJVMBytecodeCompiler.kt:113)
	at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules$cli$default(KotlinToJVMBytecodeCompiler.kt:56)
	at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:169)
	at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:52)
	at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:92)
	at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:44)
	at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:98)
	at org.jetbrains.kotlin.incremental.IncrementalJvmCompilerRunner.runCompiler(IncrementalJvmCompilerRunner.kt:412)
	at org.jetbrains.kotlin.incremental.IncrementalJvmCompilerRunner.runCompiler(IncrementalJvmCompilerRunner.kt:112)
	at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compileIncrementally(IncrementalCompilerRunner.kt:358)
	at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compileIncrementally$default(IncrementalCompilerRunner.kt:300)
	at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compileImpl$rebuild(IncrementalCompilerRunner.kt:119)
	at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compileImpl(IncrementalCompilerRunner.kt:170)
	at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compile(IncrementalCompilerRunner.kt:81)
	at org.jetbrains.kotlin.daemon.CompileServiceImplBase.execIncrementalCompiler(CompileServiceImpl.kt:607)
	at org.jetbrains.kotlin.daemon.CompileServiceImplBase.access$execIncrementalCompiler(CompileServiceImpl.kt:96)
	at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:1658)
	at jdk.internal.reflect.GeneratedMethodAccessor105.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:359)
	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(Native Method)
	at java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196)
	at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:562)
	at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:796)
	at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:677)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:676)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:829)

@TWiStErRob
Copy link
Contributor

Yes, @gnawf, this is mostly expected, because the compiler APIs are not stable, they keep changing it version to version. To have each version support a range of Kotlin versions, this plugin would require some, not impossible but hard, work.

@bnorm have you thought about creating a compatibility table? Like the first 5 rows of https://developer.android.com/studio/releases/gradle-plugin#updating-gradle

@bnorm
Copy link
Owner

bnorm commented Nov 26, 2021

Good idea @TWiStErRob, added this: https://github.com/bnorm/kotlin-power-assert#compatibility

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

Successfully merging a pull request may close this issue.

4 participants