Skip to content

Fix reflection boolean signature for swarm start - #6

Merged
codeh007 merged 1 commit into
mainfrom
fix/boolean-primitive-reflection
Mar 28, 2026
Merged

codeh007 merged 1 commit into
mainfrom
fix/boolean-primitive-reflection

Conversation

@codeh007

@codeh007 codeh007 commented Mar 28, 2026 •

Copy link
Copy Markdown
Owner

Summary\n- try primitive + boxed boolean parameter types when reflecting StartNodeWithOptions\n- do the same for boolean config setters\n\n## Testing\n- not run (device/manual)

Summary by CodeRabbit

  • Refactor
    • Improved internal parameter type resolution handling for increased stability and code maintainability.

@codeh007
codeh007 merged commit 71b5c13 into main Mar 28, 2026
1 check passed
@codeh007
codeh007 deleted the fix/boolean-primitive-reflection branch March 28, 2026 09:40
@coderabbitai

coderabbitai Bot commented Mar 28, 2026 •

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: df5c2ddf-d1e4-4f9a-be02-12e61022ed07

📥 Commits

Reviewing files that changed from the base of the PR and between 0b05274 and 45fe4a2.

📒 Files selected for processing (1)
  • app/src/main/java/com/gomtm/android/swarm/SwarmRuntime.kt

📝 Walkthrough

Walkthrough

Refactors reflective boolean-parameter handling in SwarmRuntime by introducing a booleanParameterTypes() helper function that encapsulates both primitive and boxed Boolean types. This helper is used during method resolution in start() and setBooleanProperty() to iterate over boolean parameter types instead of using a single computed type.

Changes

Cohort / File(s) Summary
SwarmRuntime Reflection Refactoring
app/src/main/java/com/gomtm/android/swarm/SwarmRuntime.kt
Added booleanParameterTypes() private helper that returns a list containing both Boolean.TYPE (primitive) and java.lang.Boolean (boxed). Refactored reflective method invocation in start() and setBooleanProperty() to iterate over both boolean types when resolving method signatures, replacing previous single-type computation.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • PR #5: Modifies SwarmRuntime.start()'s reflective invocation logic for StartNode/StartNodeWithOptions method resolution, directly related to the boolean-parameter-type iteration logic introduced here.
  • PR #4: Updates reflection logic in SwarmRuntime for invoking config setters and node start methods, shares similar patterns of method-name and parameter-type fallback handling.

Poem

🐰 With types both primitive and boxed, the rabbit hops with glee,
A helper born to untangle reflective mystery,
Two paths now share one truth so neat,
Boolean logic made complete! ✨

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/boolean-primitive-reflection

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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