Skip to content

Conversation

@rfc2822
Copy link
Member

@rfc2822 rfc2822 commented Jun 27, 2025

Preparation for bitfireAT/davx5-ose#1552

@rfc2822 rfc2822 linked an issue Jun 27, 2025 that may be closed by this pull request
@rfc2822 rfc2822 added the refactoring Quality improvement of existing functions label Jun 27, 2025
@rfc2822 rfc2822 self-assigned this Jun 27, 2025
@rfc2822 rfc2822 marked this pull request as ready for review June 27, 2025 15:27
@rfc2822 rfc2822 requested a review from Copilot June 27, 2025 15:27
Copy link
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

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 AndroidCalendarFactory and factory parameters in AndroidCalendar methods.
  • Changed AndroidCalendar from open to final and updated find/findByID to return AndroidCalendar.
  • 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 TestCalendar to something like TestCalendarHelper to 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 of LinkedList for better performance and memory characteristics, unless you specifically need linked-list behavior.
                val calendars = LinkedList<AndroidCalendar>()

@rfc2822 rfc2822 merged commit 1a613d5 into main Jun 27, 2025
9 checks passed
@rfc2822 rfc2822 deleted the 22-androidcalendar-must-not-be-subclassed-anymore branch June 27, 2025 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactoring Quality improvement of existing functions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AndroidCalendar must not be subclassed anymore

1 participant