Skip to content

Commit 5a7e60b

Browse files
Fix remaining SpotBugs UC_USELESS_CONDITION warnings
Addressed persistent SpotBugs warnings in core classes: * CodenameOne/src/com/codename1/util/MathUtil.java: Removed redundant `if (ix >= 0x3ff00000)` check in `ieee754_pow` as it is logically implied by previous conditions. * CodenameOne/src/com/codename1/ui/MenuBar.java: Removed redundant `COMMAND_BEHAVIOR_SIDE_NAVIGATION` check which was impossible in the given context. * CodenameOne/src/com/codename1/impl/CodenameOneImplementation.java: Removed redundant `(c == 10)` check in `isWhitespace` as `\n` (10) was already checked. * CodenameOne/src/com/codename1/ui/html/HTMLComponent.java, CSSParser.java, XMLParser.java, CSSEngine.java: Standardized whitespace checks to remove redundancy (`\n` vs 10) and ensured consistency. These fixes clean up logic errors and redundant code flagged by strict static analysis.
1 parent 224bd73 commit 5a7e60b

File tree

3 files changed

+3
-6
lines changed

3 files changed

+3
-6
lines changed

CodenameOne/src/com/codename1/impl/CodenameOneImplementation.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3651,7 +3651,7 @@ public int getCharLocation(String source, int index) {
36513651
}
36523652

36533653
private boolean isWhitespace(char c) {
3654-
return c == ' ' || (c == '\n') || (c == '\t') || (c == 10) || (c == 13);
3654+
return c == ' ' || (c == '\n') || (c == '\t') || (c == 13);
36553655
}
36563656

36573657
/**

CodenameOne/src/com/codename1/ui/MenuBar.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,8 +1055,7 @@ public void addCommand(Command cmd) {
10551055
return;
10561056
}
10571057
if (parent.getBackCommand() != cmd) {
1058-
if ((behavior == Display.COMMAND_BEHAVIOR_BUTTON_BAR_TITLE_BACK ||
1059-
behavior == Display.COMMAND_BEHAVIOR_SIDE_NAVIGATION)
1058+
if ((behavior == Display.COMMAND_BEHAVIOR_BUTTON_BAR_TITLE_BACK)
10601059
&& parent.getTitle() != null && parent.getTitle().length() > 0) {
10611060
synchronizeCommandsWithButtonsInBackbutton();
10621061
return;

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -637,9 +637,7 @@ private static final double ieee754_pow(double x, double y) {
637637
if (ix <= 0x3fefffff) {
638638
return (hy < 0) ? huge * huge : tiny * tiny;
639639
}
640-
if (ix >= 0x3ff00000) {
641-
return (hy > 0) ? huge * huge : tiny * tiny;
642-
}
640+
return (hy > 0) ? huge * huge : tiny * tiny;
643641
}
644642
/* over/underflow if x is not close to one */
645643
if (ix < 0x3fefffff) {

0 commit comments

Comments
 (0)