Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Maven
<dependency>
<groupId>com.notkamui.libs</groupId>
<artifactId>keval</artifactId>
<version>2.0.0</version>
<version>2.0.1</version>
</dependency>
</dependencies>
```
Expand All @@ -33,7 +33,7 @@ repositories {
}

dependencies {
implementation("com.notkamui.libs:keval:2.0.0")
implementation("com.notkamui.libs:keval:2.0.1")
}
```

Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ plugins {

val artifactId = "keval"
group = "com.notkamui.libs"
version = "2.0.0"
version = "2.0.1"

repositories {
mavenCentral()
Expand Down
4 changes: 3 additions & 1 deletion src/commonMain/kotlin/com/notkamui/keval/Tokenizer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ private fun <N> Sequence<String>.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)
Expand Down
Loading