airbnb / Showkase

🔦 Showkase is an annotation-processor based Android library that helps you organize, discover, search and visualize Jetpack Compose UI elements
https://medium.com/airbnb-engineering/introducing-showkase-a-library-to-organize-discover-and-visualize-your-jetpack-compose-elements-d5c34ef01095
Apache License 2.0
2.11k stars 107 forks source link

ShowkaseMetadata class leaking into public API #272

Open iamutkarshtiwari opened 1 year ago

iamutkarshtiwari commented 1 year ago

I have a gradle setup where I have several public preview methods (> 20) in a module. This module also has some public API that will be consumed. Since I have renamed all the public preview methods with PreviewXyz, no one is going to be using it because the intended public API starts with EGDSXyz so that should be fine.

However, there is one issue. For one of those preview methods, a generated class is leaking through. Screen Shot 2022-10-11 at 12 31 34

Screen Shot 2022-10-11 at 12 40 34 Screen Shot 2022-10-11 at 12 40 44 Screen Shot 2022-10-11 at 12 40 54

I am able to access ShowkaseMetadata_com_xyz_components_composables_scrim() in the consuming project. I am not sure why this is happening for this preview method only as there are other preview methods that have the exactly same setup and are not leaking through:

Screen Shot 2022-10-11 at 12 37 37 Screen Shot 2022-10-11 at 12 37 44
vinaygaba commented 1 year ago

@iamutkarshtiwari Interesting 🤔 Don't have a hypothesis about why this happens only for 1 preview and not the rest. Would you be kind enough to create a sample project that I can play with so that it's easier to debug/repro.

vinaygaba commented 1 year ago

Is that generated function being referenced anywhere somehow?

iamutkarshtiwari commented 1 year ago

Hi @vinaygaba, apologies for the delayed response. No, that generated function is not being referenced anywhere. However, like I mentioned, it's accessible on the consumer side.