-
Notifications
You must be signed in to change notification settings - Fork 61
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
Misleading error message "field must be final" when actually requiring a property to be declared val #237
Comments
Declaring atomic variable properties is not supported. This way you can declare a variable delegated to the atomic property:
|
Moreover when the atomic variable is declared, the compiler JVM IR plugin fails with an error below. It should also provide a more meaningful message.
|
A lot of updates for JVM transformation performed by the compiler plugin are coming in 1.9.20 (see #322), including the fix for this diagnostic.
Unfortunately, no fix is provided for the legacy bytecode transformer so far. Please consider using the compiler plugin for the JVM transformation, check out this section of the documentation to learn how it can be enabled: https://github.com/Kotlin/kotlinx-atomicfu#atomicfu-compiler-plugin |
… values. Fixes Kotlin/kotlinx-atomicfu#237 Part of these changes: KT-60528
… values. Fixes Kotlin/kotlinx-atomicfu#237 Part of these changes: KT-60528
… values. Fixes: Kotlin/kotlinx-atomicfu#237 YT: KT-61550 Merge-request: KT-MR-11886 Merged-by: Maria Sokolova <[email protected]>
… values. Fixes: Kotlin/kotlinx-atomicfu#237 YT: KT-61550 Merge-request: KT-MR-11887 Merged-by: Maria Sokolova <[email protected]>
Compile this for the JVM target:
The following error message will appear:
This is misleading. As the docs on properties state:
A better wording would be
Relevant source:
https://github.com/Kotlin/kotlinx.atomicfu/blob/450b056efa4c8e4f922f2a3f8d1958404513b1f7/atomicfu-transformer/src/main/kotlin/kotlinx/atomicfu/transformer/AtomicFUTransformer.kt#L318
Also affected:
https://github.com/Kotlin/kotlinx.atomicfu/blob/450b056efa4c8e4f922f2a3f8d1958404513b1f7/atomicfu-transformer/src/main/kotlin/kotlinx/atomicfu/transformer/AtomicFUTransformer.kt#L316-L317
https://github.com/Kotlin/kotlinx.atomicfu/blob/450b056efa4c8e4f922f2a3f8d1958404513b1f7/atomicfu-transformer/src/main/kotlin/kotlinx/atomicfu/transformer/AtomicFUTransformer.kt#L795
https://github.com/Kotlin/kotlinx.atomicfu/blob/450b056efa4c8e4f922f2a3f8d1958404513b1f7/atomicfu-transformer/src/main/kotlin/kotlinx/atomicfu/transformer/AtomicFUTransformer.kt#L1064
https://github.com/Kotlin/kotlinx.atomicfu/blob/450b056efa4c8e4f922f2a3f8d1958404513b1f7/atomicfu-transformer/src/main/kotlin/kotlinx/atomicfu/transformer/AtomicFUTransformer.kt#L1402
The text was updated successfully, but these errors were encountered: