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

toStringHex and toStringBinary strip off leading zeros #273

Closed
soc opened this issue Oct 28, 2021 · 1 comment
Closed

toStringHex and toStringBinary strip off leading zeros #273

soc opened this issue Oct 28, 2021 · 1 comment

Comments

@soc
Copy link
Contributor

soc commented Oct 28, 2021

They weren't stripped off originally, but that was changed in 78d0f06#diff-2e8fd6fa1728464bf16d731d758169acdbb204b74b6df173d91992d442e60524.

I did the original approach intentionally, because I felt that stripping of zeroes made it hard to visually compare different numbers in that format.

Now it turns out that it's not only a convenience, but that stripping off zeroes leads to bugs and other languages have added special lints for such APIs, see https://rules.sonarsource.com/java/RSPEC-4425.

I'd propose changing back to the previous behavior.

@soc
Copy link
Contributor Author

soc commented Feb 4, 2022

@dinfuehr any objections against changing it back?

@soc soc closed this as completed Apr 6, 2022
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

No branches or pull requests

1 participant