diff --git a/CHANGELOG.md b/CHANGELOG.md index 596a4199993..751e3e021bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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)) diff --git a/spotbugs/etc/messages.xml b/spotbugs/etc/messages.xml index 7822b4d8bbd..7b9b1721424 100644 --- a/spotbugs/etc/messages.xml +++ b/spotbugs/etc/messages.xml @@ -7758,7 +7758,7 @@ publicized the bug pattern.

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 & 1 == 1, or x % 2 != 0. +for oddness, consider using (x & 1) == 1, or x % 2 != 0.

]]> diff --git a/spotbugs/etc/messages_fr.xml b/spotbugs/etc/messages_fr.xml index 424ac1cae4d..193afc81af8 100644 --- a/spotbugs/etc/messages_fr.xml +++ b/spotbugs/etc/messages_fr.xml @@ -3253,7 +3253,7 @@ double value2 = x / (double) y; Un test d'impaire ne fonctionnera pas avec les négatifs dans {1}
Le code utilise x % 2 == 1 pour véifier si une valeur est impaire, mais cela ne fonctionera pas avec une valeur négative (Ex. : (-5) % 2 == -1). Si ce code doit tester si une valeur est impaire, envisagez d'utiliser x & 1 == 1 ou x % 2 != 0.

+

Le code utilise x % 2 == 1 pour véifier si une valeur est impaire, mais cela ne fonctionera pas avec une valeur négative (Ex. : (-5) % 2 == -1). Si ce code doit tester si une valeur est impaire, envisagez d'utiliser (x & 1) == 1 ou x % 2 != 0.

]]>
diff --git a/spotbugs/etc/messages_ja.xml b/spotbugs/etc/messages_ja.xml index 5042884ec55..d024cac26be 100644 --- a/spotbugs/etc/messages_ja.xml +++ b/spotbugs/etc/messages_ja.xml @@ -8272,7 +8272,7 @@ Joshua Bloch が