Skip to content

Align build to Java 11, add test suite + CI, and code-quality fixes#8

Open
devin-ai-integration[bot] wants to merge 1 commit into
masterfrom
devin/1783436144-java-build-and-test-enhancements
Open

Align build to Java 11, add test suite + CI, and code-quality fixes#8
devin-ai-integration[bot] wants to merge 1 commit into
masterfrom
devin/1783436144-java-build-and-test-enhancements

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Jul 7, 2026

Copy link
Copy Markdown

Summary

Build/config alignment, a real test suite, code-quality cleanups, README fixes, and a CI workflow.

Java version decision (Phase 1): The 2nd-edition examples use APIs added after Java 8 — Optional.or, Optional.stream (chap10), Collectors.flatMapping/filtering (chap6), Stream.takeWhile (chap6). So targeting Java 8 fails to compile. Rather than rewrite pedagogical book code, the project now targets Java 11 (modern LTS), consistent across pom.xml, README.md, and CI.

Phase 1 — build/config (pom.xml)

 <properties>
+  <maven.compiler.release>11</maven.compiler.release>   # was <source>1.9</source>/<target>1.9</target>
+  <jmh.version>1.37</jmh.version>                        # was 1.17.4
 </properties>
- maven-compiler-plugin 3.1                               → 3.13.0 (supports <release>)
- maven-shade-plugin    (no version)                      → 3.5.3 (pinned/reproducible)
- junit 4.11                                              → 4.13.2, scope=test

Phase 2 — testing structure

  • Created src/test/java root.
  • Relocated the misplaced test: src/main/.../chap10/ReadPositiveIntParam.java had a @Test under src/main (never run by Surefire). The example helpers (readDurationImperative, readDurationWithOptional, s2i) stay in src/main; the test moved to src/test/.../chap10/ReadPositiveIntParamTest.java.
  • Added real tests: FilteringApplesTest (chap1) and UtilTest (chap11). 6 tests total, all passing.

Phase 3 — code quality (chap11/Util.java, chap1/FilteringApples.java)

- return new Double(formatter.format(number));          // deprecated ctor
+ return Double.parseDouble(formatter.format(number));
  • Removed the large commented-out allOf-based sequence alternative.
  • Stripped trailing whitespace in chap1/FilteringApples.java.

Phase 4 — README

  • Replaced dead Oracle java8-2100321.html and jdk8.java.net links with Adoptium/Oracle download links.
  • Fixed typo: "Reduntant" → "Redundant".
  • Java version guidance now matches the pom.xml (Java 11) decision.

Phase 5 — CI

  • Added .github/workflows/build.yml: sets up Temurin JDK 11, runs mvn compile then mvn test on push/PR to master.
  • .gitignore: un-ignored .github (previously caught by /.*) and ignored the shade-generated dependency-reduced-pom.xml.

Per the task note, intentionally duplicated per-chapter domain models (e.g. Dish, Apple) were left untouched.

Verified locally: mvn clean verify on JDK 11 → BUILD SUCCESS, 6/6 tests pass, shaded benchmarks.jar produced.

Link to Devin session: https://app.devin.ai/sessions/4a09706b288c4fdabc01517620676128
Requested by: @bnob-git


Devin Review

Status Commit
⚪ Not started

Run Devin Review

Open in Devin Review (Staging)

… fixes

Co-Authored-By: Bobby Nobakht <bobby.nobakht@cognition.ai>
@devin-ai-integration

Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

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.

0 participants