Skip to content

Commit

Permalink
Fix invalid method mapping in compileSdk 35
Browse files Browse the repository at this point in the history
Citing the documentation:

```
The List type in Java is mapped to the MutableList type in Kotlin. Because the List.removeFirst() and List.removeLast() APIs have been introduced in Android 15 (API level 35), the Kotlin compiler resolves function calls, for example list.removeFirst(), statically to the new List APIs instead of to the extension functions in kotlin-stdlib.

If an app is re-compiled with compileSdk set to 35 and minSdk set to 34 or lower, and then the app is run on Android 14 and lower, a runtime error is thrown:
```

https://developer.android.com/about/versions/15/behavior-changes-15
  • Loading branch information
wzieba committed Jan 17, 2025
1 parent ae8efae commit 3234739
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,9 @@ class CommentSqlUtilsTest {
val commentsInDb = generateCommentModels(60, ALL)
val remoteComments = generateCommentModels(30, ALL)

remoteComments.removeLast()
remoteComments.removeLast()
remoteComments.removeLast()
remoteComments.removeAt(remoteComments.lastIndex)
remoteComments.removeAt(remoteComments.lastIndex)
remoteComments.removeAt(remoteComments.lastIndex)

commentsInDb.forEach {
CommentSqlUtils.insertOrUpdateComment(it)
Expand Down Expand Up @@ -239,9 +239,9 @@ class CommentSqlUtilsTest {
val remoteComments = generateCommentModels(50, ALL)

// exclude first 3 comments
remoteComments.removeFirst()
remoteComments.removeFirst()
remoteComments.removeFirst()
remoteComments.removeAt(0)
remoteComments.removeAt(0)
remoteComments.removeAt(0)

commentsInDb.forEach {
CommentSqlUtils.insertOrUpdateComment(it)
Expand Down

0 comments on commit 3234739

Please sign in to comment.