Skip to content

Commit d628768

Browse files
authored
Rename @PluginProvides provides member to value (#729)
* rename provides to value * Update AspectPlugin.java
1 parent c5af7ac commit d628768

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

blackbox-aspect/src/main/java/org/example/external/aspect/spi/AspectPlugin.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import io.avaje.inject.spi.InjectPlugin;
77
import io.avaje.inject.spi.PluginProvides;
88

9-
@PluginProvides(provides = PluginProvidedClass.class)
9+
@PluginProvides(PluginProvidedClass.class)
1010
public class AspectPlugin implements InjectPlugin {
1111

1212
@Override

inject-generator/src/main/java/io/avaje/inject/generator/ExternalProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ private static void addPluginToScope(ScopeInfo defaultScope, TypeElement pluginT
204204
return;
205205
}
206206
var prism = PluginProvidesPrism.getInstanceOn(pluginType);
207-
for (final var provide : prism.provides()) {
207+
for (final var provide : prism.value()) {
208208
defaultScope.pluginProvided(provide.toString());
209209
}
210210
for (final var provide : prism.providesStrings()) {

inject/src/main/java/io/avaje/inject/spi/PluginProvides.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@
66
import java.lang.annotation.Target;
77

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

2526
/**
2627
* Fully Qualified Strings of the classes provided. Use when providing generic types

0 commit comments

Comments
 (0)