Skip to content

chore: resolve ErrorProne, Lint, and Kotlinc warnings across library, clustering, data, heatmaps, and ui modules - #1757

Open
dkhawk wants to merge 1 commit into
mainfrom
chore/lint-fixes
Open

chore: resolve ErrorProne, Lint, and Kotlinc warnings across library, clustering, data, heatmaps, and ui modules#1757
dkhawk wants to merge 1 commit into
mainfrom
chore/lint-fixes

Conversation

@dkhawk

@dkhawk dkhawk commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Summary

Resolves 41 static analysis and compiler warnings reported by ErrorProne, Android Lint, Rekaster, and Kotlinc in Critique CL 968695609 across five modules (:library, :clustering, :data, :heatmaps, :ui).


Detailed Changes by Category & Module

1. :library Module

  • MarkerManager.java:
    • ErrorProneMissingOverride: Added @Override to newCollection().
    • JavaCodeClarityReturnMissingNullable: Added @Nullable to getInfoWindow() and getInfoContents().
    • JavaCodeClarityMissingJavadoc: Added Javadoc to the Collection inner class.
    • JavacWarningsRAW & UNCHECKED: Parametrized Collection as extends MapObjectManager<Marker, MarkerManager.Collection>.Collection to eliminate raw type and unchecked cast warnings.
  • CircleManager.java / GroundOverlayManager.java / PolygonManager.java / PolylineManager.java:
    • JavaCodeClarityMissingJavadoc: Added Javadoc to Collection inner classes.
    • JavacWarningsRAW & UNCHECKED: Parametrized Collection as extends MapObjectManager<O, C>.Collection for Circle, GroundOverlay, Polygon, and Polyline to eliminate raw type warnings.
  • MapObjectManager.java:
    • JavacWarningsRAW & UNCHECKED: Updated MapObjectManager class declaration to abstract class MapObjectManager<O, C extends MapObjectManager<O, C>.Collection> to fix the raw Collection type bound; added @SuppressWarnings("unchecked") to (C) this in add().
  • StreetViewUtil.kt:
    • JavaAndKotlinLintUnusedException: Passed the caught IOException e as the cause parameter (IOException("Network error: ${e.message}", e)) and removed e.printStackTrace().

2. :heatmaps Module

  • HeatmapTileProvider.kt:
    • JavaAndKotlinLintScopeReceiverThis: Replaced apply { ... } in Builder methods (data, weightedData, radius, gradient, opacity, maxIntensity) with explicit return this to eliminate ScopeReceiverThis lint warnings and improve readability.

3. :data Module

  • GoogleMapRenderer.kt:
    • KotlinOptionalSuggestionsDiscourageForEach: Replaced 5 forEach usages with for loops in addLayer(), removeLayer(), clear(), and renderPolygon() as per Kotlin coding conventions.

4. :clustering Module

  • ClusterRendererMultipleItems.kt:
    • KotlincWarningsUNUSED_IMPORT: Removed unused import java.util.concurrent.locks.Condition.
    • KotlincWarningsCAN_BE_VAL_DELAYED_INITIALIZATION & UNNECESSARY_NOT_NULL_ASSERTION: Replaced var renderTask with val renderTask via synchronized expression, eliminating !! assertions on renderTask.
    • KotlincWarningsUNNECESSARY_NOT_NULL_ASSERTION: Replaced marker.position!! and animateTo!! in animateThenRemove() with a local val position = marker.position check, avoiding !! and smart-cast errors.
    • KotlinOptionalRefactoringSuggestionsElvisShortcuts: Replaced if (animateFrom == null) cluster.position else animateFrom with animateFrom ?: cluster.position.
  • DefaultAdvancedMarkersClusterRenderer.kt:
    • KotlincWarningsUNUSED_IMPORT: Removed unused import java.util.concurrent.locks.Condition.
    • KotlincWarningsCAN_BE_VAL_DELAYED_INITIALIZATION & UNNECESSARY_NOT_NULL_ASSERTION: Replaced var renderTask with val renderTask; eliminated !! on animateTo!!, marker!!, and markerWithPosition.
    • KotlinOptionalRefactoringSuggestionsElvisShortcuts: Replaced if (animateFrom == null) cluster.position else animateFrom with animateFrom ?: cluster.position.
  • DefaultClusterRenderer.kt:
    • KotlincWarningsUNUSED_IMPORT: Removed unused import java.util.concurrent.locks.Condition.
    • KotlincWarningsCAN_BE_VAL_DELAYED_INITIALIZATION & UNNECESSARY_NOT_NULL_ASSERTION: Replaced var renderTask with val renderTask; eliminated !! on animateTo!! and markerWithPosition.
    • KotlinOptionalRefactoringSuggestionsElvisShortcuts: Replaced if (animateFrom == null) cluster.position else animateFrom with animateFrom ?: cluster.position.
  • ClusterManager.kt:
    • KotlincWarningsUNUSED_IMPORT: Removed unused import android.os.AsyncTask.
  • NonHierarchicalDistanceBasedAlgorithm.kt:
    • KotlincWarningsUNUSED_IMPORT: Removed unused import java.util.ArrayList.
  • PreCachingAlgorithmDecorator.kt:
    • KotlincWarningsUNNECESSARY_NOT_NULL_ASSERTION: Refactored getClustersInternal() using kotlin.concurrent.withLock to eliminate var results and return results!!.
  • ClusterRenderer.kt:
    • KotlincWarningsUNUSED_IMPORT: Removed unused import com.google.maps.android.clustering.ClusterManager.
  • SphericalMercatorProjection.kt:
    • KotlincWarningsDEPRECATION: Updated toPoint() to return com.google.maps.android.geometry.Point instead of the deprecated com.google.maps.android.projection.Point.

5. :ui Module

  • IconGenerator.kt:
    • KotlincWarningsDEPRECATION: Replaced deprecated TextView.setTextAppearance() and View.setBackgroundDrawable() with TextViewCompat.setTextAppearance() and ViewCompat.setBackground().

Verification

  • Gradle Build: ./gradlew :library:compileDebugKotlin :library:compileDebugJavaWithJavac :clustering:compileDebugKotlin :data:compileDebugKotlin :heatmaps:compileDebugKotlin :ui:compileDebugKotlinBUILD SUCCESSFUL

@dkhawk dkhawk changed the title chore: address lint issues in Java and Kotlin files chore: resolve ErrorProne, Lint, and Kotlinc warnings across library, clustering, data, heatmaps, and ui modules Aug 21, 2026
@googlemaps-bot

googlemaps-bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Code Coverage

Overall Project 43.07% -1.25% 🍏
Files changed 30.17%

Module Coverage
heatmaps 84.15% -1.23% 🍏
library 67.31% -0.27%
data 49.35% -0.41%
clustering 19.57% -2.87%
ui 17.67% -1.81%
Files
Module File Coverage
heatmaps HeatmapTileProvider.kt 84.5% -1.72% 🍏
library StreetViewUtil.kt 32.14% -3.57%
MarkerManager.java 0% 🍏
PolygonManager.java 0% 🍏
PolylineManager.java 0% 🍏
CircleManager.java 0% 🍏
GroundOverlayManager.java 0% 🍏
MapObjectManager.java 0% 🍏
data GoogleMapRenderer.kt 0% -13.49%
clustering SphericalMercatorProjection.kt 100% 🍏
NonHierarchicalDistanceBasedAlgorithm.kt 97.94% 🍏
PreCachingAlgorithmDecorator.kt 72.89% -0.73% 🍏
DefaultAdvancedMarkersClusterRenderer.kt 0% -5.8%
ClusterRendererMultipleItems.kt 0% -3.21%
DefaultClusterRenderer.kt 0% -3.27%
ClusterManager.kt 0% 🍏
ui IconGenerator.kt 0% -4.43%

@dkhawk
dkhawk marked this pull request as ready for review August 21, 2026 22:31
@dkhawk
dkhawk requested review from LoyalAbbas and kikoso August 21, 2026 22:31
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.

2 participants