-
Notifications
You must be signed in to change notification settings - Fork 41
fix: add missing ProGuard rules for LiveObjects plugin #1154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Add rules for Gson serializers and reflection used during plugin initialization.
WalkthroughUpdated ProGuard rules in android/proguard.txt: removed keep rules for WebSocketTransport$Factory and io.ably.lib.types.**; added keep rules for Objects plugin and serializers (ObjectsPlugin, *Serializer, ObjectsJsonSerializer). Other existing keep/dontwarn directives remain unchanged. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. ✨ Finishing Touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (3)
android/proguard.txt (3)
7-13: Consider preserving type information used by Gson TypeToken and annotationsIf you rely on Gson TypeToken or runtime annotations, you typically need to keep Signature and runtime annotations. If these are not already preserved elsewhere in the build, add:
-keep class org.msgpack.core.** {*;} -keepclasseswithmembers class io.ably.lib.rest.Auth** {*;} -keep class com.google.gson.** {*;} -dontwarn org.msgpack.core.buffer.** -dontwarn org.slf4j.** -dontwarn lombok.** + +# Preserve generic signatures and runtime annotations for Gson/TypeToken +-keepattributes Signature,RuntimeVisibleAnnotations,RuntimeVisibleParameterAnnotations,RuntimeInvisibleAnnotationsPlease confirm if these attributes are already kept in another proguard/r8 config (app module or consumer rules). If so, this addition may be unnecessary.
2-2: Re-evaluate the blanket keep for io.ably.lib.types. to minimize APK size**If removal was intended, it’s currently still present. Keeping the entire types package can significantly reduce shrinking/obfuscation benefits. If Gson serialization for types is annotation-driven (@SerializedName) or uses explicit TypeAdapters, you can likely narrow this rule to only the reflective entry points.
Use the script in the first comment to:
- Confirm whether fields in io.ably.lib.types.* rely on Gson’s default naming (risk if obfuscated).
- Identify any TypeAdapters for these types.
- If safe, replace with narrower rules (e.g., keep only types with runtime reflection and the specific adapters).
3-5: Current ProGuard rules sufficient for ObjectsPlugin and SerializerThe default plugin and serializer are loaded via Class.forName(“io.ably.lib.objects.DefaultObjectsPlugin”) and Class.forName(“…DefaultObjectsSerializer”), both of which match your existing
*ObjectsPluginand*Serializersuffix keep rules. No additional keep rules are required at present.If you introduce new plugin or adapter classes that do not follow these naming conventions, you can optionally add interface-based keep rules for future-proofing:
-keep class ** implements io.ably.lib.objects.ObjectsPlugin { *; } -keep class io.ably.lib.objects.serialization.** implements com.google.gson.JsonSerializer { *; } -keep class io.ably.lib.objects.serialization.** implements com.google.gson.JsonDeserializer { *; } -keep class io.ably.lib.objects.serialization.** extends com.google.gson.TypeAdapter { *; }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
android/proguard.txt(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (11)
- GitHub Check: check
- GitHub Check: check-realtime-okhttp
- GitHub Check: check-rest-okhttp
- GitHub Check: check-liveobjects
- GitHub Check: check (24)
- GitHub Check: check-rest
- GitHub Check: check (21)
- GitHub Check: check (29)
- GitHub Check: check (19)
- GitHub Check: check-realtime
- GitHub Check: build
🔇 Additional comments (2)
android/proguard.txt (2)
9-9: LGTM: keeping Gson library classesKeeping Gson is standard for avoiding stripped internals in R8/ProGuard setups and aligns with your serializer/reflection changes.
1-2: Inconsistent ProGuard changes: keep rules still presentThe PR summary indicates that the following rules were removed, but they remain in android/proguard.txt (lines 1–2):
-keep public class io.ably.lib.transport.WebSocketTransport$Factory {*;}-keep class io.ably.lib.types.** {*;}Please confirm the intended action:
- Should these keep rules be removed?
- If so, verify there’s no reflective loading of
WebSocketTransport.Factory(e.g., via ServiceLoader) and no Gson-based serialization of types underio.ably.lib.typesthat would break without them.
sacOO7
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Add rules for Gson serializers and reflection used during plugin initialization.
Summary by CodeRabbit
Bug Fixes
Chores