Conversation
…ceFirebaseApi)` to public interfaces Googlers see go/data-connect-subclass-optin-kotlin-api-proposal
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. |
📝 PRs merging into main branchOur main branch should always be in a releasable state. If you are working on a larger change, or if you don't want this change to see the light of the day just yet, consider using a feature branch first, and only merge into the main branch when the code complete and ready to be released. |
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces a new annotation, InternalForInheritanceFirebaseApi, in the firebase-annotations module, which is used to mark classes and interfaces that should not be inherited or implemented outside of the Firebase SDK. In the firebase-dataconnect module, this annotation is applied via @SubclassOptInRequired to several public interfaces (such as FirebaseDataConnect, OperationRef, QueryRef, and others) to explicitly prevent external subclassing. Additionally, build configurations and dependencies have been updated to support this Kotlin opt-in mechanism, and the project versions have been bumped accordingly. There are no review comments, and I have no additional feedback to provide.
…ebaseApi addition as feature Update the changelog entry for adding InternalForInheritanceFirebaseApi from [changed] to [feature]. Adding a new public annotation to the library introduces new capability and public API surface rather than modifying existing behavior, so it should be categorized as a feature.
Change the dependency on :firebase-annotations from implementation to api in firebase-dataconnect.gradle.kts. Since firebase-dataconnect exposes @SubclassOptInRequired(InternalForInheritanceFirebaseApi::class) on its public interfaces, consumers require access to InternalForInheritanceFirebaseApi transitively at compile time.
This pull request adds the
@SubclassOptInRequired(InternalForInheritanceFirebaseApi::class)annotation to public interfaces in thefirebase-dataconnectmodule. This change explicitly discourages third-party library consumers from inheriting these interfaces, as their contracts may be expanded or altered in future releases.Additionally, it introduces the
InternalForInheritanceFirebaseApiannotation tofirebase-annotationsto enforce the opt-in requirement, and updates thefirebase-dataconnectdependency configuration so that consumers can transitively access this annotation at compile time.Googlers can see the API proposal at go/data-connect-subclass-optin-kotlin-api-proposal
Highlights
@SubclassOptInRequired(InternalForInheritanceFirebaseApi::class)to public API interfaces infirebase-dataconnect(such asFirebaseDataConnect,QueryRef,MutationRef,QuerySubscription, and their related options and results) to prevent unintended external extension.InternalForInheritanceFirebaseApiannotation insidefirebase-annotationsto support the opt-in logic for thefirebase-dataconnectmodule.firebase-annotationsdependency fromimplementationtoapiinfirebase-dataconnect.gradle.ktsso thatInternalForInheritanceFirebaseApiis available transitively, satisfying compilation requirements for consumers.Changelog
firebase-annotations)InternalForInheritanceFirebaseApias a new feature instead of a regular change.firebase-annotations)InternalForInheritanceFirebaseApipublic API signature.firebase-annotations)InternalForInheritanceFirebaseApiannotation.firebase-dataconnect)firebase-dataconnect)@SubclassOptInRequiredusages on public interfaces.firebase-annotationsdependency asapi.firebase-dataconnect)@SubclassOptInRequiredto theDataConnectOperationFailureResponseinterface.@SubclassOptInRequiredtoFirebaseDataConnect,QueryRefOptionsBuilder, andMutationRefOptionsBuilder.@SubclassOptInRequiredtoMutationRefandMutationResult.@SubclassOptInRequiredtoOperationRefandOperationResult.@SubclassOptInRequiredtoQueryRefandQueryResult.@SubclassOptInRequiredtoQuerySubscriptionandQuerySubscriptionResult.