Don't allow subclassing of AndroidCalendar anymore#23
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR enforces that AndroidCalendar can no longer be subclassed by removing the factory interface and making it a final class, then updating all call sites and tests to instantiate AndroidCalendar directly.
- Eliminated
AndroidCalendarFactoryand factory parameters inAndroidCalendarmethods. - Changed
AndroidCalendarfrom open to final and updatedfind/findByIDto returnAndroidCalendar. - Refactored tests and helper classes (
TestCalendar, test fixtures) to stop using subclasses.
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| lib/src/main/kotlin/at/bitfire/synctools/test/InitCalendarProviderRule.kt | Removed AndroidCalendar.Factory argument in findByID call |
| lib/src/main/kotlin/at/bitfire/ical4android/AndroidEvent.kt | Dropped unused isOrganizer variable |
| lib/src/main/kotlin/at/bitfire/ical4android/AndroidCalendarFactory.kt | Deleted the factory interface file |
| lib/src/main/kotlin/at/bitfire/ical4android/AndroidCalendar.kt | Made class final; removed factory parameters and default factory |
| lib/src/androidTest/kotlin/at/bitfire/ical4android/impl/TestCalendar.kt | Converted subclass to a utility object returning AndroidCalendar |
| lib/src/androidTest/kotlin/at/bitfire/ical4android/AndroidEventTest.kt | Updated test calendar type and default parameters to AndroidCalendar |
| lib/src/androidTest/kotlin/at/bitfire/ical4android/AndroidCalendarTest.kt | Removed factory argument from findByID call |
Comments suppressed due to low confidence (2)
lib/src/androidTest/kotlin/at/bitfire/ical4android/impl/TestCalendar.kt:16
- [nitpick] Consider renaming
TestCalendarto something likeTestCalendarHelperto reflect its role as a utility and avoid confusion with the previous subclass.
object TestCalendar {
lib/src/main/kotlin/at/bitfire/ical4android/AndroidCalendar.kt:249
- Consider using a MutableList (e.g.,
mutableListOf<AndroidCalendar>()) instead ofLinkedListfor better performance and memory characteristics, unless you specifically need linked-list behavior.
val calendars = LinkedList<AndroidCalendar>()
This was referenced Feb 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Preparation for bitfireAT/davx5-ose#1552