Kotlin / kotlinx-atomicfu

The idiomatic way to use atomic operations in Kotlin
Other
916 stars 58 forks source link

Using atomic extensions from another module #262

Closed mvicsokolova closed 1 year ago

mvicsokolova commented 1 year ago

Currently, atomicfu compiler plugin only supports atomic extensions that can be used inside one module. E.g. an internal atomic extension declared in the main module cannot be used in test module.

internal inline fun AtomicInt.foo(block: (id: Int) -> Int) { }

The problem: Atomicfu compiler plugin generates transformed declaration for every atomic extesion in IR:

internal fun foo$atomicfu(dispatchReceiver: Any?, atomicHandler: AtomicIntegerFieldUpdater)

though compilation of the test module does not depend on the transformed IR, so this generated function can not be retrieved.

Possible solutions:

mvicsokolova commented 1 year ago

The problem of broken incremental compilation and usage of atomic extensions from another module was solved here: #322.

The fix is coming with the JVM compiler plugin in 1.9.20.