diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
index 3c07d95a..f0001621 100644
--- a/.idea/inspectionProfiles/Project_Default.xml
+++ b/.idea/inspectionProfiles/Project_Default.xml
@@ -1,10 +1,19 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.travis.yml b/.travis.yml
index e7d256fd..dca7bf36 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -17,6 +17,7 @@ before_install:
script:
- ./gradlew clean :persistence:test :properties:test :sql:test :fx-bindings:test :android-bindings:test --info --stacktrace
+# - ./gradlew clean :persistence:test :properties:test :sql:test :fx-bindings:test :android-bindings:test :persistence:bintrayUpload :properties:bintrayUpload :android-bindings:bintrayUpload
#after_success:
# - java -jar ~/codacy-coverage-reporter-assembly-latest.jar report -l Java -r properties/build/reports/jacoco/test/jacocoTestReport.xml
diff --git a/properties/src/main/kotlin/net/aquadc/properties/internal/BiMapped-.kt b/properties/src/main/kotlin/net/aquadc/properties/internal/BiMapped-.kt
index c65ade02..fcff980d 100644
--- a/properties/src/main/kotlin/net/aquadc/properties/internal/BiMapped-.kt
+++ b/properties/src/main/kotlin/net/aquadc/properties/internal/BiMapped-.kt
@@ -33,16 +33,18 @@ internal class `BiMapped-`(
}
@JvmSynthetic internal fun update(idx: Int, value: Any?) {
+ var prevValue: T
var prev: Array
var next: Array
do {
prev = ref as Array
- next = prev.clone() // todo: don't even clone for single-thread properties
+ prevValue = prev[2] as T
+ next = if (isConcurrent) prev.clone() else prev
next[idx] = value
next[2] = transform(next[0] as A, next[1] as B)
} while (!refUpdater().eagerOrLazyCas(this, thread, prev, next))
- valueChanged(prev[2] as T, next[2] as T, null)
+ valueChanged(prevValue, next[2] as T, null)
}
override fun observedStateChanged(observed: Boolean) {
diff --git a/properties/src/main/kotlin/net/aquadc/properties/internal/MultiMapped-.kt b/properties/src/main/kotlin/net/aquadc/properties/internal/MultiMapped-.kt
index 491e6de3..609eb08d 100644
--- a/properties/src/main/kotlin/net/aquadc/properties/internal/MultiMapped-.kt
+++ b/properties/src/main/kotlin/net/aquadc/properties/internal/MultiMapped-.kt
@@ -33,17 +33,18 @@ internal class `MultiMapped-`(
}
@JvmSynthetic internal fun patch(index: Int, new: A) {
+ var prevValue: T
var oldVals: Array
var newVals: Array
-
do {
oldVals = ref as Array
- newVals = oldVals.clone() // todo: don't even clone for single-thread properties
+ prevValue = oldVals.last() as T
+ newVals = if (isConcurrent) oldVals.clone() else oldVals
newVals[index] = new
newVals[newVals.size - 1] = transform(SmallerList(newVals) as List)
} while (!cas(oldVals, newVals))
- valueChanged(oldVals.last() as T, newVals.last() as T, null)
+ valueChanged(prevValue, newVals.last() as T, null)
}
private fun cas(old: Any?, new: Any?): Boolean = if (thread === null) {