Skip to content

tests fail on Java 21 (works on Java 17) #2095

Open

Description

@taylortails

mvn clean verify results in

PermittedUrlsCheckerTest failure

UnsupportedOperation class redefinition failed: attempted to change the class NestHost, NestMembers, Record, or PermittedSubclasses attribute

I guess because Mockit doesnt support Java 21.

Are there any plans here? Migrate to Mockito 4? (Mockito 5 drops Java 8 support).

Activity

  1. vinirib commented on Oct 29, 2026

    @vinirib

    Still reproducible on current master (2.1.49-SNAPSHOT), and JDK 25 adds a second failure. Results of mvn -B install:

    • JDK 21 and 25: 15 tests in PermittedUrlsCheckerTest (swagger-parser-safe-url-resolver) 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+. It is the only test class affected: the other modules, including the JMockit tests in swagger-parser-v3, pass on both JDKs.
    • JDK 25 only: maven-javadoc-plugin fails swagger-parser-core with Unexpected redirection for URL http://docs.oracle.com/javase/8/docs/api/element-list. Oracle now redirects that URL, and javadoc 25 treats the redirect as an error.

    I'd like to work on this. The plan: migrate PermittedUrlsCheckerTest to Mockito 4.11 mockStatic (still Java 8 compatible), drop the hardcoded javadoc link so the plugin uses its bundled Java 8 package list, and add 21 and 25 to the PR build matrix. The compiler target stays at Java 8.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions