Skip to content

CATROID-1554: Refactor WaitForSoundAction to Kotlin#5193

Open
harshsomankar123-tech wants to merge 4 commits intoCatrobat:developfrom
harshsomankar123-tech:refactor/CATROID-1554-kotlin
Open

CATROID-1554: Refactor WaitForSoundAction to Kotlin#5193
harshsomankar123-tech wants to merge 4 commits intoCatrobat:developfrom
harshsomankar123-tech:refactor/CATROID-1554-kotlin

Conversation

@harshsomankar123-tech
Copy link
Copy Markdown
Member

@harshsomankar123-tech harshsomankar123-tech commented Apr 10, 2026

JIRA Ticket
https://catrobat.atlassian.net/browse/CATROID-1554

Description
This PR refactors the WaitForSoundAction class from Java to Kotlin as part of the ongoing effort to modernize the Catroid codebase. The implementation focuses on idiomatic Kotlin patterns and strict null safety while ensuring complete interoperability with existing Java components.

Changes

  • Java to Kotlin Conversion: Refactored WaitForSoundAction.java to WaitForSoundAction.kt.
  • Null Safety: Implemented null-safe logic using safe calls and early returns, completely avoiding the !! operator.
  • Idiomatic Logic: Used Kotlin-specific features like the in operator for set containment and property access syntax.
  • Java Interop: Maintained compatibility with existing Java components (tests and ActionFactory) by ensuring property setters are properly exposed and using @JvmField for the TAG.
  • Cleanup: Removed the legacy WaitForSoundAction.java file.
  • Maintenance: Updated copyright year to 2026.

Testing

  • Verified that the new Kotlin implementation compiles and is correctly recognized by the existing Java test suite (WaitForSoundActionTest.java).
  • Confirmed that the logic remains identical to the original Java implementation to ensure no behavioral regressions.

Your checklist for this pull request

Please review the contributing guidelines and wiki pages of this repository.

  • Include the name of the Jira ticket in the PR’s title
  • Include a summary of the changes plus the relevant context
  • Choose the proper base branch (develop)
  • Confirm that the changes follow the project’s coding guidelines
  • Verify that the changes generate no compiler or linter warnings
  • Perform a self-review of the changes
  • Verify to commit no other files than the intentionally changed ones
  • Include reasonable and readable tests verifying the added or changed behavior
  • Confirm that new and existing unit tests pass locally
  • Check that the commits’ message style matches the project’s guideline
  • Stick to the project’s gitflow workflow
  • Verify that your changes do not have any conflicts with the base branch
  • After the PR, verify that all CI checks have passed
  • Post a message in the catroid-stage or catroid-ide Slack channel and ask for a code reviewer

@reichli reichli requested a review from Copilot April 16, 2026 12:36
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Refactors WaitForSoundAction from Java to Kotlin to support the ongoing Kotlin migration while keeping existing Java call sites (e.g., ActionFactory, instrumentation tests) working.

Changes:

  • Replaced WaitForSoundAction.java with WaitForSoundAction.kt using Kotlin null-safety and idiomatic constructs.
  • Kept Java interoperability via generated property setters and a @JvmField TAG.
  • Updated header copyright year to 2026 in the new Kotlin file.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
catroid/src/main/java/org/catrobat/catroid/content/actions/WaitForSoundAction.kt Kotlin implementation of the wait-for-sound behavior, including SoundManager/MidiSoundManager interactions.
catroid/src/main/java/org/catrobat/catroid/content/actions/WaitForSoundAction.java Removed legacy Java implementation after Kotlin replacement.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@sonarqubecloud
Copy link
Copy Markdown

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.

4 participants