Skip to content

google-java-format fails on Java 25: DeferredDiagnosticHandler.getDiagnostics() removed #363

@tedberg

Description

@tedberg

Environment

  • openapi-processor-spring: 2026.2
  • openapi-processor-maven-plugin: 2026.1
  • openapi-processor-core: 2026.2 (bundles google-java-format 1.24.0)
  • JDK: OpenJDK 25.0.2 (Corretto)

Problem

When format-code: true is set in mapping.yaml, the plugin fails with:

java.lang.NoSuchMethodError: 'java.util.Queue
com.sun.tools.javac.util.Log$DeferredDiagnosticHandler.getDiagnostics()'

DeferredDiagnosticHandler.getDiagnostics() was removed from javac internals
in Java 25. google-java-format 1.24.0 (bundled in openapi-processor-core 2026.2)
calls this method, causing a hard failure — not an accessibility issue, so
--add-opens won't help.

Workaround

Set format-code: false in mapping.yaml and format generated sources separately.

Fix

Update the bundled google-java-format to a version that supports Java 25. Also consider the palantirJavaFormat plugin. This one extends the one from google and it seems to already be Java 25 compatible.

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