Skip to content

Commit

Permalink
docs: Updated documentation to use parenthesis in x & 1 - Issue #…
Browse files Browse the repository at this point in the history
…1995 (#2002)

* Fixed documentation issue by adding parenthesis `()` to the negative odd check message

* updated CHANGELOG.md

Co-authored-by: Sujit Kumar <Sujit_Kumar@gap.com>
  • Loading branch information
4sujittiwari and Sujit Kumar committed Apr 7, 2022
1 parent b1de30c commit f6adc7d
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
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

0 comments on commit f6adc7d

Please sign in to comment.