The idiomatic way to use atomic operations in Kotlin

Overview

AtomicFU

JetBrains incubator project GitHub license Download

The idiomatic way to use atomic operations in Kotlin.

Example

Let us declare a top variable for a lock-free stack implementation:

import kotlinx.atomicfu.* // import top-level functions from kotlinx.atomicfu

private val top = atomic<Node?>(null) 

Use top.value to perform volatile reads and writes:

fun isEmpty() = top.value == null  // volatile read
fun clear() { top.value = null }   // volatile write

Use compareAndSet function directly:

if (top.compareAndSet(expect, update)) ... 

Use higher-level looping primitives (inline extensions), for example:

top.loop { cur ->   // while(true) loop that volatile-reads current value 
   ...
}

Use high-level update, updateAndGet, and getAndUpdate, when possible, for idiomatic lock-free code, for example:

fun push(v: Value) = top.update { cur -> Node(v, cur) }
fun pop(): Value? = top.getAndUpdate { cur -> cur?.next } ?.value

Declare atomic integers and longs using type inference:

val myInt = atomic(0)    // note: integer initial value
val myLong = atomic(0L)  // note: long initial value   

Integer and long atomics provide all the usual getAndIncrement, incrementAndGet, getAndAdd, addAndGet, and etc operations. They can be also atomically modified via += and -= operators.

Dos and Don'ts

  • Declare atomic variables as private val or internal val. You can use just (public) val, but make sure they are not directly accessed outside of your Kotlin module (outside of the source set). Access to the atomic variable itself shall be encapsulated.
  • Only simple operations on atomic variables directly are supported.
    • Do not read references on atomic variables into local variables, e.g. top.compareAndSet(...) is Ok, while val tmp = top; tmp... is not.
    • Do not leak references on atomic variables in other way (return, pass as params, etc).
  • Do not introduce complex data flow in parameters to atomic variable operations, i.e. top.value = complex_expression and top.compareAndSet(cur, complex_expression) are not supported (more specifically, complex_expression should not have branches in its compiled representation). Extract complex_expression into a variable when needed.
  • Use the following convention if you need to expose the value of atomic property to the public:
private val _foo = atomic<T>(initial) // private atomic, convention is to name it with leading underscore
public var foo: T by _foo            // public delegated property (val/var)

Gradle build setup

Building with Gradle is supported for all platforms.

JVM

You will need Gradle 4.10 or later. Add and apply AtomicFU plugin. It adds all the corresponding dependencies and transformations automatically. See additional configuration if that needs tweaking.

buildscript {
    ext.atomicfu_version = '0.17.0'

    dependencies {
        classpath "org.jetbrains.kotlinx:atomicfu-gradle-plugin:$atomicfu_version"
    }
}

apply plugin: 'kotlinx-atomicfu'

JS

Configure add apply plugin just like for JVM.

Native

This library is available for Kotlin/Native (atomicfu-native). Kotlin/Native uses Gradle metadata and needs Gradle version 5.3 or later. See Gradle Metadata 1.0 announcement for more details. Apply the corresponding plugin just like for JVM.

Atomic references for Kotlin/Native are based on FreezableAtomicReference and every reference that is stored to the previously frozen (shared with another thread) atomic is automatically frozen, too.

Since Kotlin/Native does not generally provide binary compatibility between versions, you should use the same version of Kotlin compiler as was used to build AtomicFU. See gradle.properties in AtomicFU project for its kotlin_version.

Common

If you write a common code that should get compiled or different platforms, add org.jetbrains.kotlinx:atomicfu to your common code dependencies or apply kotlinx-atomicfu plugin that adds this dependency automatically:

dependencies {
    compile "org.jetbrains.kotlinx:atomicfu-common:$atomicfu_version"
}

Additional configuration

There are the following additional parameters (with their defaults):

atomicfu {
  dependenciesVersion = '0.17.0' // set to null to turn-off auto dependencies
  transformJvm = true // set to false to turn off JVM transformation
  transformJs = true // set to false to turn off JS transformation
  variant = "FU" // JVM transformation variant: FU,VH, or BOTH 
  verbose = false // set to true to be more verbose  
}

Maven build setup

Declare AtomicFU version:

<properties>
     <atomicfu.version>0.17.0</atomicfu.version>
</properties> 

Declare provided dependency on the AtomicFU library (the users of the resulting artifact will not have a dependency on AtomicFU library):

<dependencies>
    <dependency>
        <groupId>org.jetbrains.kotlinx</groupId>
        <artifactId>atomicfu</artifactId>
        <version>${atomicfu.version}</version>
        <scope>provided</scope>
    </dependency>
</dependencies>

Configure build steps so that Kotlin compiler puts classes into a different classes-pre-atomicfu directory, which is then transformed to a regular classes directory to be used later by tests and delivery.

<build>
    <plugins>
        <!-- compile Kotlin files to staging directory -->
        <plugin>
            <groupId>org.jetbrains.kotlin</groupId>
            <artifactId>kotlin-maven-plugin</artifactId>
            <version>${kotlin.version}</version>
            <executions>
                <execution>
                    <id>compile</id>
                    <phase>compile</phase>
                    <goals>
                        <goal>compile</goal>
                    </goals>
                    <configuration>
                        <output>${project.build.directory}/classes-pre-atomicfu</output>
                    </configuration>
                </execution>
            </executions>
        </plugin>
        <!-- transform classes with AtomicFU plugin -->
        <plugin>
            <groupId>org.jetbrains.kotlinx</groupId>
            <artifactId>atomicfu-maven-plugin</artifactId>
            <version>${atomicfu.version}</version>
            <executions>
                <execution>
                    <goals>
                        <goal>transform</goal>
                    </goals>
                    <configuration>
                        <input>${project.build.directory}/classes-pre-atomicfu</input>
                        <!-- "VH" to use Java 9 VarHandle, "BOTH" to produce multi-version code -->
                        <variant>FU</variant>  
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

Additional features

AtomicFU provides some additional features that you can optionally use.

VarHandles with Java 9

AtomicFU can produce code that uses Java 9 VarHandle instead of AtomicXxxFieldUpdater. Configure transformation variant in Gradle build file:

atomicfu {
    variant = "VH"
}

It can also create JEP 238 multi-release jar file with both AtomicXxxFieldUpdater for JDK<=8 and VarHandle for for JDK9+ if you set variant to "BOTH".

Arrays of atomic values

You can declare arrays of all supported atomic value types. By default arrays are transformed into the corresponding java.util.concurrent.atomic.Atomic*Array instances.

If you configure variant = "VH" an array will be transformed to plain array using VarHandle to support atomic operations.

val a = atomicArrayOfNulls<T>(size) // similar to Array constructor

val x = a[i].value // read value
a[i].value = x // set value
a[i].compareAndSet(expect, update) // do atomic operations

User-defined extensions on atomics

You can define you own extension functions on AtomicXxx types but they must be inline and they cannot be public and be used outside of the module they are defined in. For example:

@Suppress("NOTHING_TO_INLINE")
private inline fun AtomicBoolean.tryAcquire(): Boolean = compareAndSet(false, true)

Locks

This project includes kotlinx.atomicfu.locks package providing multiplatform locking primitives that require no additional runtime dependencies on Kotlin/JVM and Kotlin/JS with a library implementation for Kotlin/Native.

  • SynchronizedObject is designed for inheritance. You write class MyClass : SynchronizedObject() and then use synchronized(instance) { ... } extension function similarly to the synchronized function from the standard library that is available for JVM. The SynchronizedObject superclass gets erased (transformed to Any) on JVM and JS, with synchronized leaving no trace in the code on JS and getting replaced with built-in monitors for locking on JVM.

  • ReentrantLock is designed for delegation. You write val lock = reentrantLock() to construct its instance and use lock/tryLock/unlock functions or lock.withLock { ... } extension function similarly to the way jucl.ReentrantLock is used on JVM. On JVM it is a typealias to the later class, erased on JS.

Condition variables (notify/wait and signal/await) are not supported.

Testing lock-free data structures on JVM

You can optionally test lock-freedomness of lock-free data structures using LockFreedomTestEnvironment class. See example in LockFreeQueueLFTest. Testing is performed by pausing one (random) thread before or after a random state-update operation and making sure that all other threads can still make progress.

In order to make those test to actually perform lock-freedomness testing you need to configure an additional execution of tests with the original (non-transformed) classes for Maven:

<build>
    <plugins>
        <!-- additional test execution with surefire on non-transformed files -->
        <plugin>
            <artifactId>maven-surefire-plugin</artifactId>
            <executions>
                <execution>
                    <id>lockfree-test</id>
                    <phase>test</phase>
                    <goals>
                        <goal>test</goal>
                    </goals>
                    <configuration>
                        <classesDirectory>${project.build.directory}/classes-pre-atomicfu</classesDirectory>
                        <includes>
                            <include>**/*LFTest.*</include>
                        </includes>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

For Gradle there is nothing else to add. Tests are always run using original (non-transformed) classes.

Tracing operations

You can debug your tests tracing atomic operations with a special trace object:

private val trace = Trace()
private val current = atomic(0, trace)

fun update(x: Int): Int {           
    // custom trace message
    trace { "calling update($x)" }
    // automatic tracing of modification operations 
    return current.getAndAdd(x)
}

All trace messages are stored in a cyclic array inside trace.

You can optionally set the size of trace's message array and format function. For example, you can add a current thread name to the traced messages:

private val trace = Trace(size = 64) {   
    index, // index of a trace message 
    text   // text passed when invoking trace { text }
    -> "$index: [${Thread.currentThread().name}] $text" 
} 

trace is only seen before transformation and completely erased after on Kotlin/JVM and Kotlin/JS.

Comments
  • KT 1.7.20 compatible

    KT 1.7.20 compatible

    > Could not resolve all files for configuration ':classpath'.
       > Could not resolve org.jetbrains.kotlin:kotlin-gradle-plugin-api:1.7.0.
         Required by:
             project : > org.jetbrains.kotlinx:atomicfu-gradle-plugin:0.18.3 > org.jetbrains.kotlin:atomicfu:1.7.0
          > Multiple incompatible variants of org.jetbrains.kotlin:kotlin-gradle-plugin-api:1.7.20 were selected:
               - Variant org.jetbrains.kotlin:kotlin-gradle-plugin-api:1.7.20 variant gradle70RuntimeElements has attributes {org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.jvm.environment=standard-jvm, org.gradle.jvm.version=8, org.gradle.libraryelements=jar, org.gradle.plugin.api-version=7.0, org.gradle.status=release, org.gradle.usage=java-runtime}
               - Variant org.jetbrains.kotlin:kotlin-gradle-plugin-api:1.7.20 variant gradle71RuntimeElements has attributes {org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.jvm.environment=standard-jvm, org.gradle.jvm.version=8, org.gradle.libraryelements=jar, org.gradle.plugin.api-version=7.1, org.gradle.status=release, org.gradle.usage=java-runtime}
    
    * Try:
    > Run with --stacktrace option to get the stack trace.
    > Run with --info or --debug option to get more log output.
    > Run with --scan to get full insights.
    
    
    

    Maybe it can be solved by updating dependencies?

    bug 
    opened by xtexChooser 8
  • Support for WASM & linArm32

    Support for WASM & linArm32

    I believe the only platforms that are not currently supported are WASM & linArm32. Are there plans to support these? As a library author targeting all possible kotlin platforms it would be great if atomicFu could just be dropped into a shared module for all platforms.

    postponed native 
    opened by patjackson52 5
  • Atomicfu Js/Ir compiler plugin supported in the gradle plugin

    Atomicfu Js/Ir compiler plugin supported in the gradle plugin

    • Added support of the compiler plugin transformation to the AtomicfuGradlePlugin.
    • atomicfu-gradle-plugin test projects are ignored for a while. I'm going to create a PR with new test projects soon.
    • Kotlin version is for now 1.7.0-dev-565, built from the 1.6.20-M1-release branch
    opened by mvicsokolova 4
  • JVM transformation fails with 'org.objectweb.asm.tree.InsnList cannot be cast to java.lang.Iterable'

    JVM transformation fails with 'org.objectweb.asm.tree.InsnList cannot be cast to java.lang.Iterable'

    When updating my project to use any version of AtomicFU after 0.14.4, I get a ClassCastException during the JVM transformation step. This is using Gradle 6.8.3. Any ideas on what might be causing it or if it's possible to work around?

    Failing build: https://github.com/erikc5000/island-time/pull/174/checks?check_run_id=2022771008

    Stack trace:

    > Task :core:transformJvmMainAtomicfu FAILED
    
    FAILURE: Build failed with an exception.
    
    * What went wrong:
    Execution failed for task ':core:transformJvmMainAtomicfu'.
    > class org.objectweb.asm.tree.InsnList cannot be cast to class java.lang.Iterable (org.objectweb.asm.tree.InsnList is in unnamed module of loader org.gradle.internal.classloader.VisitableURLClassLoader @1b461aba; java.lang.Iterable is in module java.base of loader 'bootstrap')
    
    * Try:
    Run with --info or --debug option to get more log output. Run with --scan to get full insights.
    
    * Exception is:
    org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':core:transformJvmMainAtomicfu'.
            at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.lambda$executeIfValid$3(ExecuteActionsTaskExecuter.java:186)
            at org.gradle.internal.Try$Failure.ifSuccessfulOrElse(Try.java:268)
            at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeIfValid(ExecuteActionsTaskExecuter.java:184)
            at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:173)
            at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:109)
            at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46)
            at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:62)
            at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57)
            at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:56)
            at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36)
            at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:77)
            at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:55)
            at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52)
            at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:200)
            at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:195)
            at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:75)
            at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:68)
            at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:153)
            at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:68)
            at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:62)
            at org.gradle.internal.operations.DefaultBuildOperationExecutor.lambda$call$2(DefaultBuildOperationExecutor.java:76)
            at org.gradle.internal.operations.UnmanagedBuildOperationWrapper.callWithUnmanagedSupport(UnmanagedBuildOperationWrapper.java:54)
            at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:76)
            at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:52)
            at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:41)
            at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:411)
            at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:398)
            at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:391)
            at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:377)
            at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.lambda$run$0(DefaultPlanExecutor.java:127)
            at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:191)
            at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.executeNextNode(DefaultPlanExecutor.java:182)
            at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:124)
            at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
            at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
            at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
    Caused by: java.lang.ClassCastException: class org.objectweb.asm.tree.InsnList cannot be cast to class java.lang.Iterable (org.objectweb.asm.tree.InsnList is in unnamed module of loader org.gradle.internal.classloader.VisitableURLClassLoader @1b461aba; java.lang.Iterable is in module java.base of loader 'bootstrap')
            at kotlinx.atomicfu.transformer.AtomicFUTransformer$DelegateFieldsCollectorMV.visitEnd(AtomicFUTransformer.kt:406)
            at org.objectweb.asm.ClassReader.readMethod(ClassReader.java:1279)
            at org.objectweb.asm.ClassReader.accept(ClassReader.java:679)
            at org.objectweb.asm.ClassReader.accept(ClassReader.java:391)
            at kotlinx.atomicfu.transformer.AtomicFUTransformer.analyzeFileForFields(AtomicFUTransformer.kt:234)
            at kotlinx.atomicfu.transformer.AtomicFUTransformer.analyzeFilesForFields(AtomicFUTransformer.kt:227)
            at kotlinx.atomicfu.transformer.AtomicFUTransformer.transform(AtomicFUTransformer.kt:196)
            at kotlinx.atomicfu.plugin.gradle.AtomicFUTransformTask.transform(AtomicFUGradlePlugin.kt:427)
            at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
            at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:104)
            at org.gradle.api.internal.project.taskfactory.StandardTaskAction.doExecute(StandardTaskAction.java:58)
            at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:51)
            at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:29)
            at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$2.run(ExecuteActionsTaskExecuter.java:494)
            at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:29)
            at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:26)
            at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:75)
            at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:68)
            at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:153)
            at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:68)
            at org.gradle.internal.operations.DefaultBuildOperationRunner.run(DefaultBuildOperationRunner.java:56)
            at org.gradle.internal.operations.DefaultBuildOperationExecutor.lambda$run$1(DefaultBuildOperationExecutor.java:71)
            at org.gradle.internal.operations.UnmanagedBuildOperationWrapper.runWithUnmanagedSupport(UnmanagedBuildOperationWrapper.java:45)
            at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:71)
            at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:479)
            at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:462)
            at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.access$400(ExecuteActionsTaskExecuter.java:105)
            at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution.executeWithPreviousOutputFiles(ExecuteActionsTaskExecuter.java:273)
            at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution.execute(ExecuteActionsTaskExecuter.java:251)
            at org.gradle.internal.execution.steps.ExecuteStep.lambda$executeOperation$1(ExecuteStep.java:66)
            at org.gradle.internal.execution.steps.ExecuteStep.executeOperation(ExecuteStep.java:66)
            at org.gradle.internal.execution.steps.ExecuteStep.access$000(ExecuteStep.java:34)
            at org.gradle.internal.execution.steps.ExecuteStep$1.call(ExecuteStep.java:47)
            at org.gradle.internal.execution.steps.ExecuteStep$1.call(ExecuteStep.java:44)
            at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:200)
            at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:195)
            at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:75)
            at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:68)
            at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:153)
            at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:68)
            at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:62)
            at org.gradle.internal.operations.DefaultBuildOperationExecutor.lambda$call$2(DefaultBuildOperationExecutor.java:76)
            at org.gradle.internal.operations.UnmanagedBuildOperationWrapper.callWithUnmanagedSupport(UnmanagedBuildOperationWrapper.java:54)
            at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:76)
            at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:44)
            at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:34)
            at org.gradle.internal.execution.steps.RemovePreviousOutputsStep.execute(RemovePreviousOutputsStep.java:72)
            at org.gradle.internal.execution.steps.RemovePreviousOutputsStep.execute(RemovePreviousOutputsStep.java:42)
            at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:53)
            at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:39)
            at org.gradle.internal.execution.steps.CancelExecutionStep.execute(CancelExecutionStep.java:44)
            at org.gradle.internal.execution.steps.TimeoutStep.executeWithoutTimeout(TimeoutStep.java:77)
            at org.gradle.internal.execution.steps.TimeoutStep.execute(TimeoutStep.java:58)
            at org.gradle.internal.execution.steps.CreateOutputsStep.execute(CreateOutputsStep.java:54)
            at org.gradle.internal.execution.steps.CreateOutputsStep.execute(CreateOutputsStep.java:32)
            at org.gradle.internal.execution.steps.CaptureStateAfterExecutionStep.execute(CaptureStateAfterExecutionStep.java:57)
            at org.gradle.internal.execution.steps.CaptureStateAfterExecutionStep.execute(CaptureStateAfterExecutionStep.java:38)
            at org.gradle.internal.execution.steps.BroadcastChangingOutputsStep.execute(BroadcastChangingOutputsStep.java:63)
            at org.gradle.internal.execution.steps.BroadcastChangingOutputsStep.execute(BroadcastChangingOutputsStep.java:30)
            at org.gradle.internal.execution.steps.BuildCacheStep.executeWithoutCache(BuildCacheStep.java:176)
            at org.gradle.internal.execution.steps.BuildCacheStep.execute(BuildCacheStep.java:76)
            at org.gradle.internal.execution.steps.BuildCacheStep.execute(BuildCacheStep.java:47)
            at org.gradle.internal.execution.steps.StoreExecutionStateStep.execute(StoreExecutionStateStep.java:43)
            at org.gradle.internal.execution.steps.StoreExecutionStateStep.execute(StoreExecutionStateStep.java:32)
            at org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:39)
            at org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:25)
            at org.gradle.internal.execution.steps.SkipUpToDateStep.executeBecause(SkipUpToDateStep.java:102)
            at org.gradle.internal.execution.steps.SkipUpToDateStep.lambda$execute$0(SkipUpToDateStep.java:95)
            at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:55)
            at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:39)
            at org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:83)
            at org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:44)
            at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:37)
            at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:27)
            at org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:96)
            at org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:52)
            at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:83)
            at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:54)
            at org.gradle.internal.execution.steps.ValidateStep.execute(ValidateStep.java:74)
            at org.gradle.internal.execution.steps.SkipEmptyWorkStep.lambda$execute$2(SkipEmptyWorkStep.java:88)
            at org.gradle.internal.execution.steps.SkipEmptyWorkStep.execute(SkipEmptyWorkStep.java:88)
            at org.gradle.internal.execution.steps.SkipEmptyWorkStep.execute(SkipEmptyWorkStep.java:34)
            at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsStartedStep.execute(MarkSnapshottingInputsStartedStep.java:38)
            at org.gradle.internal.execution.steps.LoadExecutionStateStep.execute(LoadExecutionStateStep.java:46)
            at org.gradle.internal.execution.steps.LoadExecutionStateStep.execute(LoadExecutionStateStep.java:34)
            at org.gradle.internal.execution.steps.AssignWorkspaceStep.lambda$execute$0(AssignWorkspaceStep.java:43)
            at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution$3.withWorkspace(ExecuteActionsTaskExecuter.java:286)
            at org.gradle.internal.execution.steps.AssignWorkspaceStep.execute(AssignWorkspaceStep.java:43)
            at org.gradle.internal.execution.steps.AssignWorkspaceStep.execute(AssignWorkspaceStep.java:33)
            at org.gradle.internal.execution.steps.IdentityCacheStep.execute(IdentityCacheStep.java:40)
            at org.gradle.internal.execution.steps.IdentityCacheStep.execute(IdentityCacheStep.java:30)
            at org.gradle.internal.execution.steps.IdentifyStep.execute(IdentifyStep.java:54)
            at org.gradle.internal.execution.steps.IdentifyStep.execute(IdentifyStep.java:40)
            at org.gradle.internal.execution.impl.DefaultExecutionEngine.execute(DefaultExecutionEngine.java:41)
            at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.lambda$executeIfValid$1(ExecuteActionsTaskExecuter.java:183)
            at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeIfValid(ExecuteActionsTaskExecuter.java:183)
            at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:173)
            at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:109)
            at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46)
            at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:62)
            at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57)
            at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:56)
            at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36)
            at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:77)
            at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:55)
            at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52)
            at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:200)
            at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:195)
            at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:75)
            at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:68)
            at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:153)
            at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:68)
            at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:62)
            at org.gradle.internal.operations.DefaultBuildOperationExecutor.lambda$call$2(DefaultBuildOperationExecutor.java:76)
            at org.gradle.internal.operations.UnmanagedBuildOperationWrapper.callWithUnmanagedSupport(UnmanagedBuildOperationWrapper.java:54)
            at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:76)
            at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:52)
            at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:41)
            at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:411)
            at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:398)
            at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:391)
            at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:377)
            at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.lambda$run$0(DefaultPlanExecutor.java:127)
            at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:191)
            at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.executeNextNode(DefaultPlanExecutor.java:182)
            at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:124)
            at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
            at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
            at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
    
    
    * Get more help at https://help.gradle.org
    
    BUILD FAILED in 42s
    
    opened by erikc5000 4
  • Execution failed for task ':common:transformJvmMainAtomicfu'. kotlin/KotlinNothingValueException

    Execution failed for task ':common:transformJvmMainAtomicfu'. kotlin/KotlinNothingValueException

    After updating from 0.14.4 to 0.15.0 my project no longer builds. Here is the build exception (with stacktrace):

    > Task :common:jvmMainClasses UP-TO-DATE
    > Task :common:transformJvmMainAtomicfu FAILED
    FAILURE: Build failed with an exception.
    * What went wrong:
    Execution failed for task ':common:transformJvmMainAtomicfu'.
    > kotlin/KotlinNothingValueException
    * Try:
    Run with --info or --debug option to get more log output. Run with --scan to get full insights.
    * Exception is:
    org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':common:transformJvmMainAtomicfu'.
    	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.lambda$executeIfValid$1(ExecuteActionsTaskExecuter.java:200)
    	at org.gradle.internal.Try$Failure.ifSuccessfulOrElse(Try.java:263)
    	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeIfValid(ExecuteActionsTaskExecuter.java:198)
    	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:179)
    	at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:109)
    	at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46)
    	at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:62)
    	at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57)
    	at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:56)
    	at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36)
    	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:77)
    	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:55)
    	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52)
    	at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:200)
    	at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:195)
    	at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:75)
    	at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:68)
    	at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:153)
    	at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:68)
    	at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:62)
    	at org.gradle.internal.operations.DefaultBuildOperationExecutor.lambda$call$2(DefaultBuildOperationExecutor.java:76)
    	at org.gradle.internal.operations.UnmanagedBuildOperationWrapper.callWithUnmanagedSupport(UnmanagedBuildOperationWrapper.java:54)
    	at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:76)
    	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:52)
    	at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:41)
    	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:372)
    	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:359)
    	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:352)
    	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:338)
    	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.lambda$run$0(DefaultPlanExecutor.java:127)
    	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:191)
    	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.executeNextNode(DefaultPlanExecutor.java:182)
    	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:124)
    	at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
    	at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
    	at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
    Caused by: java.lang.NoClassDefFoundError: kotlin/KotlinNothingValueException
    	at kotlinx.atomicfu.plugin.gradle.AtomicFUTransformTask.transform(AtomicFUGradlePlugin.kt:424)
    	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    	at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:104)
    	at org.gradle.api.internal.project.taskfactory.StandardTaskAction.doExecute(StandardTaskAction.java:58)
    	at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:51)
    	at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:29)
    	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$3.run(ExecuteActionsTaskExecuter.java:555)
    	at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:29)
    	at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:26)
    	at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:75)
    	at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:68)
    	at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:153)
    	at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:68)
    	at org.gradle.internal.operations.DefaultBuildOperationRunner.run(DefaultBuildOperationRunner.java:56)
    	at org.gradle.internal.operations.DefaultBuildOperationExecutor.lambda$run$1(DefaultBuildOperationExecutor.java:71)
    	at org.gradle.internal.operations.UnmanagedBuildOperationWrapper.runWithUnmanagedSupport(UnmanagedBuildOperationWrapper.java:45)
    	at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:71)
    	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:540)
    	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:523)
    	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.access$300(ExecuteActionsTaskExecuter.java:108)
    	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution.executeWithPreviousOutputFiles(ExecuteActionsTaskExecuter.java:271)
    	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution.execute(ExecuteActionsTaskExecuter.java:260)
    	at org.gradle.internal.execution.steps.ExecuteStep.lambda$execute$1(ExecuteStep.java:34)
    	at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:34)
    	at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:26)
    	at org.gradle.internal.execution.steps.CleanupOutputsStep.execute(CleanupOutputsStep.java:67)
    	at org.gradle.internal.execution.steps.CleanupOutputsStep.execute(CleanupOutputsStep.java:36)
    	at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:49)
    	at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:34)
    	at org.gradle.internal.execution.steps.CancelExecutionStep.execute(CancelExecutionStep.java:43)
    	at org.gradle.internal.execution.steps.TimeoutStep.executeWithoutTimeout(TimeoutStep.java:73)
    	at org.gradle.internal.execution.steps.TimeoutStep.execute(TimeoutStep.java:54)
    	at org.gradle.internal.execution.steps.CreateOutputsStep.execute(CreateOutputsStep.java:44)
    	at org.gradle.internal.execution.steps.SnapshotOutputsStep.execute(SnapshotOutputsStep.java:54)
    	at org.gradle.internal.execution.steps.SnapshotOutputsStep.execute(SnapshotOutputsStep.java:38)
    	at org.gradle.internal.execution.steps.BroadcastChangingOutputsStep.execute(BroadcastChangingOutputsStep.java:42)
    	at org.gradle.internal.execution.steps.CacheStep.executeWithoutCache(CacheStep.java:159)
    	at org.gradle.internal.execution.steps.CacheStep.executeAndStoreInCache(CacheStep.java:135)
    	at org.gradle.internal.execution.steps.CacheStep.lambda$executeWithCache$2(CacheStep.java:112)
    	at org.gradle.internal.execution.steps.CacheStep.lambda$executeWithCache$3(CacheStep.java:112)
    	at org.gradle.internal.Try$Success.map(Try.java:162)
    	at org.gradle.internal.execution.steps.CacheStep.executeWithCache(CacheStep.java:81)
    	at org.gradle.internal.execution.steps.CacheStep.execute(CacheStep.java:71)
    	at org.gradle.internal.execution.steps.CacheStep.execute(CacheStep.java:43)
    	at org.gradle.internal.execution.steps.StoreExecutionStateStep.execute(StoreExecutionStateStep.java:44)
    	at org.gradle.internal.execution.steps.StoreExecutionStateStep.execute(StoreExecutionStateStep.java:33)
    	at org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:38)
    	at org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:24)
    	at org.gradle.internal.execution.steps.SkipUpToDateStep.executeBecause(SkipUpToDateStep.java:92)
    	at org.gradle.internal.execution.steps.SkipUpToDateStep.lambda$execute$0(SkipUpToDateStep.java:85)
    	at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:55)
    	at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:39)
    	at org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:76)
    	at org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:37)
    	at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:36)
    	at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:26)
    	at org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:94)
    	at org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:49)
    	at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:79)
    	at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:53)
    	at org.gradle.internal.execution.steps.ValidateStep.execute(ValidateStep.java:74)
    	at org.gradle.internal.execution.steps.SkipEmptyWorkStep.lambda$execute$2(SkipEmptyWorkStep.java:78)
    	at org.gradle.internal.execution.steps.SkipEmptyWorkStep.execute(SkipEmptyWorkStep.java:78)
    	at org.gradle.internal.execution.steps.SkipEmptyWorkStep.execute(SkipEmptyWorkStep.java:34)
    	at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsStartedStep.execute(MarkSnapshottingInputsStartedStep.java:39)
    	at org.gradle.internal.execution.steps.LoadExecutionStateStep.execute(LoadExecutionStateStep.java:40)
    	at org.gradle.internal.execution.steps.LoadExecutionStateStep.execute(LoadExecutionStateStep.java:28)
    	at org.gradle.internal.execution.impl.DefaultWorkExecutor.execute(DefaultWorkExecutor.java:33)
    	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeIfValid(ExecuteActionsTaskExecuter.java:187)
    	at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:179)
    	at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:109)
    	at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46)
    	at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:62)
    	at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57)
    	at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:56)
    	at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36)
    	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:77)
    	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:55)
    	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52)
    	at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:200)
    	at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:195)
    	at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:75)
    	at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:68)
    	at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:153)
    	at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:68)
    	at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:62)
    	at org.gradle.internal.operations.DefaultBuildOperationExecutor.lambda$call$2(DefaultBuildOperationExecutor.java:76)
    	at org.gradle.internal.operations.UnmanagedBuildOperationWrapper.callWithUnmanagedSupport(UnmanagedBuildOperationWrapper.java:54)
    	at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:76)
    	at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:52)
    	at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:41)
    	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:372)
    	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:359)
    	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:352)
    	at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:338)
    	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.lambda$run$0(DefaultPlanExecutor.java:127)
    	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:191)
    	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.executeNextNode(DefaultPlanExecutor.java:182)
    	at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:124)
    	at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
    	at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
    	at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
    Caused by: java.lang.ClassNotFoundException: kotlin.KotlinNothingValueException
    	... 104 more
    * Get more help at https://help.gradle.org
    Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
    Use '--warning-mode all' to show the individual deprecation warnings.
    See https://docs.gradle.org/6.7.1/userguide/command_line_interface.html#sec:command_line_warnings
    BUILD FAILED in 709ms
    

    I am not sure what could be going wrong. All works fine with 0.14.4. I am using the following versions:

    • AtomicFU: 0.15.0 (updated atomicfu and atomicfu-gradle-plugin. Also fails with same error if I only use the Gradle plugin)
    • Kotlin: 1.4.21
    • Gradle: 6.7.1
    • Android Gradle plugin: tried both 4.1.1 and 4.2.0-beta02

    Can you see something in the stack trace which could point to the issue?

    bug 
    opened by Thomas-Vos 4
  • Gradle transformJvmMainAtomicfu failed when using atomic() in companion obj

    Gradle transformJvmMainAtomicfu failed when using atomic() in companion obj

    Caused by: java.lang.ArrayIndexOutOfBoundsException: Index -1 out of bounds for length 0
            at org.objectweb.asm.Frame.a(Unknown Source)
            at org.objectweb.asm.MethodWriter.visitMaxs(Unknown Source)
            at org.objectweb.asm.tree.MethodNode.accept(Unknown Source)
            at kotlinx.atomicfu.transformer.AtomicFUTransformer$TransformerMV.visitEnd(AtomicFUTransformer.kt:611)
            at org.objectweb.asm.ClassReader.b(Unknown Source)
            at org.objectweb.asm.ClassReader.accept(Unknown Source)
            at org.objectweb.asm.ClassReader.accept(Unknown Source)
            at kotlinx.atomicfu.transformer.AtomicFUTransformer.transformFile(AtomicFUTransformer.kt:237)
            at kotlinx.atomicfu.transformer.AtomicFUTransformer.transform(AtomicFUTransformer.kt:172)
            at kotlinx.atomicfu.plugin.gradle.AtomicFUTransformTask.transform(AtomicFUGradlePlugin.kt:387)
    
    

    This works fine

    class Bot( ... ) {
        private val count = atomic<Int>(0)
    
        val id = count.getAndUpdate { it + 1 }
    }
    

    But this doesn't work

    class Bot( ... ){
        val id = count.getAndUpdate { it + 1 }
    
        companion object {
          private val count = atomic<Int>(0)
        }
    }
    

    And after I removed private, I got a new exception Unsupported return within atomic operation

    opened by Him188 4
  • Autoconfig of Dependency brocken in kotlin 1.7.0

    Autoconfig of Dependency brocken in kotlin 1.7.0

    Hallo AtomicFu team,

    I'm using AtomicFu in a multi platform; multi project setup. It looks similar to the Example project: FuExample.zip On kotlin version 1.6.20 every thing works. On kotlin version 1.7.0 the build fails with : No matching variant of org.jetbrains.kotlin:atomicfu:1.7.0 was found.

    opened by JochenGuckSnk 3
  • DCE for user-defined extensions in atomicfu

    DCE for user-defined extensions in atomicfu

    Consider the following user-defined extension: private inline fun AtomicBoolean.tryAcquire(): Boolean = compareAndSet(false, true)

    Currently, the postprocessor retains the original method in the bytecode. While it is okay for the Kotlin compiler to do so, it is not the case for atomicfu that should remove every trace of itself after post-processing. Otherwise, resulting classfiles are polluted with symbols that are missing from the classpath (and it may trigger warnings like https://github.com/Kotlin/kotlinx.coroutines/issues/1155).

    Also, note that not only extensions but their access-bridges should be removed.

    opened by qwwdfsad 3
  • Kotlin Runner stops working in IDEA when adding a gradle plug-in AtomicFU

    Kotlin Runner stops working in IDEA when adding a gradle plug-in AtomicFU

    If you enable the plugin AtomicFU, it ceases to run kotlin-runner in IDEA:

    Error: Could not find or load main class demo.AppKt

    demo project: https://github.com/bug-samples/kotlinx.atomicfu-27

    opened by BorzdeG 3
  • Gradle plugin for appling transformation during gradle build

    Gradle plugin for appling transformation during gradle build

    usage example:

    apply plugin: 'kotlinx.atomicfu.transformer'
    ...
    atomicFUTransform {
        inputDir = compileKotlin.destinationDir
        outputDir = file(CLASSES_AFTER_ATOMICFU_TRANSFORM)
        classPath = sourceSets.main.runtimeClasspath.asPath.split(":")
    }
    ...
    atomicFUTransform.dependsOn compileKotlin
    classes.dependsOn atomicFUTransform
    
    opened by KirillTim 3
  • Support JVM IR compiler plugin in AtomicfuGradlePlugin

    Support JVM IR compiler plugin in AtomicfuGradlePlugin

    • Introduced new flags for application of JS and JVM compiler plugins: kotlinx.atomicfu.enableJsIrTransformation and kotlinx.atomicfu.enableJvmIrTransformation
    • Separate application of compiler plugins for both backends supported via the AtomicfuKotlinGradleExtension

    Waiting to merge this PR after update to 1.7.20

    opened by mvicsokolova 2
  • Using atomic extensions from another module

    Using atomic extensions from another module

    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:

    • Checker in FIR: frontend checker for usages of atomic extensions out of module
    • Generate transformed declaration in air per module (to be investigated)
    enhancement JVM IR 
    opened by mvicsokolova 0
  • Atomicfu compiler plugin for native

    Atomicfu compiler plugin for native

    Since Kotlin 1.7.20 atomicfu compiler plugin supports both JVM and JS backends, performing IR transformations. The next step is to support native backend.

    The workflow for this task:

    On the part of Kotlin/Native team:

    • [ ] support volatile fields for the new memory model and add necessary intrinsics to stdlib (see https://youtrack.jetbrains.com/issue/KT-54944/Volatile-support-in-native)

    On the part of atomicfu compiler plugin:

    • [x] native test infrastructure
    • [ ] perform IR transformations replacing kotlinx.atomicfu.Atomic* classes with volatile values
    • [ ] implement atomic operations and basic inline functions via the stdlib intrinsics (compareAndSetField, compareAndSwapField, addAndGetField)
    • [ ] support atomic arrays
    native 
    opened by mvicsokolova 0
  • Atomicfu JVM IR compiler plugin does not remove atomicfu references from Metadata

    Atomicfu JVM IR compiler plugin does not remove atomicfu references from Metadata

    JVM IR compiler plugin, introduced since Kotlin 1.7.20 leaves atomicfu references in metadata. Example of metadata of the transformed class:

    private final class kotlinx/coroutines/AwaitAll<T#0> : kotlin/Any {
      // field: deferreds:[Lkotlinx/coroutines/Deferred;
      private final val deferreds: kotlin/Array<out kotlinx/coroutines/Deferred<T#0>>
        private final get
    
      private final val notCompletedCount: kotlinx/atomicfu/AtomicInt          // <------ !!!
        private final get
    
      .....
    }
    

    Probably JVM IR compiler plugin removes the backingField of the atomic property but leaves the property itself.

    Not critical, should be fixed on the compiler plugin side.

    enhancement JVM IR 
    opened by mvicsokolova 0
  • java.lang.IllegalStateException: Symbol with IrClassSymbolImpl is unbound

    java.lang.IllegalStateException: Symbol with IrClassSymbolImpl is unbound

    Kotlin 1.7.20

    java.lang.IllegalStateException: Symbol with IrClassSymbolImpl is unbound at org.jetbrains.kotlin.ir.symbols.impl.IrBindableSymbolBase.getOwner(IrPrivateSymbolBase.kt:59) at org.jetbrains.kotlin.ir.types.IrTypesKt.getClassFqName(irTypes.kt:103) at org.jetbrains.kotlinx.atomicfu.compiler.backend.jvm.AtomicfuJvmIrTransformer.isAtomicValueType(AtomicfuJvmIrTransformer.kt:847) at org.jetbrains.kotlinx.atomicfu.compiler.backend.jvm.AtomicfuJvmIrTransformer.access$isAtomicValueType(AtomicfuJvmIrTransformer.kt:43) at org.jetbrains.kotlinx.atomicfu.compiler.backend.jvm.AtomicfuJvmIrTransformer$AtomicfuTransformer.visitCall(AtomicfuJvmIrTransformer.kt:482) at org.jetbrains.kotlinx.atomicfu.compiler.backend.jvm.AtomicfuJvmIrTransformer$AtomicfuTransformer.visitCall(AtomicfuJvmIrTransformer.kt:473) at org.jetbrains.kotlin.ir.expressions.IrCall.accept(IrCall.kt:25) at org.jetbrains.kotlin.ir.expressions.IrExpression.transform(IrExpression.kt:28) at org.jetbrains.kotlin.ir.expressions.IrExpression.transform(IrExpression.kt:21) at org.jetbrains.kotlin.ir.util.TransformKt.transformInPlace(transform.kt:35) at org.jetbrains.kotlin.ir.expressions.IrVararg.transformChildren(IrVararg.kt:33) at org.jetbrains.kotlin.ir.visitors.IrElementTransformer$DefaultImpls.visitExpression(IrElementTransformer.kt:173) at org.jetbrains.kotlinx.atomicfu.compiler.backend.jvm.AtomicfuJvmIrTransformer$AtomicfuTransformer.visitExpression(AtomicfuJvmIrTransformer.kt:473) at org.jetbrains.kotlinx.atomicfu.compiler.backend.jvm.AtomicfuJvmIrTransformer$AtomicfuTransformer.visitExpression(AtomicfuJvmIrTransformer.kt:473) at org.jetbrains.kotlin.ir.visitors.IrElementTransformer$DefaultImpls.visitVararg(IrElementTransformer.kt:345) at org.jetbrains.kotlinx.atomicfu.compiler.backend.jvm.AtomicfuJvmIrTransformer$AtomicfuTransformer.visitVararg(AtomicfuJvmIrTransformer.kt:473) at org.jetbrains.kotlinx.atomicfu.compiler.backend.jvm.AtomicfuJvmIrTransformer$AtomicfuTransformer.visitVararg(AtomicfuJvmIrTransformer.kt:473) at org.jetbrains.kotlin.ir.expressions.IrVararg.accept(IrVararg.kt:26) at org.jetbrains.kotlin.ir.expressions.IrExpression.transform(IrExpression.kt:28) at org.jetbrains.kotlin.ir.expressions.IrMemberAccessExpression.transformChildren(IrMemberAccessExpression.kt:82) at org.jetbrains.kotlin.ir.visitors.IrElementTransformer$DefaultImpls.visitExpression(IrElementTransformer.kt:173) at org.jetbrains.kotlinx.atomicfu.compiler.backend.jvm.AtomicfuJvmIrTransformer$AtomicfuTransformer.visitExpression(AtomicfuJvmIrTransformer.kt:473) at org.jetbrains.kotlinx.atomicfu.compiler.backend.jvm.AtomicfuJvmIrTransformer$AtomicfuTransformer.visitExpression(AtomicfuJvmIrTransformer.kt:473) at org.jetbrains.kotlin.ir.visitors.IrElementTransformer$DefaultImpls.visitDeclarationReference(IrElementTransformer.kt:188) at org.jetbrains.kotlinx.atomicfu.compiler.backend.jvm.AtomicfuJvmIrTransformer$AtomicfuTransformer.visitDeclarationReference(AtomicfuJvmIrTransformer.kt:473) at org.jetbrains.kotlinx.atomicfu.compiler.backend.jvm.AtomicfuJvmIrTransformer$AtomicfuTransformer.visitDeclarationReference(AtomicfuJvmIrTransformer.kt:473) at org.jetbrains.kotlin.ir.visitors.IrElementTransformer$DefaultImpls.visitMemberAccess(IrElementTransformer.kt:191) at org.jetbrains.kotlinx.atomicfu.compiler.backend.jvm.AtomicfuJvmIrTransformer$AtomicfuTransformer.visitMemberAccess(AtomicfuJvmIrTransformer.kt:473) at org.jetbrains.kotlinx.atomicfu.compiler.backend.jvm.AtomicfuJvmIrTransformer$AtomicfuTransformer.visitMemberAccess(AtomicfuJvmIrTransformer.kt:473) at org.jetbrains.kotlin.ir.visitors.IrElementTransformer$DefaultImpls.visitFunctionAccess(IrElementTransformer.kt:194) at org.jetbrains.kotlinx.atomicfu.compiler.backend.jvm.AtomicfuJvmIrTransformer$AtomicfuTransformer.visitFunctionAccess(AtomicfuJvmIrTransformer.kt:473) at org.jetbrains.kotlinx.atomicfu.compiler.backend.jvm.AtomicfuJvmIrTransformer$AtomicfuTransformer.visitFunctionAccess(AtomicfuJvmIrTransformer.kt:473) at org.jetbrains.kotlin.ir.visitors.IrElementTransformer$DefaultImpls.visitCall(IrElementTransformer.kt:229) at org.jetbrains.kotlinx.atomicfu.compiler.backend.jvm.AtomicfuJvmIrTransformer$AtomicfuTransformer.visitCall(AtomicfuJvmIrTransformer.kt:591) at org.jetbrains.kotlinx.atomicfu.compiler.backend.jvm.AtomicfuJvmIrTransformer$AtomicfuTransformer.visitCall(AtomicfuJvmIrTransformer.kt:473) at org.jetbrains.kotlin.ir.expressions.IrCall.accept(IrCall.kt:25) at org.jetbrains.kotlin.ir.expressions.IrExpression.transform(IrExpression.kt:28) at org.jetbrains.kotlin.ir.expressions.IrReturn.transformChildren(IrReturn.kt:32) at org.jetbrains.kotlin.ir.visitors.IrElementTransformer$DefaultImpls.visitExpression(IrElementTransformer.kt:173) at org.jetbrains.kotlinx.atomicfu.compiler.backend.jvm.AtomicfuJvmIrTransformer$AtomicfuTransformer.visitExpression(AtomicfuJvmIrTransformer.kt:473) at org.jetbrains.kotlinx.atomicfu.compiler.backend.jvm.AtomicfuJvmIrTransformer$AtomicfuTransformer.visitExpression(AtomicfuJvmIrTransformer.kt:473) at org.jetbrains.kotlin.ir.visitors.IrElementTransformer$DefaultImpls.visitReturn(IrElementTransformer.kt:311) at org.jetbrains.kotlinx.atomicfu.compiler.backend.jvm.AtomicfuJvmIrTransformer$AtomicfuTransformer.visitReturn(AtomicfuJvmIrTransformer.kt:473) at org.jetbrains.kotlinx.atomicfu.compiler.backend.jvm.AtomicfuJvmIrTransformer$AtomicfuTransformer.visitReturn(AtomicfuJvmIrTransformer.kt:473) at org.jetbrains.kotlin.ir.expressions.IrReturn.accept(IrReturn.kt:25) at org.jetbrains.kotlin.ir.expressions.IrExpression.transform(IrExpression.kt:28) at org.jetbrains.kotlin.ir.expressions.IrExpression.transform(IrExpression.kt:21) at org.jetbrains.kotlin.ir.util.TransformKt.transformInPlace(transform.kt:35) at org.jetbrains.kotlin.ir.expressions.IrBlockBody.transformChildren(IrBlockBody.kt:31) at org.jetbrains.kotlin.ir.visitors.IrElementTransformer$DefaultImpls.visitBody(IrElementTransformer.kt:178) at org.jetbrains.kotlinx.atomicfu.compiler.backend.jvm.AtomicfuJvmIrTransformer$AtomicfuTransformer.visitBody(AtomicfuJvmIrTransformer.kt:473) at org.jetbrains.kotlinx.atomicfu.compiler.backend.jvm.AtomicfuJvmIrTransformer$AtomicfuTransformer.visitBody(AtomicfuJvmIrTransformer.kt:473) at org.jetbrains.kotlin.ir.visitors.IrElementTransformer$DefaultImpls.visitBlockBody(IrElementTransformer.kt:185) at org.jetbrains.kotlinx.atomicfu.compiler.backend.jvm.AtomicfuJvmIrTransformer$AtomicfuTransformer.visitBlockBody(AtomicfuJvmIrTransformer.kt:636) at org.jetbrains.kotlinx.atomicfu.compiler.backend.jvm.AtomicfuJvmIrTransformer$AtomicfuTransformer.visitBlockBody(AtomicfuJvmIrTransformer.kt:473) at org.jetbrains.kotlin.ir.expressions.IrBlockBody.accept(IrBlockBody.kt:24) at org.jetbrains.kotlin.ir.expressions.IrBody.transform(IrBody.kt:21) at org.jetbrains.kotlin.ir.declarations.IrFunction.transformChildren(IrFunction.kt:61) at org.jetbrains.kotlin.ir.visitors.IrElementTransformer$DefaultImpls.visitDeclaration(IrElementTransformer.kt:103) at org.jetbrains.kotlinx.atomicfu.compiler.backend.jvm.AtomicfuJvmIrTransformer$AtomicfuTransformer.visitDeclaration(AtomicfuJvmIrTransformer.kt:473) at org.jetbrains.kotlinx.atomicfu.compiler.backend.jvm.AtomicfuJvmIrTransformer$AtomicfuTransformer.visitDeclaration(AtomicfuJvmIrTransformer.kt:473) at org.jetbrains.kotlin.ir.visitors.IrElementTransformer$DefaultImpls.visitFunction(IrElementTransformer.kt:120) at org.jetbrains.kotlinx.atomicfu.compiler.backend.jvm.AtomicfuJvmIrTransformer$AtomicfuTransformer.visitFunction(AtomicfuJvmIrTransformer.kt:475) at org.jetbrains.kotlinx.atomicfu.compiler.backend.jvm.AtomicfuJvmIrTransformer$AtomicfuTransformer.visitFunction(AtomicfuJvmIrTransformer.kt:473) at org.jetbrains.kotlin.ir.visitors.IrElementTransformer$DefaultImpls.visitSimpleFunction(IrElementTransformer.kt:150) at org.jetbrains.kotlinx.atomicfu.compiler.backend.jvm.AtomicfuJvmIrTransformer$AtomicfuTransformer.visitSimpleFunction(AtomicfuJvmIrTransformer.kt:473) at org.jetbrains.kotlinx.atomicfu.compiler.backend.jvm.AtomicfuJvmIrTransformer$AtomicfuTransformer.visitSimpleFunction(AtomicfuJvmIrTransformer.kt:473) at org.jetbrains.kotlin.ir.declarations.IrSimpleFunction.accept(IrSimpleFunction.kt:36) at org.jetbrains.kotlin.ir.IrElementBase.transform(IrElementBase.kt:24) at org.jetbrains.kotlin.ir.util.TransformKt.transformInPlace(transform.kt:35) at org.jetbrains.kotlin.ir.declarations.IrClass.transformChildren(IrClass.kt:74) at org.jetbrains.kotlin.ir.visitors.IrElementTransformer$DefaultImpls.visitDeclaration(IrElementTransformer.kt:103) at org.jetbrains.kotlinx.atomicfu.compiler.backend.jvm.AtomicfuJvmIrTransformer$AtomicfuTransformer.visitDeclaration(AtomicfuJvmIrTransformer.kt:473) at org.jetbrains.kotlinx.atomicfu.compiler.backend.jvm.AtomicfuJvmIrTransformer$AtomicfuTransformer.visitDeclaration(AtomicfuJvmIrTransformer.kt:473) at org.jetbrains.kotlin.ir.visitors.IrElementTransformer$DefaultImpls.visitClass(IrElementTransformer.kt:110) at org.jetbrains.kotlinx.atomicfu.compiler.backend.jvm.AtomicfuJvmIrTransformer$AtomicfuTransformer.visitClass(AtomicfuJvmIrTransformer.kt:473) at org.jetbrains.kotlinx.atomicfu.compiler.backend.jvm.AtomicfuJvmIrTransformer$AtomicfuTransformer.visitClass(AtomicfuJvmIrTransformer.kt:473) at org.jetbrains.kotlin.ir.declarations.IrClass.accept(IrClass.kt:64) at org.jetbrains.kotlin.ir.IrElementBase.transform(IrElementBase.kt:24) at org.jetbrains.kotlin.ir.util.TransformKt.transformInPlace(transform.kt:35) at org.jetbrains.kotlin.ir.declarations.IrClass.transformChildren(IrClass.kt:74) at org.jetbrains.kotlin.ir.visitors.IrElementTransformer$DefaultImpls.visitDeclaration(IrElementTransformer.kt:103) at org.jetbrains.kotlinx.atomicfu.compiler.backend.jvm.AtomicfuJvmIrTransformer$AtomicfuTransformer.visitDeclaration(AtomicfuJvmIrTransformer.kt:473) at org.jetbrains.kotlinx.atomicfu.compiler.backend.jvm.AtomicfuJvmIrTransformer$AtomicfuTransformer.visitDeclaration(AtomicfuJvmIrTransformer.kt:473) at org.jetbrains.kotlin.ir.visitors.IrElementTransformer$DefaultImpls.visitClass(IrElementTransformer.kt:110) at org.jetbrains.kotlinx.atomicfu.compiler.backend.jvm.AtomicfuJvmIrTransformer$AtomicfuTransformer.visitClass(AtomicfuJvmIrTransformer.kt:473) at org.jetbrains.kotlinx.atomicfu.compiler.backend.jvm.AtomicfuJvmIrTransformer$AtomicfuTransformer.visitClass(AtomicfuJvmIrTransformer.kt:473) at org.jetbrains.kotlin.ir.declarations.IrClass.accept(IrClass.kt:64) at org.jetbrains.kotlin.ir.IrElementBase.transform(IrElementBase.kt:24) at org.jetbrains.kotlin.ir.util.TransformKt.transformInPlace(transform.kt:35) at org.jetbrains.kotlin.ir.declarations.IrFile.transformChildren(IrFile.kt:40) at org.jetbrains.kotlin.ir.visitors.IrElementTransformer$DefaultImpls.visitFile(IrElementTransformer.kt:168) at org.jetbrains.kotlinx.atomicfu.compiler.backend.jvm.AtomicfuJvmIrTransformer$AtomicfuTransformer.visitFile(AtomicfuJvmIrTransformer.kt:473) at org.jetbrains.kotlinx.atomicfu.compiler.backend.jvm.AtomicfuJvmIrTransformer$AtomicfuTransformer.visitFile(AtomicfuJvmIrTransformer.kt:473) at org.jetbrains.kotlin.ir.declarations.IrFile.accept(IrFile.kt:30) at org.jetbrains.kotlin.ir.declarations.IrFile.transform(IrFile.kt:33) at org.jetbrains.kotlinx.atomicfu.compiler.backend.jvm.AtomicfuJvmIrTransformer.transformAtomicfuDeclarations(AtomicfuJvmIrTransformer.kt:83) at org.jetbrains.kotlinx.atomicfu.compiler.backend.jvm.AtomicfuJvmIrTransformer.transform(AtomicfuJvmIrTransformer.kt:63) at org.jetbrains.kotlinx.atomicfu.compiler.extensions.AtomicfuLoweringExtension.generate(AtomicfuLoweringExtension.kt:32) at org.jetbrains.kotlin.backend.jvm.JvmIrCodegenFactory.convertToIr$lambda$1(JvmIrCodegenFactory.kt:183) at org.jetbrains.kotlin.psi2ir.Psi2IrTranslator.generateModuleFragment(Psi2IrTranslator.kt:99) at org.jetbrains.kotlin.backend.jvm.JvmIrCodegenFactory.convertToIr(JvmIrCodegenFactory.kt:215) at org.jetbrains.kotlin.backend.jvm.JvmIrCodegenFactory.convertToIr(JvmIrCodegenFactory.kt:53) at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.convertToIr(KotlinToJVMBytecodeCompiler.kt:230) 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:58) at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:158) at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:53) at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:99) at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:47) at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:101) at org.jetbrains.kotlin.incremental.IncrementalJvmCompilerRunner.runCompiler(IncrementalJvmCompilerRunner.kt:475) at org.jetbrains.kotlin.incremental.IncrementalJvmCompilerRunner.runCompiler(IncrementalJvmCompilerRunner.kt:125) at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compileIncrementally(IncrementalCompilerRunner.kt:373) at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compileIncrementally$default(IncrementalCompilerRunner.kt:318) at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.rebuild(IncrementalCompilerRunner.kt:114) at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compileImpl(IncrementalCompilerRunner.kt:207) at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compile(IncrementalCompilerRunner.kt:79) at org.jetbrains.kotlin.daemon.CompileServiceImplBase.execIncrementalCompiler(CompileServiceImpl.kt:625) at org.jetbrains.kotlin.daemon.CompileServiceImplBase.access$execIncrementalCompiler(CompileServiceImpl.kt:101) at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:1746) at jdk.internal.reflect.GeneratedMethodAccessor108.invoke(Unknown Source) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:568) at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:360) 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(AccessController.java:712) at java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196) at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:587) at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:828) at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:705) at java.base/java.security.AccessController.doPrivileged(AccessController.java:399) at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:704) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) at java.base/java.lang.Thread.run(Thread.java:833)

    bug JVM IR 
    opened by danny-su 3
  • Misleading error message

    Misleading error message "field must be final" when actually requiring a property to be declared val

    Compile this for the JVM target:

    import kotlinx.atomicfu.atomic
    
    var atomicProperty = atomic(1)
    

    The following error message will appear:

    > Task :transformJvmMainAtomicfu FAILED
    9 actionable tasks: 2 executed, 7 up-to-date
    MainKt::atomicProperty field must be final
    

    This is misleading. As the docs on properties state:

    In Kotlin, a field is only used as a part of a property to hold its value in memory. Fields cannot be declared directly.

    A better wording would be

    The property MainKt::atomicProperty must be declared as val
    

    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

    exception handling 
    opened by OliverO2 2
  • Why compareAndSwap is not allowed for delegates?

    Why compareAndSwap is not allowed for delegates?

    I wanted to make a custom operator fun get/setValue() for AtomicRef but disallowing compareAndSet for the fields ends with $delegate by the transformer prevent me. Why for the variables ends with $delegate, non get/setValue function is not allowed?

    We need a trick to remove calling equals/hashCode of Atomic* to wrap Atomic* with inline class so this can not be a bug report so I make this issue as a question.

    (When the kotlin provide a away to make non-boxable inline classes and allow us to override equals/hashCode, inline class wrapping of AtomicRef<ClassFile?> will work probably for most cases.)

    The minimum project to reproduce this problem: https://github.com/anatawa12/kotlinx.atomicfu-213

    postponed 
    opened by anatawa12 0
Releases(0.19.0)
Owner
Kotlin
Kotlin Tools and Libraries
Kotlin
A pure Kotlin/Multiplatform implementation of group operations on Curve25519.

curve25519-kotlin A pure Kotlin/Multiplatform implementation of group operations on Curve25519. Gradle Kotlin DSL: dependencies { implementation("

Andrey Pfau 9 Dec 22, 2022
Flutter plugin that leverages Storage Access Framework (SAF) API to get access and perform the operations on files and folders

Flutter plugin that leverages Storage Access Framework (SAF) API to get access and perform the operations on files and folders.

Vehement 8 Nov 26, 2022
kinstall is an easy way to install gradle-based command-line kotlin projects that use the application plugin.

kinstall kinstall is an easy way to install gradle-based command-line kotlin projects that use the application plugin. use First, install kinstall its

david kilmer 0 Apr 24, 2022
A Kotlin library providing a simple, high-performance way to use off-heap native memory in JVM applications.

native_memory_allocator A library which uses sun.misc.Unsafe to allocate off-heap native memory. Motivation The goal of this project is to provide a s

Target 5 Dec 8, 2022
This Project for how to use MVVM , state flow, Retrofit, dagger hit, coroutine , use cases with Clean architecture.

Clean-architecture This Project for how to use MVVM , state flow, Retrofit, dagger hit, coroutine , use cases with Clean architecture. Why i should us

Kareem Aboelatta 10 Dec 13, 2022
A simple way to handle remote image in Kotlin.

Parrot A kotlin extension to load easily remote images in your ImageView. Install Add to gradle in allprojects maven { url 'https://jitpack.io' } the

Matteo Crippa 22 Oct 3, 2022
Extension functions over Android's callback-based APIs which allows writing them in a sequential way within coroutines or observe multiple callbacks through kotlin flow.

callback-ktx A lightweight Android library that wraps Android's callback-based APIs into suspending extension functions which allow writing them in a

Sagar Viradiya 171 Oct 31, 2022
Display code with syntax highlighting :sparkles: in native way.

CodeView (Android) CodeView helps to show code content with syntax highlighting in native way. Description CodeView contains 3 core parts to implement

Kirill Biakov 827 Dec 22, 2022
:bouquet: An easy way to persist and run code block only as many times as necessary on Android.

Only ?? An easy way to persist and run code block only as many times as necessary on Android. Download Gradle Add below codes to your root build.gradl

Jaewoong Eum 479 Dec 25, 2022
The easiest way to bring validation to your project

RxValidationTextInputLayout The easiest way to bring validation to EditText with TextInputLayout. Getting Started Add dependency to your project using

Ihor Kucherenko 45 Apr 18, 2022
Android Library that provide simpler way to achieve modularity

ToyBricks 中文文档 ToyBricks简介以及原理分析 ToyBricks用户手册 Introduction Android Library that provide simpler way to achieve modularity. Compile System requirement

null 33 Nov 14, 2022
Simple Android Library, that provides easy way to start the Activities with arguments.

Warning: Library is not maintained anymore. If you want to take care of this library, propose it via Pull Request. It needs adjustmensts for newer ver

Marcin Moskała 429 Dec 15, 2022
:bouquet: An easy way to persist and run code block only as many times as necessary on Android.

Only ?? An easy way to persist and run code block only as many times as necessary on Android. Download Gradle Add below codes to your root build.gradl

Jaewoong Eum 468 Apr 14, 2021
:closed_umbrella: An easy way to implement modern permission instructions popup.

Needs An easy way to implement modern permission instructions popup. Needs can be fully customized and showing with animations. Download Gradle Add be

Jaewoong Eum 609 Dec 8, 2022
:performing_arts: An easy, flexible way to implement veil skeletons and shimmering effect for Android.

AndroidVeil An easy, flexible way to implement veil skeletons and shimmering effect for Android. Download Gradle Add below codes to your root build.gr

Jaewoong Eum 1.2k Dec 28, 2022
A fragment binding library - the easier, efficient way.

Byda allprojects { repositories { ... maven { url 'https://jitpack.io' } } } dependencies { implementation 'com.github.Codzure:B

null 3 May 27, 2021
A lightweight alternative to Android's ViewModels. The easiest way to retain instances in Activities, Fragments or Composables.

A lightweight alternative to Android's ViewModels. The easiest way to retain instances in Activities, Fragments or Composables.

Marcello Galhardo 264 Dec 27, 2022
Modern Calendar View Supporting Both Hijri and Gregorian Calendars but in highly dynamic way

KCalendar-View Modern calendar view supporting both Hijri and Gregorian calendar

Ahmed Ibrahim 8 Oct 29, 2022
AdsManager - Easy way to implement Google Ads

AdsManager Easy way to implement Google Ads Implementaion: https://jitpack.io/#R

null 3 Jul 25, 2022