From b20b55a264eff1a6261ca967a242ebc494a1b6ae Mon Sep 17 00:00:00 2001 From: Sujit Kumar Date: Fri, 1 Apr 2022 15:28:43 +0530 Subject: [PATCH 1/2] Fixed documentation issue by adding parenthesis `()` to the negative odd check message --- CHANGELOG.md | 1 + spotbugs/etc/messages.xml | 2 +- spotbugs/etc/messages_fr.xml | 2 +- spotbugs/etc/messages_ja.xml | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 596a4199993..bac5082416c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ Currently the versioning policy of this project follows [Semantic Versioning v2. ### 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)) +- Fixed documentation issue by adding parenthesis `()` to the negative odd check message ([#1995](https://github.com/spotbugs/spotbugs/issues/1995)) ### Added * New detector `ThrowingExceptions` and introduced new bug types: 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 が