Skip to content

fix: add @JvmOverloads to KotlinUSBBridge.connect() for USB RNode#561

Merged
torlando-tech merged 1 commit intomainfrom
fix/usb-rnode-connect-jvmoverloads
Feb 25, 2026
Merged

fix: add @JvmOverloads to KotlinUSBBridge.connect() for USB RNode#561
torlando-tech merged 1 commit intomainfrom
fix/usb-rnode-connect-jvmoverloads

Conversation

@torlando-tech
Copy link
Copy Markdown
Owner

Summary

  • Adds @JvmOverloads to KotlinUSBBridge.connect() so Chaquopy/Python callers can invoke it with 2 arguments
  • The startIoManager parameter added in PR fix: nRF52 DFU flashing and frequency band detection #508 (nRF52 DFU) removed the 2-param Java overload that rnode_interface.py depends on
  • Without this, USB RNode interfaces silently fail to start — connect(device_id, 115200) throws NoSuchMethodError

Root cause

Kotlin default parameters only generate overloads for Kotlin callers. Java/Chaquopy callers need @JvmOverloads to get bridge methods. In v0.8.9, connect(int, int) existed. In v0.8.10+, only connect(int, int, boolean) exists — breaking the Python call.

Test plan

  • Connect a USB RNode (e.g. LilyGO T3S3) and verify the interface comes online
  • Verify Bluetooth RNodes still work (uses different bridge class, unaffected)
  • Verify nRF52 DFU flashing still works (passes startIoManager=false from Kotlin)

Fixes #545

🤖 Generated with Claude Code

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Feb 25, 2026

Greptile Summary

Adds @JvmOverloads annotation to the connect() method to restore compatibility with Python/Chaquopy callers that use the 2-argument signature connect(device_id, baud_rate).

Key changes:

  • Single annotation added to KotlinUSBBridge.connect() at line 613
  • Enables Java/Chaquopy to call connect(int, int) without providing the third startIoManager parameter
  • Fixes NoSuchMethodError when rnode_interface.py calls usb_bridge.connect(device_id, 115200) on line 424

Background:
The startIoManager parameter was added in PR #508 for nRF52 DFU support. Kotlin default parameters don't automatically generate Java overloads — without @JvmOverloads, only connect(int, int, boolean) exists in the JVM bytecode. Python callers using Chaquopy bridge need the explicit 2-argument overload.

Confidence Score: 5/5

  • This PR is safe to merge with no risk
  • Single annotation addition that is a standard Kotlin/Java interop pattern. The @JvmOverloads annotation is the correct and recommended solution for exposing Kotlin default parameters to Java/JVM callers. No logic changes, no behavior changes for existing Kotlin callers, and restores the 2-argument overload that Python depends on.
  • No files require special attention

Important Files Changed

Filename Overview
reticulum/src/main/java/com/lxmf/messenger/reticulum/usb/KotlinUSBBridge.kt Adds @JvmOverloads annotation to connect() method to generate Java/Chaquopy overloads for Python callers

Last reviewed commit: 98df838

…atibility

The startIoManager parameter added for nRF52 DFU (PR #508) removed the
2-parameter Java overload that Python/Chaquopy callers depend on. Without
@jvmoverloads, Kotlin only generates connect(int, int, boolean) — so
rnode_interface.py's connect(device_id, 115200) call fails with
NoSuchMethodError, silently preventing USB RNode interfaces from starting.

Fixes #545

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@torlando-tech torlando-tech force-pushed the fix/usb-rnode-connect-jvmoverloads branch from 9adc3e2 to 98df838 Compare February 25, 2026 21:49
@torlando-tech
Copy link
Copy Markdown
Owner Author

@greptileai

@sentry
Copy link
Copy Markdown
Contributor

sentry bot commented Feb 25, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@torlando-tech torlando-tech merged commit ddeb04d into main Feb 25, 2026
23 of 25 checks passed
@torlando-tech torlando-tech deleted the fix/usb-rnode-connect-jvmoverloads branch February 25, 2026 22:45
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.

USB connected rnoden stop working

1 participant