Conversation
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.
Java 21 Upgrade — Executive Report
📋 Executive Summary
The
java-dataloaderlibrary (a pure Java port of Facebook DataLoader, used as a core component in GraphQL Java execution pipelines) was successfully upgraded from Java 11 to Java 21. The upgrade was performed using OpenRewrite's automated migration recipe (com.amazonaws.java.migrate.UpgradeToJava21), followed by a targeted manual fix applied by Amazon Kiro CLI to resolve a post-migration build incompatibility. The project now compiles cleanly, and the full test suite passes with zero errors.🔧 Application Changes
java-dataloader— a pure Java utility library providing DataLoader batching/caching for GraphQL Java🛠️ Tools Used
com.amazonaws.java.migrate.UpgradeToJava21kiro-cli 2.0.1(Claude Sonnet 4)💻 Code Changes
Automated by OpenRewrite
build.gradle— Java toolchain version updated toJavaLanguageVersion.of(21);options.releaseset to21src/main/java/org/dataloader/DataLoaderHelper.java— AppliedInstanceOfPatternMatch(pattern variable ininstanceof) andSequencedCollection/ListFirstAndLastmigrations (e.g..get(0)→.getFirst())src/main/java/org/dataloader/registries/ScheduledDataLoaderRegistry.java— AppliedInstanceOfPatternMatchmodernisationsrc/main/java/org/dataloader/instrumentation/ChainedDataLoaderInstrumentation.java— AppliedSequencedCollection/ListFirstAndLastmigrationssrc/main/java/org/dataloader/DataLoaderRegistry.java— AppliedInstanceOfPatternMatchandString.formatted()migrationsrc/test/java/ReadmeExamples.java— AppliedString.formatted()migrationsrc/test/java/org/dataloader/DataLoaderCacheMapTest.java— AppliedListFirstAndLastmigrationsrc/test/java/org/dataloader/DataLoaderTest.java— AppliedListFirstAndLastmigrationsrc/test/java/org/dataloader/DataLoaderStatsTest.java— AppliedListFirstAndLastmigrationManual fix by Amazon Kiro CLI
build.gradle— Kotlin compiler optionjvmTargetcorrected fromJvmTarget.JVM_11→JvmTarget.JVM_21jvmTarget, causing Gradle's JVM target consistency validation to fail (compileTestJavatargeted JVM 21 whilecompileTestKotlinstill targeted JVM 11)⏱️ Time Savings Estimate
✅ Next Steps
Validation
getFirst()/getLast()substitutions (they are API-equivalent but worth a human sanity check on ordering assumptions)jcstressconcurrency stress tests (./gradlew jcstress) to validate thread-safety under the new JVM./gradlew jmh) to establish a Java 21 performance baselineAutomatic-Module-Name: org.dataloader) is still correct in the produced JARImprovement Recommendations
Thread.ofVirtual()) as aBatchLoaderexecution option — the library's heavy use ofCompletableFuturewith async dispatch is a natural fitREADME.mdand POM description — both still reference "pure Java 11 port"; update to reflect Java 21 baselineAnnotatedPackages: org.dataloader) now that the codebase is on Java 21 and JSpecify annotations are already a declared API dependencyorg.openrewrite.java.migrate.UpgradeToJava21recipe's remaining sub-recipes (e.g.UseTextBlocks,MigrateToRecordswhere applicable)Credit usage
💳 Kiro CLI credits used: 2.19