Skip to content

chore(clustering): use idiomatic poll().let in cluster renderers for null-safety - #1761

Merged
dkhawk merged 1 commit into
mainfrom
chore/lint-fixes
Aug 26, 2026
Merged

chore(clustering): use idiomatic poll().let in cluster renderers for null-safety#1761
dkhawk merged 1 commit into
mainfrom
chore/lint-fixes

Conversation

@dkhawk

@dkhawk dkhawk commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Summary

Replaces redundant !queue.isEmpty() checks and unsafe .poll() platform-type invocations in performNextTask() across cluster renderers with idiomatic Kotlin queue.poll()?.let { ...; return }.

Details

  • Queue.poll() is a Java platform method returning a nullable type (AnimationTask?). In strict nullability build environments (such as google3 with -Xjsr305=strict), calling queue.poll().perform() produces unsafe nullable receiver errors.
  • In Kotlin, queue.poll() returns null if empty, making pre-checks with !queue.isEmpty() redundant. Using poll()?.let performs a single atomic queue retrieval, safely smart-casts it to non-null, and immediately returns once the highest-priority queued task is handled.

Files Updated

  • DefaultAdvancedMarkersClusterRenderer.kt
  • DefaultClusterRenderer.kt
  • ClusterRendererMultipleItems.kt

Reviewer

cc @LoyalAbbas

@googlemaps-bot

Copy link
Copy Markdown
Contributor

Code Coverage

Overall Project 44.77% -0.5% 🍏
Files changed 0%

Module Coverage
clustering 20.32% -1.6%
Files
Module File Coverage
clustering DefaultAdvancedMarkersClusterRenderer.kt 0% -2.45%
ClusterRendererMultipleItems.kt 0% -1.98%
DefaultClusterRenderer.kt 0% -2.42%

@dkhawk
dkhawk requested a review from kikoso August 25, 2026 20:07

@kikoso kikoso left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@LoyalAbbas LoyalAbbas left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dkhawk
dkhawk merged commit d51c6d6 into main Aug 26, 2026
12 checks passed
@dkhawk
dkhawk deleted the chore/lint-fixes branch August 26, 2026 15:55
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.

4 participants