diff --git a/CHANGELOG.md b/CHANGELOG.md index 5ddab40..411d203 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## [2.0.1] + +### Fixed + +- Android crash when evaluating function calls (`ln(1)`, `cos(0)`, …): `Tokenizer` used `MutableList.removeLast()`, which can resolve to `java.util.List.removeLast()` (Android 15 / API 35+) and throw `NoSuchMethodError` on older devices. Replaced with `removeAt(lastIndex)`. ([#68](https://github.com/notKamui/Keval/issues/68)) + ## [2.0.0] ### Added diff --git a/README.md b/README.md index fe03fdd..c1d57a7 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ Maven com.notkamui.libs keval - 2.0.0 + 2.0.1 ``` @@ -33,7 +33,7 @@ repositories { } dependencies { - implementation("com.notkamui.libs:keval:2.0.0") + implementation("com.notkamui.libs:keval:2.0.1") } ``` diff --git a/build.gradle.kts b/build.gradle.kts index c7de0da..df9693d 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -15,7 +15,7 @@ plugins { val artifactId = "keval" group = "com.notkamui.libs" -version = "2.0.0" +version = "2.0.1" repositories { mavenCentral() diff --git a/src/commonMain/kotlin/com/notkamui/keval/Tokenizer.kt b/src/commonMain/kotlin/com/notkamui/keval/Tokenizer.kt index a9a1886..1a11f0b 100644 --- a/src/commonMain/kotlin/com/notkamui/keval/Tokenizer.kt +++ b/src/commonMain/kotlin/com/notkamui/keval/Tokenizer.kt @@ -50,7 +50,9 @@ private fun Sequence.normalizeTokens( token == ")" -> TokenType.RPAREN.also { if (functionAtCount.last() == parenthesesCount) { - functionAtCount.removeLast() + // Avoid removeLast(): it can bind to java.util.List.removeLast (API 35+) + // and crash with NoSuchMethodError on older Android when closing a function call. + functionAtCount.removeAt(functionAtCount.lastIndex) } parenthesesCount -= 1 ret.add(token)