atomicfu-compiler-plugin: support declaration of properties in objects for JVM IR
Fix: https://github.com/Kotlin/kotlinx-atomicfu/issues/241 Merge-request: KT-MR-6871 Merged-by: Maria Sokolova <maria.sokolova@jetbrains.com>
This commit is contained in:
@@ -5,6 +5,7 @@ public final class DelegatedProperties$A {
|
||||
public method <init>(@org.jetbrains.annotations.NotNull p0: DelegatedProperties$B): void
|
||||
public final @org.jetbrains.annotations.NotNull method getB(): DelegatedProperties$B
|
||||
public final inner class DelegatedProperties$A
|
||||
public final inner class DelegatedProperties$B
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
import kotlinx.atomicfu.*
|
||||
import kotlin.test.*
|
||||
import kotlin.random.*
|
||||
|
||||
object Provider {
|
||||
val port = atomic(Random.nextInt(20, 90) * 100)
|
||||
fun next(): Int = port.incrementAndGet()
|
||||
|
||||
private val _l = atomic(2424920024888888848)
|
||||
fun getL() = _l.incrementAndGet()
|
||||
|
||||
val _ref = atomic<String?>(null)
|
||||
|
||||
val _x = atomic(false)
|
||||
|
||||
val intArr = AtomicIntArray(10)
|
||||
val longArr = AtomicLongArray(10)
|
||||
val refArr = atomicArrayOfNulls<Any?>(5)
|
||||
}
|
||||
|
||||
object DelegatedProvider {
|
||||
val _a = atomic(42)
|
||||
var a: Int by _a
|
||||
|
||||
var vInt by atomic(77)
|
||||
}
|
||||
|
||||
private fun testFieldInObject() {
|
||||
val port = Provider.next()
|
||||
assertEquals(port + 1, Provider.next())
|
||||
|
||||
assertEquals(2424920024888888849, Provider.getL())
|
||||
|
||||
Provider._ref.compareAndSet(null, "abc")
|
||||
assertEquals("abc", Provider._ref.value)
|
||||
|
||||
assertFalse(Provider._x.value)
|
||||
|
||||
Provider.intArr[8].value = 454
|
||||
assertEquals(455, Provider.intArr[8].incrementAndGet())
|
||||
|
||||
Provider.longArr[8].value = 4544096409680468
|
||||
assertEquals(4544096409680470, Provider.longArr[8].addAndGet(2))
|
||||
|
||||
Provider.refArr[1].value = Provider._ref.value
|
||||
assertEquals("abc", Provider.refArr[1].value)
|
||||
}
|
||||
|
||||
private fun testDelegatedPropertiesInObject() {
|
||||
assertEquals(42, DelegatedProvider.a)
|
||||
DelegatedProvider._a.compareAndSet(42, 56)
|
||||
assertEquals(56, DelegatedProvider.a)
|
||||
DelegatedProvider.a = 77
|
||||
DelegatedProvider._a.compareAndSet(77, 66)
|
||||
assertEquals(66, DelegatedProvider._a.value)
|
||||
assertEquals(66, DelegatedProvider.a)
|
||||
|
||||
assertEquals(77, DelegatedProvider.vInt)
|
||||
DelegatedProvider.vInt = 55
|
||||
assertEquals(110, DelegatedProvider.vInt * 2)
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
testFieldInObject()
|
||||
testDelegatedPropertiesInObject()
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
@kotlin.Metadata
|
||||
public final class DelegatedProvider$_a$DelegatedProvider$VolatileWrapper {
|
||||
// source: 'FieldInObjectTest.kt'
|
||||
private final static @org.jetbrains.annotations.NotNull field _a$FU: java.util.concurrent.atomic.AtomicIntegerFieldUpdater
|
||||
private volatile @kotlin.jvm.Volatile field _a: int
|
||||
static method <clinit>(): void
|
||||
public method <init>(): void
|
||||
public synthetic final static method access$get_a$p(p0: DelegatedProvider$_a$DelegatedProvider$VolatileWrapper): int
|
||||
public synthetic final static method access$set_a$p(p0: DelegatedProvider$_a$DelegatedProvider$VolatileWrapper, p1: int): void
|
||||
public final static @org.jetbrains.annotations.NotNull method get_a$FU(): java.util.concurrent.atomic.AtomicIntegerFieldUpdater
|
||||
public final method get_a(): int
|
||||
public final inner class DelegatedProvider$_a$DelegatedProvider$VolatileWrapper
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class DelegatedProvider {
|
||||
// source: 'FieldInObjectTest.kt'
|
||||
public final static @org.jetbrains.annotations.NotNull field INSTANCE: DelegatedProvider
|
||||
public final static @org.jetbrains.annotations.NotNull field _a$DelegatedProvider$VolatileWrapper: DelegatedProvider$_a$DelegatedProvider$VolatileWrapper
|
||||
private volatile @kotlin.jvm.Volatile field vInt: int
|
||||
static method <clinit>(): void
|
||||
private method <init>(): void
|
||||
public final method getA(): int
|
||||
public final method getVInt(): int
|
||||
public final static @org.jetbrains.annotations.NotNull method get_a$DelegatedProvider$VolatileWrapper(): DelegatedProvider$_a$DelegatedProvider$VolatileWrapper
|
||||
public final method setA(p0: int): void
|
||||
public final method setVInt(p0: int): void
|
||||
public final inner class DelegatedProvider$_a$DelegatedProvider$VolatileWrapper
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class FieldInObjectTestKt {
|
||||
// source: 'FieldInObjectTest.kt'
|
||||
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
|
||||
private final static method testDelegatedPropertiesInObject(): void
|
||||
private final static method testFieldInObject(): void
|
||||
public final inner class DelegatedProvider$_a$DelegatedProvider$VolatileWrapper
|
||||
public final inner class Provider$_ref$Provider$VolatileWrapper
|
||||
public final inner class Provider$_x$Provider$VolatileWrapper
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class Provider$Port$Provider$VolatileWrapper {
|
||||
// source: 'FieldInObjectTest.kt'
|
||||
private final static @org.jetbrains.annotations.NotNull field port$FU: java.util.concurrent.atomic.AtomicIntegerFieldUpdater
|
||||
private volatile @kotlin.jvm.Volatile field port: int
|
||||
static method <clinit>(): void
|
||||
public method <init>(): void
|
||||
public final static @org.jetbrains.annotations.NotNull method getPort$FU(): java.util.concurrent.atomic.AtomicIntegerFieldUpdater
|
||||
public final method getPort(): int
|
||||
public final inner class Provider$Port$Provider$VolatileWrapper
|
||||
public final inner class kotlin/random/Random$Default
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class Provider$_l$Provider$VolatileWrapper {
|
||||
// source: 'FieldInObjectTest.kt'
|
||||
private final static @org.jetbrains.annotations.NotNull field _l$FU: java.util.concurrent.atomic.AtomicLongFieldUpdater
|
||||
private volatile @kotlin.jvm.Volatile field _l: long
|
||||
static method <clinit>(): void
|
||||
public method <init>(): void
|
||||
public synthetic final static method access$get_l$FU$p(): java.util.concurrent.atomic.AtomicLongFieldUpdater
|
||||
public final inner class Provider$_l$Provider$VolatileWrapper
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class Provider$_ref$Provider$VolatileWrapper {
|
||||
// source: 'FieldInObjectTest.kt'
|
||||
private final static @org.jetbrains.annotations.NotNull field _ref$FU: java.util.concurrent.atomic.AtomicReferenceFieldUpdater
|
||||
private volatile @kotlin.jvm.Volatile @org.jetbrains.annotations.Nullable field _ref: java.lang.Object
|
||||
static method <clinit>(): void
|
||||
public method <init>(): void
|
||||
public final static @org.jetbrains.annotations.NotNull method get_ref$FU(): java.util.concurrent.atomic.AtomicReferenceFieldUpdater
|
||||
public final @org.jetbrains.annotations.Nullable method get_ref(): java.lang.Object
|
||||
public final inner class Provider$_ref$Provider$VolatileWrapper
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class Provider$_x$Provider$VolatileWrapper {
|
||||
// source: 'FieldInObjectTest.kt'
|
||||
private final static @org.jetbrains.annotations.NotNull field _x$FU: java.util.concurrent.atomic.AtomicIntegerFieldUpdater
|
||||
private volatile @kotlin.jvm.Volatile field _x: int
|
||||
static method <clinit>(): void
|
||||
public method <init>(): void
|
||||
public final static @org.jetbrains.annotations.NotNull method get_x$FU(): java.util.concurrent.atomic.AtomicIntegerFieldUpdater
|
||||
public final method get_x(): int
|
||||
public final inner class Provider$_x$Provider$VolatileWrapper
|
||||
}
|
||||
|
||||
@kotlin.Metadata
|
||||
public final class Provider {
|
||||
// source: 'FieldInObjectTest.kt'
|
||||
public final static @org.jetbrains.annotations.NotNull field INSTANCE: Provider
|
||||
public final static @org.jetbrains.annotations.NotNull field _l$Provider$VolatileWrapper: Provider$_l$Provider$VolatileWrapper
|
||||
public final static @org.jetbrains.annotations.NotNull field _ref$Provider$VolatileWrapper: Provider$_ref$Provider$VolatileWrapper
|
||||
public final static @org.jetbrains.annotations.NotNull field _x$Provider$VolatileWrapper: Provider$_x$Provider$VolatileWrapper
|
||||
private final static @org.jetbrains.annotations.NotNull field intArr: java.util.concurrent.atomic.AtomicIntegerArray
|
||||
private final static @org.jetbrains.annotations.NotNull field longArr: java.util.concurrent.atomic.AtomicLongArray
|
||||
public final static @org.jetbrains.annotations.NotNull field port$Provider$VolatileWrapper: Provider$Port$Provider$VolatileWrapper
|
||||
private final static @org.jetbrains.annotations.NotNull field refArr: java.util.concurrent.atomic.AtomicReferenceArray
|
||||
static method <clinit>(): void
|
||||
private method <init>(): void
|
||||
public final static @org.jetbrains.annotations.NotNull method getIntArr(): java.util.concurrent.atomic.AtomicIntegerArray
|
||||
public final method getL(): long
|
||||
public final static @org.jetbrains.annotations.NotNull method getLongArr(): java.util.concurrent.atomic.AtomicLongArray
|
||||
public final static @org.jetbrains.annotations.NotNull method getPort$Provider$VolatileWrapper(): Provider$Port$Provider$VolatileWrapper
|
||||
public final static @org.jetbrains.annotations.NotNull method getRefArr(): java.util.concurrent.atomic.AtomicReferenceArray
|
||||
public final static @org.jetbrains.annotations.NotNull method get_ref$Provider$VolatileWrapper(): Provider$_ref$Provider$VolatileWrapper
|
||||
public final static @org.jetbrains.annotations.NotNull method get_x$Provider$VolatileWrapper(): Provider$_x$Provider$VolatileWrapper
|
||||
public final method next(): int
|
||||
public final inner class Provider$Port$Provider$VolatileWrapper
|
||||
public final inner class Provider$_l$Provider$VolatileWrapper
|
||||
public final inner class Provider$_ref$Provider$VolatileWrapper
|
||||
public final inner class Provider$_x$Provider$VolatileWrapper
|
||||
}
|
||||
+1
@@ -11,6 +11,7 @@ public abstract class InlineExtensionWithTypeParameterTest$Segment {
|
||||
public final class InlineExtensionWithTypeParameterTest$SemaphoreSegment {
|
||||
// source: 'InlineExtensionWithTypeParameterTest.kt'
|
||||
public method <init>(p0: int): void
|
||||
public abstract inner class InlineExtensionWithTypeParameterTest$Segment
|
||||
public final inner class InlineExtensionWithTypeParameterTest$SemaphoreSegment
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user