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

Updated documentation to use parenthesis in x & 1 - Issue #1995 #2002

Merged
merged 2 commits into from Apr 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Expand Up @@ -5,6 +5,9 @@ This is the changelog for SpotBugs. This follows [Keep a Changelog v1.0.0](http:
Currently the versioning policy of this project follows [Semantic Versioning v2.0.0](http://semver.org/spec/v2.0.0.html).

## Unreleased - 2022-??-??
### Changed
- Updated documentation by adding parenthesis `()` to the negative odd check message ([#1995](https://github.com/spotbugs/spotbugs/issues/1995))

### Fixed
- Bumped Saxon-HE from 10.6 to 11.3 ([#1955](https://github.com/spotbugs/spotbugs/pull/1955), [#1999](https://github.com/spotbugs/spotbugs/pull/1999))
- Fixed traversal of nested archives governed by `-nested:true` ([#1930](https://github.com/spotbugs/spotbugs/pull/1930))
Expand Down
2 changes: 1 addition & 1 deletion spotbugs/etc/messages.xml
Expand Up @@ -7758,7 +7758,7 @@ publicized the bug pattern</a>.
<p>
The code uses x % 2 == 1 to check to see if a value is odd, but this won't work
for negative numbers (e.g., (-5) % 2 == -1). If this code is intending to check
for oddness, consider using x &amp; 1 == 1, or x % 2 != 0.
for oddness, consider using (x &amp; 1) == 1, or x % 2 != 0.
</p>
]]>
</Details>
Expand Down
2 changes: 1 addition & 1 deletion spotbugs/etc/messages_fr.xml
Expand Up @@ -3253,7 +3253,7 @@ double value2 = x / (double) y;
<LongDescription>Un test d'impaire ne fonctionnera pas avec les négatifs dans {1}</LongDescription>
<Details>
<![CDATA[
<p>Le code utilise <code>x % 2 == 1</code> pour véifier si une valeur est impaire, mais cela ne fonctionera pas avec une valeur négative (Ex. : <code>(-5) % 2 == -1</code>). Si ce code doit tester si une valeur est impaire, envisagez d'utiliser <code>x & 1 == 1</code> ou <code>x % 2 != 0</code>.</p>
<p>Le code utilise <code>x % 2 == 1</code> pour véifier si une valeur est impaire, mais cela ne fonctionera pas avec une valeur négative (Ex. : <code>(-5) % 2 == -1</code>). Si ce code doit tester si une valeur est impaire, envisagez d'utiliser <code>(x & 1) == 1</code> ou <code>x % 2 != 0</code>.</p>
]]>
</Details>
</BugPattern>
Expand Down
2 changes: 1 addition & 1 deletion spotbugs/etc/messages_ja.xml
Expand Up @@ -8272,7 +8272,7 @@ Joshua Bloch が <a href="http://googleresearch.blogspot.com/2006/06/extra-extra
<![CDATA[
<p>
このコードは <code>x % 2 == 1</code> を使用して値が負数なのか確かめていますが,負数 (たとえば, <code>(-5) % 2 == -1</code>) なので機能しません。
奇数チェックを意図しているなら, <code>x &amp; 1 == 1</code> または <code>x % 2 != 0</code> を使用することを検討してください。
奇数チェックを意図しているなら, <code>(x &amp; 1) == 1</code> または <code>x % 2 != 0</code> を使用することを検討してください。
</p>
]]>
</Details>
Expand Down