googlemaps / android-maps-compose

Jetpack Compose composables for the Maps SDK for Android
https://developers.google.com/maps/documentation/android-sdk/maps-compose
Apache License 2.0
1.14k stars 135 forks source link

False positive: Calling a Google Map Composable composable function where a UI Composable composable was expected #598

Open ln-12 opened 2 months ago

ln-12 commented 2 months ago

I am using version 5.0.4 of this library. On my map, I need to add a composable marker which I am doing via MarkerComposable. This composable is marked with @GoogleMapComposable that should enforce correct usage (introduced in https://github.com/googlemaps/android-maps-compose/pull/130). I think there is an issue here as this gets triggered if I use a standard/non maps composable inside the MarkerComposable as this is then not marked with the @GoogleMapComposable annotation. Probably, there should be an exclude for this specific case as I cannot annotate all composables that I want to use with that annotation (for example a simple Text). Or is there a simple way to suppress it?

For me, this is quite annoying as we enforce our builds to not have any warnings.

Steps to reproduce

  1. Use some composable (Card, Text, ...) inside the MarkerComposable
  2. The build warning "Calling a Google Map Composable composable function where a UI Composable composable was expected" is triggered

Code example

MarkerComposable( // <-- has the @GoogleMapComposable annotation
    // ...
) {
    Text(text = "Hello World") // <-- does not have the @GoogleMapComposable annotation, but is a valid use case
}
ArleyPereira commented 1 month ago

@ln-12 Hello, from what I tested in the latest version 6.1.1 of Compose maps this does not happen.

ln-12 commented 1 month ago

I just checked again after updating to version 6.1.1 and for me this still gives the warning mentioned above when I rebuild my project. It happens in the compileDebugKotlin task.