Skip to content

Conversation

@google-labs-jules
Copy link
Contributor

Fixed SpotBugs "Condition has no effect" (UC_USELESS_CONDITION) warnings in several files and updated the quality report script to fail on these warnings.


PR created automatically by Jules for task 17199185989857704409 started by @shai-almog

Updated .github/scripts/generate-quality-report.py to fail on UC_USELESS_CONDITION.
Fixed UC_USELESS_CONDITION warnings in:
- CodenameOne/src/com/codename1/ui/layouts/mig/Grid.java
- CodenameOne/src/com/codename1/ui/MenuBar.java
- CodenameOne/src/com/codename1/util/MathUtil.java
- CodenameOne/src/com/codename1/impl/CodenameOneImplementation.java
- CodenameOne/src/com/codename1/ui/Component.java
- CodenameOne/src/com/codename1/ui/ComponentGroup.java
- CodenameOne/src/com/codename1/ui/html/CSSEngine.java
- CodenameOne/src/com/codename1/ui/html/CSSParser.java
- CodenameOne/src/com/codename1/ui/html/HTMLComponent.java
- CodenameOne/src/com/codename1/ui/html/ResourceThreadQueue.java
- CodenameOne/src/com/codename1/ui/layouts/mig/UnitValue.java
- CodenameOne/src/com/codename1/util/regex/RECharacter.java
- CodenameOne/src/com/codename1/xml/XMLParser.java
@google-labs-jules
Copy link
Contributor Author

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!


For security, I will only act on instructions from the user who triggered this task.

New to Jules? Learn more at jules.google/docs.

@shai-almog
Copy link
Collaborator

shai-almog commented Dec 26, 2025

Android screenshot updates

Compared 30 screenshots: 29 matched, 1 updated.

  • kotlin — updated screenshot. Screenshot differs (320x616 px, bit depth 8).

    kotlin
    Preview info: Preview provided by instrumentation.
    Full-resolution PNG saved as kotlin.png in workflow artifacts.

Native Android coverage

  • 📊 Line coverage: 24.63% (2638/10711 lines covered) [HTML preview] (artifact android-coverage-report, jacocoAndroidReport/html/index.html)
    • Other counters: instruction 24.14% (12191/50505), branch 15.15% (707/4668), complexity 17.32% (734/4237), method 32.62% (593/1818), class 33.99% (103/303)
    • Lowest covered classes
      • com.codename1.impl.android.com.codename1.impl.android.AndroidContactsManager – 0.00% (0/400 lines covered)
      • com.codename1.impl.android.com.codename1.impl.android.AndroidImplementation$Video – 0.00% (0/168 lines covered)
      • com.codename1.impl.android.com.codename1.impl.android.IntentIntegrator – 0.00% (0/139 lines covered)
      • com.codename1.impl.android.util.com.codename1.impl.android.util.Base64 – 0.00% (0/117 lines covered)
      • com.codename1.impl.android.com.codename1.impl.android.AndroidImplementation$SocketImpl – 0.00% (0/77 lines covered)
      • com.codename1.impl.android.com.codename1.impl.android.AndroidTextureView – 0.00% (0/76 lines covered)
      • com.codename1.impl.android.com.codename1.impl.android.AndroidSurfaceView – 0.00% (0/73 lines covered)
      • com.codename1.impl.android.com.codename1.impl.android.LocalNotificationPublisher – 0.00% (0/65 lines covered)
      • com.codename1.impl.android.com.codename1.impl.android.FridaDetectionUtil – 0.00% (0/64 lines covered)
      • com.codename1.impl.android.com.codename1.impl.android.PushNotificationService – 0.00% (0/59 lines covered)

@shai-almog
Copy link
Collaborator

shai-almog commented Dec 26, 2025

iOS screenshot updates

Compared 30 screenshots: 23 matched, 6 updated, 1 missing reference.

  • BrowserComponent — updated screenshot. Screenshot differs (1206x2622 px, bit depth 8).

    BrowserComponent
    Preview info: Preview provided by instrumentation.
    Full-resolution PNG saved as BrowserComponent.png in workflow artifacts.

  • graphics-draw-arc — updated screenshot. Screenshot differs (1206x2622 px, bit depth 8).

    graphics-draw-arc
    Preview info: JPEG preview quality 20; JPEG preview quality 20; downscaled to 603x1311.
    Full-resolution PNG saved as graphics-draw-arc.png in workflow artifacts.

  • graphics-draw-gradient — updated screenshot. Screenshot differs (1206x2622 px, bit depth 8).

    graphics-draw-gradient
    Preview info: JPEG preview quality 10; JPEG preview quality 10; downscaled to 844x1835.
    Full-resolution PNG saved as graphics-draw-gradient.png in workflow artifacts.

  • graphics-draw-round-rect — missing reference. Reference screenshot missing at /Users/runner/work/CodenameOne/CodenameOne/scripts/ios/screenshots/graphics-draw-round-rect.png.

    graphics-draw-round-rect
    Preview info: JPEG preview quality 10; JPEG preview quality 10; downscaled to 844x1835.
    Full-resolution PNG saved as graphics-draw-round-rect.png in workflow artifacts.

  • graphics-draw-string — updated screenshot. Screenshot differs (1206x2622 px, bit depth 8).

    graphics-draw-string
    Preview info: JPEG preview quality 10; JPEG preview quality 10; downscaled to 422x918.
    Full-resolution PNG saved as graphics-draw-string.png in workflow artifacts.

  • graphics-draw-string-decorated — updated screenshot. Screenshot differs (1206x2622 px, bit depth 8).

    graphics-draw-string-decorated
    Preview info: JPEG preview quality 10; JPEG preview quality 10; downscaled to 603x1311.
    Full-resolution PNG saved as graphics-draw-string-decorated.png in workflow artifacts.

  • kotlin — updated screenshot. Screenshot differs (1206x2622 px, bit depth 8).

    kotlin
    Preview info: Preview provided by instrumentation.
    Full-resolution PNG saved as kotlin.png in workflow artifacts.

Benchmark Results

  • VM Translation Time: 362 seconds
  • Compilation Time: 72 seconds

Detailed Performance Metrics

Metric Duration
Build Time Statistics
Setup & Unzip 37543 ms
Extract Extensions 51 ms
Google Services Setup 4 ms
Scan Classes 1014 ms
Extract Libs 1105 ms
Inject Build Hints 79 ms
Generate Unit Tests 7 ms
Generate Stubs 2992 ms
Compile Stubs 3918 ms
Generate Icons 1794 ms
Prepare ParparVM 247 ms
ParparVM Execution 210010 ms
Post-VM Setup 281 ms
CocoaPods 5037 ms
Finalize 29 ms
Total Time 264111 msMaven Overhead : 98000 ms
CocoaPods Install (Script) 2000 ms
Simulator Boot (Run) 56000 ms
App Install 31000 ms
App Launch 13000 ms
Test Execution 172000 ms

Fixed multiple occurrences of UC_USELESS_CONDITION warnings across 13 files.
Updated .github/scripts/generate-quality-report.py to fail on this violation.

Notable fixes:
- CSSParser.java: Fixed char to byte cast comparison that caused premature EOF on extended ASCII.
- ResourceThreadQueue.java: Fixed variable shadowing and added volatile to cancelled flag.
- UnitValue.java: Fixed condition checking operation type.
- XMLParser.java: Used Character.toLowerCase instead of manual range check.
- Various cleanups in Grid.java, MenuBar.java, Component.java, etc.
Fixed UC_USELESS_CONDITION warnings across 13 files and resolved a compilation error in ComponentGroup.java.
Updated .github/scripts/generate-quality-report.py to fail on this violation.

Notable fixes:
- ComponentGroup.java: Added missing import for Layout class.
- CSSParser.java: Fixed char to byte cast comparison that caused premature EOF on extended ASCII.
- ResourceThreadQueue.java: Fixed variable shadowing and added volatile to cancelled flag.
- UnitValue.java: Fixed condition checking operation type.
- XMLParser.java: Used Character.toLowerCase instead of manual range check.
- Various cleanups in Grid.java, MenuBar.java, Component.java, etc.
Resolves "Condition has no effect" warnings in:
- HTMLComponent.java (Redundant SUPPORT_CSS check, fix variable shadowing)
- CSSEngine.java (Redundant indent >= 0 check)
- CSSParser.java (Incorrect EOF check for char)
- RECharacter.java (Duplicate whitespace check)
- Updated generate-quality-report.py to enforce this rule.
Resolves "Condition has no effect" warnings in:
- HTMLComponent.java (Redundant else/assignment)
- CSSEngine.java (Redundant getUi() != null check)
- CSSParser.java (Redundant EOF check)
- RECharacter.java (Duplicate check)
- ResourceThreadQueue.java (Simplified boolean check)
- Component.java (Redundant isFlatten() || !opaque check)
- CodenameOneImplementation.java (Redundant width/height check)
- MathUtil.java (Redundant huge + x > one check)
- MenuBar.java (Dead code removal for ICS check)
- ComponentGroup.java (Refactored logic)
- Updated generate-quality-report.py to enforce this rule.
Resolves "Condition has no effect" warnings in:
- CodenameOneImplementation.java (Redundant width/height check)
- MathUtil.java (Redundant huge + x > one check)
- Component.java (Redundant isFlatten() || !opaque check)
- HTMLComponent.java (Redundant else/assignment)
- ResourceThreadQueue.java (Simplified boolean check)
- CSSEngine.java (Redundant getUi() != null check)
- CSSParser.java (Redundant EOF check)
- MenuBar.java (Dead code removal for ICS check)
- ComponentGroup.java (Refactored logic)
- Updated generate-quality-report.py to enforce this rule.
This change resolves "Condition has no effect" (UC_USELESS_CONDITION) warnings reported by SpotBugs in several core classes including Component, MenuBar, CSSEngine, CSSParser, and MathUtil. It also updates the quality report generation script to enforce this rule in CI.

Key changes:
- `Component.java`: Refactored `paintLock` logic to remove redundant checks.
- `ComponentGroup.java`: Simplified boolean logic in `updateUIIDs` to avoid redundancy.
- `MenuBar.java`: Removed dead code related to deprecated ICS command behavior.
- `CSSEngine.java`: Made `fontSize` range check explicit.
- `CSSParser.java`: Improved EOF check readability in whitespace loop.
- `MathUtil.java`: Removed redundant floating-point precision checks in `asin` and `atan`.
- `.github/scripts/generate-quality-report.py`: Added `UC_USELESS_CONDITION` to the list of enforced rules.
Fixed multiple instances of 'Condition has no effect' (UC_USELESS_CONDITION) in core classes including Grid, MenuBar, MathUtil, Component, and others. Updated generate-quality-report.py to treat this violation as a build failure.
Fixed multiple instances of 'Condition has no effect' (UC_USELESS_CONDITION) in core classes:
* CodenameOne/src/com/codename1/util/MathUtil.java: Fixed bitwise shift logic in `ieee754_pow` (`>>>` to `>>`) to restore correct negative number handling.
* CodenameOne/src/com/codename1/ui/MenuBar.java: Removed redundant `COMMAND_BEHAVIOR_ICS` check.
* CodenameOne/src/com/codename1/ui/Component.java: Removed duplicate `!animateBackground` check.
* CodenameOne/src/com/codename1/ui/ComponentGroup.java: Removed redundant `if (count > 1)` check.
* CodenameOne/src/com/codename1/ui/html/CSSParser.java: Removed redundant whitespace check.
* CodenameOne/src/com/codename1/ui/html/HTMLComponent.java: Removed redundant whitespace check.
* CodenameOne/src/com/codename1/xml/XMLParser.java: Removed redundant whitespace check.
* CodenameOne/src/com/codename1/ui/html/CSSEngine.java: Removed redundant whitespace check.
* CodenameOne/src/com/codename1/impl/CodenameOneImplementation.java: Refactored `setCommandBehavior` condition logic.
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.
@github-actions
Copy link

github-actions bot commented Dec 27, 2025

✅ Continuous Quality Report

Test & Coverage

Static Analysis

Generated automatically by the PR CI workflow.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants