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

Remove spot bug type DM_BOXED_PRIMITIVE_FOR_COMPARE #6057

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

tobiasKaminsky
Copy link
Member

@tobiasKaminsky tobiasKaminsky commented May 12, 2020

Tried to remove it.
Then found out that Long.compare(…) is API 19+.

  • Let us see if this is recognized

Signed-off-by: tobiasKaminsky [email protected]

Testing

Writing tests is very important. Please try to write some tests for your PR.
If you need help, please do not hesitate to ask in this PR for help.

unit tests
instrumented tests
UI tests

  • Tests written, or not not needed

@nextcloud-android-bot
Copy link
Collaborator

@nextcloud-android-bot
Copy link
Collaborator

APK file: https://www.kaminsky.me/nc-dev/android-artifacts/13908.apk

qrcode

To test this change/fix you can simply download above APK file and install and test it in parallel to your existing Nextcloud app.

@nextcloud-android-bot
Copy link
Collaborator

Codacy

377

Lint

TypemasterPR
Warnings9494
Errors00

SpotBugs (new)

Warning TypeNumber
Bad practice Warnings26
Correctness Warnings68
Internationalization Warnings9
Malicious code vulnerability Warnings4
Multithreaded correctness Warnings9
Performance Warnings70
Security Warnings44
Dodgy code Warnings138
Total368

SpotBugs (master)

Warning TypeNumber
Bad practice Warnings26
Correctness Warnings68
Internationalization Warnings9
Malicious code vulnerability Warnings4
Multithreaded correctness Warnings9
Performance Warnings75
Security Warnings44
Dodgy code Warnings138
Total373

@nextcloud-android-bot
Copy link
Collaborator

@tobiasKaminsky
Copy link
Member Author

@ezaquarii
I tested this with API17 and it works, but
https://developer.android.com/reference/java/lang/Long?hl=en#compare(long,%20long)
shows that it was only added in API19.

Also Lint does not complain, but I do not understand why this works…?

@ezaquarii
Copy link
Collaborator

ezaquarii commented May 13, 2020

I tested this with API17 and it works, but
https://developer.android.com/reference/java/lang/Long?hl=en#compare(long,%20long)
shows that it was only added in API19.

@tobiasKaminsky
Runtime might be lacking this API, but the d8 might be inlining it, so it compares numbers in place without invoking any API at all. One would need to look at the DEX bytecode to be sure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants