fix: Don't use computeIfAbsent in PerContextEventSummarizer - #226
Merged
abelonogov-ld merged 1 commit intoSep 28, 2026
Merged
Conversation
Android below API 24 has neither Map.computeIfAbsent nor java.util.function. D8 turns the EventSummarizer::new reference into a synthetic Function, so the first evaluation in a client-side SDK on API 21-23 throws NoClassDefFoundError. Co-authored-by: Cursor <cursoragent@cursor.com>
tanderson-ld
approved these changes
Sep 28, 2026
abelonogov-ld
deleted the
andrey/per-context-summarizer-android-api-level
branch
September 28, 2026 16:21
abelonogov-ld
pushed a commit
that referenced
this pull request
Sep 28, 2026
🤖 I have created a release *beep* *boop* --- ## [1.12.1](launchdarkly-java-sdk-internal-1.12.0...launchdarkly-java-sdk-internal-1.12.1) (2026-09-28) ### Bug Fixes * Don't use computeIfAbsent in PerContextEventSummarizer ([#226](#226)) ([6b02b08](6b02b08)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Overview** > **Release `launchdarkly-java-sdk-internal` 1.12.1** via Release Please: bumps `lib/shared/internal` from **1.12.0** to **1.12.1** in `.release-please-manifest.json`, `gradle.properties`, and adds the **1.12.1** changelog entry. > > The release captures bug fix **#226**: **`PerContextEventSummarizer`** no longer uses `Map.computeIfAbsent` when creating per-context summarizers—it uses explicit **get / put** so the code runs on **Android below API 24**, where `computeIfAbsent` and `java.util.function` are unavailable. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit def7831. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requirements
Related issues
The Android client SDK supports API 21 and up, and summarizes per context with
PerContextEventSummarizer.Describe the solution you've provided
Android below API 24 has neither
Map.computeIfAbsentnorjava.util.function. D8 turns theEventSummarizer::newreference into a syntheticFunction, so the first flag evaluation in a client-side SDK on API 21–23 throwsNoClassDefFoundError.summarizeEventnow does agetand, on a miss, aput, which behaves the same. The existingPerContextEventSummarizerTest(18 tests) andEventSummarizerTest(7 tests) pass unchanged.Describe alternatives you've considered
Having the Android SDK fall back to the aggregated
EventSummarizerbelow API 24. That works around it for one consumer, but leaves the shared class unusable on those API levels.Additional context
No public API change.
Note
Overview
Fixes client-side event summarization on Android API 21–23, where the first flag evaluation could crash with
NoClassDefFoundErrorbecauseMap.computeIfAbsentandjava.util.functionare unavailable and D8 turnsEventSummarizer::newinto a syntheticFunction.PerContextEventSummarizer.summarizeEventnow usesget/ create /putinstead ofcomputeIfAbsent, with the same per-context summarizer behavior. No public API change; existing tests cover the behavior.Reviewed by Cursor Bugbot for commit c12de8f. Bugbot is set up for automated code reviews on this repo. Configure here.