Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix crash on API <24 and make sure this error will not occur again. #4962

Closed
wants to merge 3 commits into from

Conversation

bmarty
Copy link
Member

@bmarty bmarty commented Jan 17, 2022

Fix crash on API <24 and make sure this error will not occur again.

@github-actions
Copy link

github-actions bot commented Jan 17, 2022

Unit Test Results

  66 files  ±0    66 suites  ±0   1m 7s ⏱️ +6s
135 tests ±0  135 ✔️ ±0  0 💤 ±0  0 ±0 
418 runs  ±0  418 ✔️ ±0  0 💤 ±0  0 ±0 

Results for commit 8f30e84. ± Comparison against base commit ab29a15.

♻️ This comment has been updated with latest results.

@bmarty bmarty force-pushed the feature/bma/1_3_14_crashes branch from 54a2fcf to 8f30e84 Compare January 17, 2022 11:50
@bmarty bmarty changed the title WIP Fix crash on API <24 and make sure this error will not occur again. Jan 17, 2022
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
removeIf(predicate)
} else {
removeAll(filter(predicate).toSet())
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have been asked to convert to Set for performance reason.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as this is only for the keys to remove there shouldn't be any changes for lists with duplicated items?

listOf(1, 1, 2).removeIfCompat { it == 2 }  // would still expect [1, 1] 

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that you say it, I am not sure what will happen with
listOf(1, 1, 2).removeIfCompat { it == 1 } // would still expect [2] but I think we will get [1, 2]
Let me play a bit with it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to work as expected:
image
(https://pl.kotl.in/vIVLDMXe-)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for checking!

@@ -40,6 +40,7 @@
<issue id="RtlSymmetry" severity="error" />

<!-- Code -->
<issue id="NewApi" severity="error" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

@github-actions
Copy link

github-actions bot commented Jan 17, 2022

Matrix SDK

Integration Tests Results:

  • [org.matrix.android.sdk.session]
    passed="21" failures="0" errors="0" skipped="2"
  • [org.matrix.android.sdk.account]
    passed="5" failures="0" errors="0" skipped="2"
  • [org.matrix.android.sdk.internal]
    passed="158" failures="1" errors="0" skipped="38"
  • [org.matrix.android.sdk.ordering]
    passed="1" failures="1" errors="0" skipped="0"
  • [org.matrix.android.sdk.PermalinkParserTest]
    passed="1" failures="1" errors="0" skipped="0"

@bmarty
Copy link
Member Author

bmarty commented Jan 18, 2022

Now included in #4971

@bmarty bmarty closed this Jan 18, 2022
@bmarty bmarty deleted the feature/bma/1_3_14_crashes branch January 19, 2022 13:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants