Skip to content

chore: fix the library compiler warnings and treat warnings as errors - #1068

Open
kikoso wants to merge 1 commit into
mainfrom
fix/library-compiler-warnings
Open

kikoso wants to merge 1 commit into
mainfrom
fix/library-compiler-warnings

Conversation

@kikoso

@kikoso kikoso commented Nov 3, 2026

Copy link
Copy Markdown
Collaborator

Summary

The three library modules compile with seven warnings today. Some of them are deprecations that will turn into errors in a future Compose or Lifecycle release, and nothing stops new ones from piling up. This fixes all of them and turns on allWarningsAsErrors for maps-compose, maps-compose-utils and maps-compose-widgets, so the next deprecation fails the build when it appears instead of being found during an upgrade.

  • StreetViewPanoramaUpdater: the camera and location listeners used ?. on parameters the compiler sees as non-null. The guard is intentional (GMS can deliver null), so instead of dropping it, the lambdas now take the parameter as nullable (camera: StreetViewPanoramaCamera?). Same behaviour, no warning.
  • StreetView: androidx.compose.ui.platform.LocalLifecycleOwner is deprecated in favour of androidx.lifecycle.compose.LocalLifecycleOwner, which GoogleMap already uses. It is the same composition local, and no new dependency is needed.
  • MarkerComposable: it calls our own experimental rememberComposeBitmapDescriptor, so the two call sites now @OptIn(MapsComposeExperimentalApi::class). Apps calling it directly still get the warning.
  • rememberCameraPositionState(key) and rememberMarkerState(key): both overloads are already deprecated and exist to pass a custom key to rememberSaveable, which is itself deprecated now. They keep forwarding the key and suppress the deprecation, with a comment. Dropping the key instead would silently change behaviour for apps still calling them; this is the same question as in perf(clustering): use a Set for cluster view key diffing and suppress rememberSaveable key deprecation #983, which I think should go this way too.

No public API or behaviour change.

Testing

  • The three libraries compile with no warnings (compileReleaseKotlin with --rerun-tasks).
  • ./gradlew build with every task re-run (compile, unit tests, lint) and assembleDebugAndroidTest for the three libraries pass.
  • Adding a line with an unnecessary safe call to maps-compose-widgets fails the build with warnings found and -Werror specified.
  • spotlessKotlinCheck passes.

maps-app still has deprecation warnings (mostly the old createComposeRule); that one is in a separate PR, and the setting is only enabled for the libraries.

- StreetViewPanoramaUpdater: take the listener parameters as nullable instead
  of using safe calls on non-null types, keeping the null guard.
- StreetView: use androidx.lifecycle.compose.LocalLifecycleOwner, like
  GoogleMap already does.
- MarkerComposable: opt in to MapsComposeExperimentalApi where it uses
  rememberComposeBitmapDescriptor.
- The deprecated rememberCameraPositionState(key) and rememberMarkerState(key)
  overloads keep forwarding the key; suppress the deprecation there instead of
  silently dropping it.

With no warnings left, maps-compose, maps-compose-utils and
maps-compose-widgets now compile with allWarningsAsErrors.
@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown

Coverage (unit tests)

Compared against 174f0fd on main (#1060).

Module Line % Change Branch % Change
maps-compose 15.28% no change 3.75% 🔻 -0.01
maps-compose-utils 6.09% no change 4.47% no change
maps-compose-widgets 10.88% no change 11.11% no change
TOTAL 12.99% no change 4.12% no change

Line and branch coverage from unit test reports. History is recorded on the coverage-history branch after each merge to main.

@googlemaps-bot

Copy link
Copy Markdown
Contributor

Coverage (instrumentation tests)

Overall Project 43.59% -0.03% 🍏
Files changed 59.38% ❌

Module Coverage
maps-app 63.89% -0.08% ❌
Files
Module File Coverage
maps-app StreetView.kt 88.39% 🍏
StreetViewPanoramaUpdater.kt 71.24% -8.5% ❌
CameraPositionState.kt 68.88% 🍏
Marker.kt 65.15% 🍏

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants