Skip to content

Fixup bad ANDROIDLINT Automatic Fix#42694

Closed
NickGerleman wants to merge 1 commit into
react:mainfrom
NickGerleman:export-D53158801
Closed

Fixup bad ANDROIDLINT Automatic Fix#42694
NickGerleman wants to merge 1 commit into
react:mainfrom
NickGerleman:export-D53158801

Conversation

@NickGerleman

Copy link
Copy Markdown
Contributor

Summary:
D53115471 commited all the automatically fixable lints by ANDROIDLINT. When I looked again, closer, there was one automatic fix that I'm fairly sure is incorrect.

Before:

outTransform.postTranslate((int) (dx + 0.5f), (int) (dy + 0.5f));

After:

outTransform.postTranslate((dx + 0.5f), (dy + 0.5f));

I think the linter did this because the underlying API accepts a float, so this was (incorrectly) seen as an extraneous cast causing precision loss, but the previous behavior was using the cast and addition to round the float, instead of adding 0.5 to it.

This replaces the call with an explicit rounding, for the same behavior as before (though, I'm not sure if the rounding is intentional, since in and out are both fp).

Changelog: [Internal]

Differential Revision: D53158801

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jan 27, 2024
@facebook-github-bot

Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D53158801

@analysis-bot

analysis-bot commented Jan 27, 2024

Copy link
Copy Markdown
Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 17,066,838 +11
android hermes armeabi-v7a n/a --
android hermes x86 n/a --
android hermes x86_64 n/a --
android jsc arm64-v8a 20,450,437 -9
android jsc armeabi-v7a n/a --
android jsc x86 n/a --
android jsc x86_64 n/a --

Base commit: 5d559c1
Branch: main

Summary:

D53115471 commited all the automatically fixable lints by `ANDROIDLINT`. When I looked again, closer, there was one automatic fix that I'm fairly sure is incorrect.

Before:

`outTransform.postTranslate((int) (dx + 0.5f), (int) (dy + 0.5f));`

After:

`outTransform.postTranslate((dx + 0.5f), (dy + 0.5f));`

I think the linter did this because the underlying API accepts a float, so this was (incorrectly) seen as an extraneous cast causing precision loss, but the previous behavior was using the cast and addition to round the float, instead of adding 0.5 to it.

This replaces the call with an explicit rounding, for the same behavior as before (though, I'm not sure if the rounding is intentional, since in and out are both fp).


Changelog: [Internal]

Reviewed By: joevilches

Differential Revision: D53158801
@facebook-github-bot

Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D53158801

@facebook-github-bot

Copy link
Copy Markdown
Contributor

This pull request has been merged in 3a789a1.

@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Jan 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported Merged This PR has been merged. p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants