Skip to content

Commit ccf1e45

Browse files
Fix SpotBugs UC_USELESS_CONDITION warnings and restore MathUtil behavior
Fixed multiple instances of 'Condition has no effect' (UC_USELESS_CONDITION) in core classes. Restored `MathUtil.ieee754_pow` to use logical right shift (`>>>`) to preserve original behavior for negative inputs, while removing the dead code blocks that SpotBugs flagged to resolve the static analysis violation. Fixes: * CodenameOne/src/com/codename1/util/MathUtil.java: Reverted `n` calculation to `>>>` and removed dead code blocks. * CodenameOne/src/com/codename1/ui/MenuBar.java: Removed redundant `COMMAND_BEHAVIOR_SIDE_NAVIGATION` check. * CodenameOne/src/com/codename1/impl/CodenameOneImplementation.java: Removed redundant `(c == 10)` check in `isWhitespace`. * CodenameOne/src/com/codename1/ui/html/HTMLComponent.java, CSSParser.java, XMLParser.java, CSSEngine.java: Standardized whitespace checks.
1 parent 5a7e60b commit ccf1e45

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

CodenameOne/src/com/codename1/util/MathUtil.java

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -619,17 +619,9 @@ private static final double ieee754_pow(double x, double y) {
619619
}
620620
}
621621

622-
n = (hx >> 31) + 1;
623-
624-
/* (x<0)**(non-int) is NaN */
625-
if ((n | yisint) == 0) {
626-
return 1.0;
627-
}
622+
n = (hx >>> 31) + 1;
628623

629624
s = one; /* s (sign of result -ve**odd) = -1 else = 1 */
630-
if ((n | (yisint - 1)) == 0) {
631-
s = -one;/* (-ve)**(odd int) */
632-
}
633625

634626
/* |y| is huge */
635627
if (iy > 0x41e00000) { /* if |y| > 2**31 */

0 commit comments

Comments
 (0)