Skip to content

Take the plugin descriptor from PluginAware, not from PluginManager - #81

Merged
abashev merged 4 commits into
mainfrom
plugin-descriptor-public-api
Sep 25, 2026
Merged

abashev merged 4 commits into
mainfrom
plugin-descriptor-public-api

Conversation

@abashev

@abashev abashev commented Sep 25, 2026

Copy link
Copy Markdown
Collaborator

The IntelliJ plugin found its own descriptor through PluginManager.findEnabledPlugin(PluginId). In 2026.2 that method is @ApiStatus.Internal, and so is every other way of looking a plugin up by id or by class (PluginManagerCore.getPlugin, PluginManager.getPluginByClass, getLoadedPlugins, PluginAwareClassLoader); the plugin verifier reports the usage against IU-262.

The formatting service now implements PluginAware: the platform hands it the descriptor of the plugin that declares it in plugin.xml, and FormatterProvider.getPluginDescriptor() reaches that service through the formattingService extension point (ExtensionPointName.findExtensionOrFail). PluginAware, PluginDescriptor.getPluginPath()/getVersion() and findExtensionOrFail carry no ApiStatus annotation in 2024.2.6 or 2026.2.3 (checked in the jars). Behaviour is unchanged: the bundled formatter is still found under <plugin dir>/impl, and the settings page still shows the plugin's version, now pinned by a test.

Neither the settings service nor the configurable could take the descriptor directly: the platform injects it only into extension instances it creates from plugin.xml (XmlExtensionAdapter), not into services, and not into a configurable created through ConfigurableEP. A service the test creates with new is given the descriptor of the one the platform created, before the extension point is masked.

Verification:

  • ./gradlew :open-java-format-idea-plugin:test: 10 tests pass.
  • ./gradlew :open-java-format-idea-plugin:verifyPlugin, run with the verifier configuration from Publish the IntelliJ plugin to the JetBrains Marketplace on release #80 applied locally (main has none yet; none of it is in this PR): IU-262.10968.63 "Compatible. 1 usage of deprecated API. 2 usages of experimental API", IC-242.26775.15 "Compatible. 2 usages of experimental API". internal-api-usages.txt is gone from the IU report. What remains is TrustedProjects.isTrusted, which stays because its replacement is internal.

Once #80 is in, the comment on failureLevel in build.gradle still names findEnabledPlugin as the example; the setting itself is unchanged here.

The IntelliJ plugin found its own descriptor through
PluginManager.findEnabledPlugin(PluginId), which 2026.2 marks
@ApiStatus.Internal, as it does every other way of looking a plugin up
by id or by class; the plugin verifier reports the usage against IU-262.

The formatting service now implements PluginAware, so the platform hands
it the descriptor of the plugin that declares it in plugin.xml, and
FormatterProvider.getPluginDescriptor() reaches that service through the
formattingService extension point. Both are public API in 2024.2 and in
2026.2. The bundled formatter is still found under <plugin dir>/impl and
the settings page still shows the plugin's version.

A service the tests create with `new` is given the descriptor of the one
the platform created, before the extension point is masked.
CI checks the repository out with fetch-depth 1, so there are no tags
and git-version stamps the plugin with a commit hash; FormatterVersion
does not parse that, and the test failed there while passing locally.
The test now checks what it is for: the settings page has a version to
show, taken from the plugin's own descriptor.

Also puts the import blocks of the previous commit in the order the
repository's formatter keeps, and breaks the long chain as it would.
@abashev
abashev merged commit b853b9f into main Sep 25, 2026
15 checks passed
@abashev
abashev deleted the plugin-descriptor-public-api branch September 25, 2026 17:46
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.

1 participant