drewhamilton / Poko

A Kotlin compiler plugin that generates equals, hashCode, and toString for plain old Kotlin objects in public APIs.
Apache License 2.0
318 stars 10 forks source link

Kotlin 2.0.20 support #363

Closed JakeWharton closed 1 month ago

JakeWharton commented 3 months ago

Seems broken with 2.0.20-Beta1:

e: java.lang.NoSuchMethodError: 'void org.jetbrains.kotlin.ir.symbols.impl.IrValueParameterSymbolImpl.<init>(org.jetbrains.kotlin.descriptors.ParameterDescriptor)'
    at dev.drewhamilton.poko.ir.PokoMembersTransformer.mutateWithNewDispatchReceiverParameterForParentClass(PokoMembersTransformer.kt:158)
    at dev.drewhamilton.poko.ir.PokoMembersTransformer.visitFunctionNew(PokoMembersTransformer.kt:204)
    at org.jetbrains.kotlin.backend.common.IrElementTransformerVoidWithContext.visitFunction(IrElementTransformerVoidWithContext.kt:83)
    at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitSimpleFunction(IrElementTransformerVoid.kt:128)
    at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitSimpleFunction(IrElementTransformerVoid.kt:131)
    at org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid.visitSimpleFunction(IrElementTransformerVoid.kt:19)
    at org.jetbrains.kotlin.ir.declarations.IrSimpleFunction.accept(IrSimpleFunction.kt:36)
    at org.jetbrains.kotlin.ir.IrElementBase.transform(IrElementBase.kt:24)
drewhamilton commented 3 months ago

I'll open a draft PR. Do you need Poko beta versions tracking the Kotlin beta versions? And/or snapshots?

JakeWharton commented 3 months ago

Eh, I mean not really. I/we are supposed to be testing the EAP versions since we (Cash) are part of the EAP champions. I would be fine with snapshots, especially if we can do it in a way that can be landed on main, such as through reflection. Needing to publish separately solely for the betas almost seems like too much work.

drewhamilton commented 3 months ago

Reopening because #364 is still failing 🤔

drewhamilton commented 3 months ago

Caused by: java.lang.NoSuchMethodError: 'void org.jetbrains.kotlin.gradle.targets.js.ir.DefaultIncrementalSyncTask.setDuplicatesStrategy(org.gradle.api.file.DuplicatesStrategy)'

Seems like maybe a compiler bug because this line calls setDuplicatesStrategy on the CopySpec interface? Curious whether this affects Redwood or Mosaic using the SNAPSHOT, or whether it's specific to the sample.

JakeWharton commented 3 months ago

Is the snapshot updated? I can try it out.

JakeWharton commented 3 months ago

🟢 https://github.com/JakeWharton/mosaic/pull/404

JakeWharton commented 3 months ago

Redwood seems good, too, but still red with other problems

lupuuss commented 2 months ago

Kotlin 2.0.20-Beta2 introduces more breaking changes.

java.lang.NoSuchMethodError: 'void org.jetbrains.kotlin.ir.declarations.impl.IrVariableImpl.<init>(int, int, org.jetbrains.kotlin.ir.declarations.IrDeclarationOrigin, org.jetbrains.kotlin.ir.symbols.IrVariableSymbol, org.jetbrains.kotlin.name.Name, org.jetbrains.kotlin.ir.types.IrType, boolean, boolean, boolean)'
    at dev.drewhamilton.poko.ir.HashCodeGenerationKt.generateHashCodeMethodBody(hashCodeGeneration.kt:75)
    at dev.drewhamilton.poko.ir.PokoMembersTransformer.visitFunctionNew(PokoMembersTransformer.kt:54)
drewhamilton commented 2 months ago

@lupuuss Thanks, fixed in the latest snapshot

JakeWharton commented 1 month ago

Released as 0.17