Skip to content

chore: build and test on JDK 21 and 25 (#2095) - #2411

Open
vinirib wants to merge 1 commit into
swagger-api:masterfrom
vinirib:issue-2095
Open

vinirib wants to merge 1 commit into
swagger-api:masterfrom
vinirib:issue-2095

Conversation

@vinirib

@vinirib vinirib commented Oct 29, 2026

Copy link
Copy Markdown

Description

The build fails on JDK 21 and 25 for two independent reasons. This PR fixes both and adds those JDKs to the PR build matrix so they stay green. The compiler target stays at Java 8, so the published artifacts do not change.

JDK 21 and 25: PermittedUrlsCheckerTest. 15 tests fail with class redefinition failed: attempted to change the class NestHost, NestMembers.... @Mocked NetUtils makes JMockit 1.49 cascade-mock the InetAddress return type, and redefining that JDK class is rejected on 21+. The test now uses Mockito 4.11 mockStatic, the last Mockito line that still runs on Java 8, with Byte Buddy 1.18.16 so it can instrument on JDK 25. Test names, data providers and expected exceptions are unchanged. The JMockit tests in swagger-parser-v3 pass on 21 and 25 and are left as they are.

JDK 25: javadoc. maven-javadoc-plugin fails swagger-parser-core with Unexpected redirection for URL http://docs.oracle.com/javase/8/docs/api/element-list, because Oracle now redirects that URL and javadoc 25 treats it as an error. The hardcoded <link> is removed, so the plugin uses its bundled Java 8 package list. Generated docs still link to https://docs.oracle.com/javase/8/docs/api/, and the build no longer needs network access for it.

CI. maven-pulls.yml matrix goes from [ 11, 17 ] to [ 11, 17, 21, 25 ]. maven.yml (push and snapshot deploy) is untouched.

Fixes: #2095

Type of Change

  • 🐛 Bug fix
  • ✨ New feature
  • ♻️ Refactor (non-breaking change)
  • 🧪 Tests
  • 📝 Documentation
  • 🧹 Chore (build or tooling)

Checklist

  • I have added/updated tests as needed
  • I have added/updated documentation where applicable
  • The PR title is descriptive
  • The code builds and passes tests locally
  • I have linked related issues (if any)

Screenshots / Additional Context

mvn --no-transfer-progress -B install (the PR workflow command), run locally on each JDK:

JDK Result
11 BUILD SUCCESS, no test failures
17 BUILD SUCCESS, no test failures
21 BUILD SUCCESS, no test failures
25 BUILD SUCCESS, no test failures

On current master, 21 fails in swagger-parser-safe-url-resolver and 25 fails in both swagger-parser-core and swagger-parser-safe-url-resolver.

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.

tests fail on Java 21 (works on Java 17)

1 participant