BUILD: Target Java 8 for the published library.#1
Open
oleksandrlazarenko-pi wants to merge 1 commit into
Open
Conversation
This was referenced Jun 29, 2026
Jamesr51d
approved these changes
Jul 2, 2026
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
Lowers the compile target of the shipped library from Java 21 to Java 8, so
the artifact can be consumed by projects on a Java 8 baseline. Test sources keep
using modern language features and are compiled at a newer release. One Java 11
API call in
Io.javais replaced with its Java 8 equivalent.Motivation
We'd like to build on
owid-javafrom SDKs that still target Java 8 (in ourcase the 51Degrees
pipeline-java). The library's source is almost entirelyJava 8-compatible already — only the build target and a single JDK 11 API stand
in the way. This change makes the published jar usable on Java 8 runtimes
without affecting behaviour or the development experience.
Changes
pom.xml— setmaven.compiler.releaseto8for the main sources.Added a
default-testCompileexecution at release17, because the testsources use records (
FixturesTest) andList.of(...), which are not part ofthe shipped artifact.
Io.java— replaced the threeByteArrayOutputStream.writeBytes(byte[])calls (added in Java 11) with
write(b, 0, b.length). This was the only JDK9+ API used in the main sources.
Compatibility & behaviour
ByteArrayOutputStream.write(byte[], int, int)writes the same bytes and, unlike the inherited
OutputStream.write(byte[]),does not declare
IOException, so no signatures or call sites change.modified.
Building
release 17. Only the main artifact targets Java 8.
ci.yml) runsmvn teston JDK 21 across ubuntu + windows; both pass.Locally:
Owid.classis major version 52, and an independentjavac --release 8of the main sources compiles cleanly (no Java 9+ API).Notes for reviewers
test-only usages (
record Fixtures,List.of) can be backported as well —happy to fold that in if you want a single uniform release level.