Skip to content

Rename @PluginProvides provides member to value #729

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import io.avaje.inject.spi.InjectPlugin;
import io.avaje.inject.spi.PluginProvides;

@PluginProvides(provides = PluginProvidedClass.class)
@PluginProvides(PluginProvidedClass.class)
public class AspectPlugin implements InjectPlugin {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ private static void addPluginToScope(ScopeInfo defaultScope, TypeElement pluginT
return;
}
var prism = PluginProvidesPrism.getInstanceOn(pluginType);
for (final var provide : prism.provides()) {
for (final var provide : prism.value()) {
defaultScope.pluginProvided(provide.toString());
}
for (final var provide : prism.providesStrings()) {
Expand Down
15 changes: 8 additions & 7 deletions inject/src/main/java/io/avaje/inject/spi/PluginProvides.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@
import java.lang.annotation.Target;

/**
* Registers {@link InjectPlugin} classes for auto-detection.
* <p>
* Plugins can be registered traditionally via service loading etc but
* if we use this {@code @PluginProvides} annotation, then avaje inject
* can ALSO auto-detect the plugin and the types that it provides.
* Otherwise, we need to use Maven/Gradle plugins to perform this detection.
* Registers {@link InjectPlugin} classes for auto-detection with JPMS.
*
* <p>Plugins can be registered with the ServiceLoader manually, but manually registered plugins may cause dependency missing
* errors to consumers using JPMS. (This can be fixed if the consumer uses the inject maven/gradle plugin)
*
* <p>If we use this {@code @PluginProvides} annotation, then avaje inject can auto-detect the
* plugin and the types that it provides when a consumer uses JPMS. This eliminates the need for a plugin consumer to take action.
*/
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.CLASS)
Expand All @@ -20,7 +21,7 @@
/**
* The types this plugin provides.
*/
Class<?>[] provides() default {};
Class<?>[] value() default {};

/**
* Fully Qualified Strings of the classes provided. Use when providing generic types
Expand Down