aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2025-01-04 12:51:16 +0100
committerLinnea Gräf <nea@nea.moe>2025-01-04 12:51:16 +0100
commitec79cfcdc90ac7c526a288cdb37383632b55fea2 (patch)
treece48b6dbaa1e78560fa950b25041c4c62ce2dcc2
parentb5af1a4a4bc467dcf969a50f6e55f42026804105 (diff)
downloadLocalTransactionLedger-ec79cfcdc90ac7c526a288cdb37383632b55fea2.tar.gz
LocalTransactionLedger-ec79cfcdc90ac7c526a288cdb37383632b55fea2.tar.bz2
LocalTransactionLedger-ec79cfcdc90ac7c526a288cdb37383632b55fea2.zip
fix: Overaggressive method stripping
-rw-r--r--ledger-rules.pro3
-rw-r--r--src/main/kotlin/moe/nea/ledger/ItemId.kt5
-rw-r--r--src/main/kotlin/moe/nea/ledger/utils/NoSideEffects.java8
3 files changed, 15 insertions, 1 deletions
diff --git a/ledger-rules.pro b/ledger-rules.pro
index 2d8459e..32cd337 100644
--- a/ledger-rules.pro
+++ b/ledger-rules.pro
@@ -1,3 +1,4 @@
-keep class !moe.nea.ledger.gen.** {*;}
-dontobfuscate
--assumenosideeffects class moe.nea.ledger.ItemId { *; } \ No newline at end of file
+-assumenosideeffects class ** { @moe.nea.ledger.utils.NoSideEffects <methods>; }
+#-dontoptimize
diff --git a/src/main/kotlin/moe/nea/ledger/ItemId.kt b/src/main/kotlin/moe/nea/ledger/ItemId.kt
index ade63fb..8211cd3 100644
--- a/src/main/kotlin/moe/nea/ledger/ItemId.kt
+++ b/src/main/kotlin/moe/nea/ledger/ItemId.kt
@@ -1,12 +1,16 @@
package moe.nea.ledger
+import moe.nea.ledger.utils.NoSideEffects
+
data class ItemId(
val string: String
) {
+ @NoSideEffects
fun singleItem(): Pair<ItemId, Double> {
return withStackSize(1)
}
+ @NoSideEffects
fun withStackSize(size: Number): Pair<ItemId, Double> {
return Pair(this, size.toDouble())
}
@@ -15,6 +19,7 @@ data class ItemId(
companion object {
@JvmStatic
+ @NoSideEffects
fun forName(string: String) = ItemId(string)
fun skill(skill: String) = ItemId("SKYBLOCK_SKILL_$skill")
diff --git a/src/main/kotlin/moe/nea/ledger/utils/NoSideEffects.java b/src/main/kotlin/moe/nea/ledger/utils/NoSideEffects.java
new file mode 100644
index 0000000..f432130
--- /dev/null
+++ b/src/main/kotlin/moe/nea/ledger/utils/NoSideEffects.java
@@ -0,0 +1,8 @@
+package moe.nea.ledger.utils;
+
+import kotlin.annotation.AnnotationRetention;
+import kotlin.annotation.Retention;
+
+@Retention(AnnotationRetention.BINARY)
+public @interface NoSideEffects {
+}