Skip to content

More refactorings for 2.1#6

Merged
poikilotherm merged 9 commits into
mainfrom
refactor-for-2.1-release
May 5, 2026
Merged

More refactorings for 2.1#6
poikilotherm merged 9 commits into
mainfrom
refactor-for-2.1-release

Conversation

@poikilotherm
Copy link
Copy Markdown
Member

  • Switch plugins to no longer use ServiceLoader, use a custom loader instead. Avoids the problems involved with ServiceLoader always trying to also load any plugins on the core classpath when we're rely only trying to load the plugin
  • Docs docs docs
  • More tests

For some reason different JDKs seem to generate slightly different messages for non-repeatable annotations ("type" vs "interface"). Removing the word fixes the flakyness.
…Environment`

- Extend `LoaderTestEnvironment.Builder` with `addCoreProcessor` to register core annotation processors.
- Update `build` method to include core processors during compilation.
- Simplify plugin processor setup by directly chaining `withProcessors`.
…vironment`

Update `LoaderTestEnvironment` to use the containing directory of the JAR file when packaging a plugin, ensuring compatibility with full directory scanning, as the plugin loader expects a directory.
…n `PluginLoaderIntegrationTest`

- Add `name` attribute to `@ParameterizedTest` to improve test case readability when running with varied core and plugin API levels.
…tory loading

- Replace `@Test` with `@ParameterizedTest` using `@ValueSource` to improve test coverage for both JAR and directory packaging scenarios.
- Wrap plugin loading assertions in a `try-catch` block to provide detailed failure information in case of a `LoaderException`.
- Remove usage of Java's default ServiceLoader for plugin initialization to avoid class loading conflicts.
- Introduce `LoaderHelper.loadPluginClass` for custom plugin loading with collision detection and validation.
- Update `PluginLoader` to use the custom loader, improving reliability and maintainability.
…niqueness and collision handling

- Clarify guarantees of plugin identity and class name uniqueness among loaded plugins.
- Add `@apiNote` regarding collision verification responsibility for external plugins.
- Introduce comprehensive documentation for the `io.gdcc.spi.core.loader` package, detailing its responsibility for runtime plugin discovery, validation, and loading.
- Highlight key features, such as validation-first design, contract-based loading, and configurable strictness.
- Include usage examples and clarify non-supported features like hot reload or legacy plugin compatibility.
- Update `PluginLoader` Javadoc with notes on its custom descriptor-based mechanism, emphasizing the transition away from Java SPI.
- Introduce package-level documentation for `processor`, `annotations`, `plugin`, and `descriptor` packages.
- Detail annotation-processing support, core SPI contracts, and metadata discovery mechanisms.
- Provide examples for plugin implementors and SPI authors, emphasizing descriptor-based discovery over legacy approaches.
@poikilotherm poikilotherm merged commit 568a47b into main May 5, 2026
1 check passed
@poikilotherm poikilotherm deleted the refactor-for-2.1-release branch May 5, 2026 22:14
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