Repository navigation
Upgrade to Java 21: sample.daytrader3 - #2
Open
devin-ai-integration[bot] wants to merge 1 commit into
Open
devin-ai-integration[bot] wants to merge 1 commit into
devin-ai-integration[bot] wants to merge 1 commit into
Conversation
Co-Authored-By: Achal Channarasappa <achal.channarasappa@cognition.ai>
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
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.
Summary
Migrates DayTrader3 (an online stock-trading benchmark: login, portfolio, quotes, buy/sell, holdings) from Java 8 / Java EE 6 to build and run on Java 21, while preserving externally observable trading behavior. No domain/business logic is changed — the change set is confined to build config, a Derby CVE bump, added regression tests, CI and docs. Jira: JEFF-DT3-JAVA21.
Full written migration plan is in
MIGRATION.md(architecture, Java 8 assumptions, required vs. optional work, high-risk trade-path items).Migration summary (what changed & why)
The app compiled against
-source/-target 1.7, which javac 21 rejects, and used two API groups removed from the JDK in Java 11 (JEP 320). Those APIs are re-added as explicit dependencies keeping thejavax.*namespace, so no source code changes were needed:javax.xml.bind(JAXB) — used by the REST address-book sample →javax.xml.bind:jaxb-api(provided).javax.annotation(@PostConstruct/@Resource) — used by EJB + web modules →javax.annotation:javax.annotation-api(provided).Compiler targets set to Java 21 in Maven (root
pom.xmlmaven.compiler.release=21+ pinned modern plugin versions) and Gradle (sourceCompatibility/targetCompatibility = VERSION_21per module). One EAR-plugin config had to be modernized (fileNameMappingwas removed in maven-ear-plugin 3.0.0 →outputFileNameMapping).Architecture summary
Maven+Gradle multi-module reactor targeting WebSphere Liberty:
daytrader3-ee6-ejb(JPA entities + EJB/JDBC business logic) → packaged withdaytrader3-ee6-web(servlets/JSP/JSF) anddaytrader3-ee6-rest(JAX-RS) into thedaytrader3-ee6EAR;daytrader3-ee6-wlpcfgholds Liberty server config. All EE APIs are container-provided; the JDK removals above only affect compile-time classpath. The Java EE 6 (javax.*) programming model is intentionally retained — a Jakarta EE (jakarta.*) migration is a separate, larger effort and is out of scope.Changed dependencies + reasons
org.apache.derby:derby(+ newderbyshared,derbytools)javax.xml.bind:jaxb-apijavax.annotation:javax.annotation-apiorg.junit.jupiter:junit-jupiterSecurity findings addressed
Derby 10.10.1.1 → 10.17.1.0 remediates:
Test evidence
Repo previously shipped no tests. Added 27 JUnit 5 regression tests in
daytrader3-ee6-ejb/src/testcovering the requested surfaces:OrderDataBeanTest(buy/sell classification, open/processing/completed/cancelled, symbol resolution,24.95fee).QuoteDataBeanTest.BuySellExecutionTest(balance debit = cost + fee; credit = proceeds − fee; round-trip P&L) +TradeConfigTest(fee schedule) +MarketSummaryDataBeanTest.HoldingDataBeanTest,FinancialUtilsTest(gain, gain %, holdings total).CI runs
mvn clean packageon Temurin 21 (new.github/workflows/ci.yml;.travis.ymlJDK bumped to 21).packagestops before the integration-test phases, so unit CI does not require downloading/running Liberty.Remaining risks
TradeDirectare unchanged, but the runtime now needsderbyshared/derbytoolson the server classpath (added to the EAR copy step). Money math should be re-verified against a running Liberty + Derby server.BigDecimal(double)constructors remain (compile with warnings only) — intentionally left to avoid trade-path churn.Human-review checklist
derby/derbyshared/derbytools10.17.1.0.javax.*(not Jakarta) is still the intended runtime target.Rollback guidance
Change set is limited to build files, Derby version, test sources, CI and docs — no schema or business-logic changes, so no data migration.
derby.versionwhile keeping the Java 21 compiler settings.Link to Devin session: https://app.devin.ai/sessions/3c4680e962e14711bdd913a76d01de25
Requested by: @achalc
Devin Review