Skip to content

IntelliJ plugin: every format opens the build's formatter jars to read the version, and never closes them #258

Closed

Description

@abashev

What happens

In a project whose .idea/open-java-format.xml has an implementationClassPath, which the dev.openjavaformat.java-format-idea Gradle plugin writes, the IntelliJ plugin opens formatter jars for every Reformat and every Optimize imports, and never closes them.

FormatterProvider.get builds its cache key with settings.injectedVersionIsOutdated(), so that runs before the cache is asked. It calls PalantirJavaFormatSettings.computeFormatterVersion, which goes through the class path with new JarFile(uri.getPath()) until it finds the jar with META-INF/services/com.palantir.javaformat.java.FormatterService, and reads Implementation-Version from its manifest:

JarFile jar = new JarFile(uri.getPath());
// Identify the implementation jar by the service it produces.
if (jar.getEntry("META-INF/services/" + FormatterService.class.getName()) != null) {

No JarFile is closed: each stays open until the garbage collector gets to it.

Why it matters now

Read from the code, not measured.

A project without an implementationClassPath, which formats with the formatter bundled with the plugin, opens nothing: computeFormatterVersion returns before it.

Proposal

Activity

  1. added
    bug
    on Nov 22, 2026
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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions