Repository navigation
feat: java.util.concurrent API with a core-api-java6 backport artifact (1.8.0) - #20
Conversation
core-api's public API (Context, ABSmartly, HTTPClient, ContextDataProvider, ContextEventHandler) now uses java.util.concurrent.CompletableFuture and the java.util.function interfaces instead of the streamsupport backport, whose final release fails on JDK 24+ and relies on sun.misc.Unsafe. The streamsupport dependency is dropped from core-api. The sources keep Java 6 syntax so core-api-java6 can be generated from them, but compile to Java 8 bytecode and are checked by animalsniffer against the Java 8 and Android API level 24 signatures. SdkFuture only exists to keep the backport's default pool out of reach, and CompletableFuture.defaultExecutor()/newIncompleteFuture() are Java 9 APIs, so core-api hands out plain JDK futures through internal.Futures. The returned-futures test asserts the default executor through a per-variant ReturnedFutures helper. BREAKING CHANGE: code that names java8.util.concurrent or java8.util.function types from the SDK API, or implements HTTPClient, ContextDataProvider or ContextEventHandler, must import the java.util.concurrent and java.util.function types instead. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ort types
core-api-java6 has no sources of its own. generateMainSources and
generateTestSources copy core-api's sources and switch only
java.util.concurrent.{CompletableFuture,CompletionStage,CompletionException}
and java.util.function.{Function,Consumer,Supplier,BiFunction} to their
java8.util twins; a file in core-api's src/java6Main or src/java6Test replaces
the one at the same path. Wildcard imports that would hide one of those types
fail the generation instead of compiling against the wrong one.
The java6 overrides restore PR #19's behavior: Futures hands out SdkFutures,
whose *Async stages default to the SDK executor, and ReturnedFutures asserts
that. The module compiles to Java 6 bytecode, depends on
streamsupport-minifuture 1.7.4 (api), keeps the java16 animalsniffer
signature and runs the full suite on test and testJdk25. It is published with
sources and javadoc jars built from the generated sources.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The README explains which artifact to use, with Gradle and Maven snippets for both, and limits the Java 24+ executor restrictions to core-api-java6. The CHANGELOG describes who is affected by the move to java.util.concurrent and how to migrate. CONTRIBUTING explains how core-api-java6 is generated. Co-Authored-By: Claude Opus 5.5 <[email protected]>
PR #19's either-stage fix lands in core-api/src/java6Main/.../SdkFuture.java, which only core-api-java6 compiles. Its test exercises the backport SdkFuture directly, so it moves to the java6-only SdkFutureTest; the copy() assertion stays in the shared returned-futures test. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Warning Review limit reachedEnable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Next included review available in 56 minutes. View limit details
|
|
Review submitted The automated review has been submitted. See the review for the verdict and any findings. Head: |
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
jervasion-absmartly
left a comment
There was a problem hiding this comment.
✅ Approved with suggestions
The two-artifact split implements the documented breaking change while preserving the legacy future API in core-api-java6. No blocking issues found. The formatting-only commits pushed during review are covered, and latest-head CI passes.
Next step: None — ready to merge.
Suggestions (optional)
- Two redundant build-script comment blocks could be trimmed; see details.
What I checked
- ✅ Full suites pass on JDK 11 and JDK 25: 584 tests per runtime for
core-api, 585 forcore-api-java6, no failures or skips. Includes real HTTP fetch/publish, async lifecycle, failure recovery and caller cancellation. - ✅ Both API-floor and coverage gates pass. Built classes and publication metadata target Java 8 and Java 6; only the legacy artifact exposes streamsupport.
- ✅ Source/Javadoc packaging and generated POMs pass. Generated legacy sources match the rewriting/override specification.
- ✅ Latest exact-head Java-SDK build passes, including formatting. Local formatters could not download because the Eclipse host did not resolve; CI supplies this evidence.
Review details
Head: ff3d28972c14626f05a04c30499a3cbcebaec723. Base/merge-base: 50b555d194a25e6206d0922acd0fb52b744457af. Round 1. Reviewed supplied head 890a2b2df69aed07bbf93700333bc706d21e3d56 in full, then inspected both subsequent commits (only import sorting and indentation) and revalidated the latest head.
Intent: Primary artifact adopts JDK future/function types and removes streamsupport; generated legacy artifact preserves the prior types and SDK-owned default executor. Version 1.8.0 intentionally changes the public contract; README/changelog explain migration, compatibility floors and selecting only one artifact. No feature flag is involved.
Validation:
- Verified JDK 11;
./gradlew clean buildstopped loading the Eclipse Groovy formatter becausedownload.eclipse.orgdid not resolve. Direct:core-api:spotlessJavaCheckencountered the same DNS limit for JDT. ./gradlew clean build -x spotlessCheckplus both modules'sourcesJar,javadocJar,generatePomFileForReleasePublication, andgenerateMetadataFileForReleasePublication: successful. All four test tasks, both coverage gates and Animal Sniffer tasks executed successfully.- After the formatting-only push:
./gradlew build -x spotlessCheckplus both POM tasks succeeded; generation/compilation reran, Gradle reused unchanged test outputs and the built JARs remained unchanged. XML totals: 584/584/585/585 tests, zero failures/errors/skips. The relocated either-stage test executes in the legacy suite. - Class inspection: primary artifact has 133 classes, all major 52, no
java8/utilreferences; legacy has 135 classes, all major 50, no JDK future/function references. Gradle JVM attributes are 8 and 6. Only legacy POM exposesstreamsupport-minifuture:1.7.4with compile scope. - Independently compared all 78 generated main files and 59 generated test files against exact rewriting/override rules: matched. Source JARs include the proper variant-specific implementation.
- Traced readiness, refresh, publish, HTTP, close, cancellation and exceptional completion. Independent error specialist completed; no PR-caused defect survived. Legacy
SdkFutureis unchanged from base. git diff --checkpassed. Pinned introduced-blob helper completed; inspected 50 content writes through the supplied head and 18 later formatting-only writes, including intermediate content. No secrets or stray artifacts found.- CI run
42914477014, job130173214498, exact latest head: successful. Earlier-head run42913699722failed and is not latest-head evidence; its downloadable logs were inaccessible here. - No oldest-JVM or Android emulator execution: repository-declared API signatures and bytecode inspection check compatibility floors; runtime behavior was exercised on JDK 11/25.
Passes (non-blocking): run: core runtime/API/security/data (executable Java); error handling/messages (future and generator failure paths; delegated specialist completed); tests/CI/packaging (new artifact and modified tests/build); behaviour-bearing configuration (Gradle generation/compatibility); cross-cutting simplicity (independent pass); comment hygiene and diff composition (primary). Not run: deployment/operations/observability (no deployment or emission changes); shared frontend blast radius (no frontend source).
Comment hygiene (non-blocking): 23 comment / 322 code lines, ratio ~1:14, 2 blocks flagged.
threshold T=5; restatements counted: no (10 × C < E)
core-api-java6/build.gradle:11–13: restates the source generation/override code immediately below; optional deletion.gradle/sdk-module.gradle:1: restates which modules apply the shared build; optional deletion.
Other comments preserve compatibility constraints, backport quirks or variant rationale. No qualifying always-counted lines; no promotion.
Diff composition (non-blocking): every file is required for the change; none flagged.
Simplifications (non-blocking): none. Shared build logic, generated legacy sources and small factory/test overrides carry distinct requirements; no equivalent construct-removing simplification established.
jervasion-absmartly
left a comment
There was a problem hiding this comment.
✅ Approved with suggestions
Reconfirmed approval of the requested head. The move from 890a2b2 to ff3d289 consists only of import sorting and Gradle indentation; these changes were already incorporated into my previous review. No new blocking issues or unresolved author questions.
Next step: None — ready to merge.
Suggestions (optional)
- The two optional build-comment cleanup suggestions in the previous review remain unchanged.
What I checked
- ✅ Current head/base match the requested revisions; no code delta exists from the commit already approved.
- ✅ Verified all 18 files changed since the originally supplied head retain identical nonblank, whitespace-normalized line multisets. The inspected changes only reorder imports or adjust indentation;
git diff --checkpasses. - ✅ Exact-head Java-SDK CI remains successful: run 42914477014, build job 130173214498. No commit statuses are posted.
- ✅ Reused the completed same-session validation: 584 primary-artifact and 585 legacy-artifact tests on each of JDK 11/25, API-floor and coverage gates, generation equivalence, bytecode/publication metadata and source/Javadoc packaging.
Review details
Head: ff3d28972c14626f05a04c30499a3cbcebaec723. Base/merge-base: 50b555d194a25e6206d0922acd0fb52b744457af. Round 1 continuation. Previous review 5850547793 already recorded this exact head as APPROVED. Re-read current PR description, top-level discussion, reviews, inline comments and exact-head CI. The author now explicitly describes applying the formatter output in the two style commits; that matches the inspected delta. No additional source changes or review threads were present.
The full runtime, compatibility and packaging evidence, exact build commands and introduced-content audit are preserved in the linked previous review and remain applicable to this identical head. No test suite was rerun in this confirmation turn. Local formatting downloads were previously blocked by Eclipse-host DNS; passing exact-head CI supplies formatting evidence. Oldest JVMs and Android emulators were not executed; compatibility-floor evidence is bytecode inspection plus the repository's Animal Sniffer signatures.
Passes (non-blocking): run this continuation: formatting/import delta correctness, CI selection/build evidence, comment hygiene, diff composition and simplicity. Reused completed full-scope independent runtime/API, tests/packaging, behaviour-bearing Gradle configuration and delegated error-specialist passes from the previous review; no changed failure/message behavior requires a specialist rerun. Not run anew: runtime/error/packaging execution passes (same already-reviewed head, formatting-only movement); deployment/operations/observability (no related changes); shared frontend blast radius (no frontend source).
Comment hygiene (non-blocking): cumulative base-to-head census unchanged: 23 comment / 322 code lines, ratio ~1:14, 2 blocks flagged.
threshold T=5; restatements counted: no (10 × C < E)
core-api-java6/build.gradle:11–13: restates generation/override code; optional deletion.gradle/sdk-module.gradle:1: restates which modules apply the shared build; optional deletion.
No qualifying always-counted lines and no promotion. The formatting delta adds no comment content.
Diff composition (non-blocking): every file is required for the change; none flagged. The previous completed audit covered all 68 content writes through this head, including both style commits; no new content writes since that audit.
Simplifications (non-blocking): none. The formatting delta introduces no new construct; full-scope simplicity result remains unchanged.
Why
streamsupport-minifuture 1.7.4, the final release, breaks on JDK 24+: its
TLRreads the removedThread.inheritedAccessControlContext, and it relies onsun.misc.Unsafe, which JDK 25 already warns about. PR #19 works around this with an SDK-owned executor. This PR goes further and removes the backport from the main artifact.One jar can't switch the type per JDK.
Context.waitUntilReadyAsync(),ABSmartly.getContextData(),HTTPClient,ContextDataProviderandContextEventHandlerare compiled into customer code with the exactCompletableFuturetype, and multi-release jars need an identical public API. So the SDK ships as two artifacts with the same version.Design
com.absmartly.sdk:core-apijava.util.concurrent/java.util.functionjava18:1.0andandroid-api-level-24:7.0_r2com.absmartly.sdk:core-api-java6java8.util.concurrent/java8.util.function(streamsupport-minifuture 1.7.4,api)java16:1.1sourceCompatibility 1.6,targetCompatibility 1.8), and no longer depends on streamsupport.Synctasks (generateMainSources,generateTestSources) copy core-api'ssrc/mainandsrc/testand rewrite onlyjava.util.concurrent.{CompletableFuture,CompletionStage,CompletionException}andjava.util.function.{Function,Consumer,Supplier,BiFunction}(imports and fully-qualified uses) tojava8.util.*. Otherjava.util.concurrentclasses are left alone. A wildcardjava.util.function.*import, or ajava.util.concurrent.*import in a file that usesCompletable*/Completion*, fails the generation instead of silently compiling against the JDK type.core-api/src/java6Mainorcore-api/src/java6Testreplaces the file at the same path, or adds one, in core-api-java6 only.gradle/sdk-module.gradle, applied by both modules: dependencies, jacoco rules (kept on both),test,testJdk25, andSdkVersiongeneration. Both modules are in the publishing list, so each gets a sources jar and a javadoc jar; core-api-java6 builds them from its generated sources.publish.ymlalready runs-x test -x testJdk25, which excludes those tasks in every project. I confirmed with./gradlew -m clean build publish -x test -x testJdk25that neither module runs a test task.build.gradleand one ingradle/compatibility.gradle.SdkFuture / AsyncExecutor
SdkFutureis now variant-specific and lives incore-api/src/java6Main. The SDK creates futures through a smallinternal.Futuresfactory:Futuresreturns plainjava.util.concurrent.CompletableFutures (new CompletableFuture<T>()/completedFuture).FuturesreturnsSdkFutures, so core-api-java6 behaves exactly as in PR fix: support JDK 24+ without breaking backwards compatibility #19, including the either-stage fix that was merged in.Why not keep
SdkFuturein core-api too:defaultExecutor()andnewIncompleteFuture()are Java 9 APIs, andminimalCompletionStage/copydon't exist on Java 8 / Android 24. Its behaviour would differ between Java 8 and Java 9+.super.*Either*, which are Java 8 APIs and would pass animalsniffer. Still, keeping aCompletableFuturesubclass in the main artifact only adds surface.PR #19's later commits are merged in:
SdkFuture.copy()assertion is in the shared returned-futures test.copy()is no longer listed.Does the java.util variant need the either-stage overrides? On JDK 25, a
CompletableFuturesubclass that overridesnewIncompleteFuture()gets a plainCompletableFutureback frompending.applyToEither(completedPlainFuture, fn), and its own type back when the other future is still pending. So the JDK allocates the dependent from whichever source is already complete, just as the backport does. core-api doesn't subclassCompletableFutureat all, though. Every future it returns is already plain and defaults to the JDK common pool, which works on every JDK. So there is nothing to keep, and core-api does not need the overrides.AsyncExecutorstays shared: core-api still runs its internal async steps on it when noClientConfig.setExecutoris set, the same as before.Tests:
returnedFuturesDefaultToSdkExecutorbecamereturnedFuturesUseVariantDefaultExecutorand asserts through a per-variantReturnedFutureshelper:CompletableFutureusing the JDK default executor.AsyncExecutor.get(), the PR fix: support JDK 24+ without breaking backwards compatibility #19 assertion unchanged.eitherStagesWithCompletedPlainFutureDefaultToSdkExecutorbuildsSdkFuturedirectly, so it moved to the java6-onlyinternal/SdkFutureTest.Breaking change (1.8.0)
VERSIONis1.8.0, and the CHANGELOG has a## 1.8.0 (unreleased)section with a Breaking change entry. The README has a compatibility table, Gradle and Maven snippets for both artifacts, and a revised "Java 24 and later" section: core-api has no executor restriction, and PR #19's restrictions apply only to core-api-java6.Who is affected and what to do:
java8.util.concurrent.*orjava8.util.function.*from the SDK API, or that implementsHTTPClient,ContextDataProviderorContextEventHandler: switch the imports tojava.util.concurrent/java.util.function.core-api-java6. No code changes are needed.Verification
./gradlew clean buildwith Gradle on Temurin 11.0.33 and Temurin 25.0.5 as thetestJdk25toolchain ran with-x spotlessCheck(see below). Result: BUILD SUCCESSFUL.:core-api:animalsnifferMain(java18 + android-24),:core-api-java6:animalsnifferMain(java16):core-api:test584 passed,:core-api:testJdk25584 passed:core-api-java6:test585 passed,:core-api-java6:testJdk25585 passed (the extra test is the java6-onlySdkFutureTest)jacocoTestCoverageVerificationpassed for both modulesCompletableFuture.defaultExecutor()was flagged by java18 and android-24, andjava.util.Base64by android-24.javap on the built jars:
ContextDataProvider.getContextData()andContextEventHandler.publish(...)follow the same pattern. The generated POMs: core-api has no streamsupport dependency, and core-api-java6 hasstreamsupport-minifuture:1.7.4with compile scope.Diff between generated and original sources, with the 7 type names normalised:
The grep over main and test sources, including fully-qualified uses, found exactly the 7 types. The only other
java8.mention was a comment aboutTLR.Spotless was not run locally. After a first baseline build succeeded,
archive.eclipse.orgstopped resolving in my environment, and both the JDT and Groovy formatters download from it. CI'sspotlessCheckflagged import order and one Gradle indentation. I applied exactly the diffs CI printed, in the twostyle:commits.Open points
core-api-java6can be revisited.🤖 Generated with Claude Code