Skip to content

Commit f839cc1

Browse files
Add default implementation for new method in MavenPluginManager
MavenPluginManager can be implemented by user extension new method in interface can brake an implementation. We can add default implementation in interface to avoid braking change.
1 parent 0a7e149 commit f839cc1

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

maven-core/src/main/java/org/apache/maven/plugin/MavenPluginManager.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,19 @@ MojoDescriptor getMojoDescriptor(
7474
* @deprecated Use {@link #checkPrerequisites(PluginDescriptor)} instead.
7575
*/
7676
@Deprecated
77-
void checkRequiredMavenVersion(PluginDescriptor pluginDescriptor) throws PluginIncompatibleException;
77+
default void checkRequiredMavenVersion(PluginDescriptor pluginDescriptor) throws PluginIncompatibleException {
78+
checkPrerequisites(pluginDescriptor);
79+
}
7880

7981
/**
8082
* Verifies that the specified plugin's prerequisites are met.
8183
*
8284
* @param pluginDescriptor The descriptor of the plugin to check, must not be {@code null}.
8385
* @since 3.9.12
8486
*/
85-
void checkPrerequisites(PluginDescriptor pluginDescriptor) throws PluginIncompatibleException;
87+
default void checkPrerequisites(PluginDescriptor pluginDescriptor) throws PluginIncompatibleException {
88+
checkRequiredMavenVersion(pluginDescriptor);
89+
}
8690

8791
/**
8892
* Sets up the class realm for the specified plugin. Both the class realm and the plugin artifacts that constitute

maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultMavenPluginManager.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -309,12 +309,6 @@ public void checkPrerequisites(PluginDescriptor pluginDescriptor) throws PluginI
309309
}
310310
}
311311

312-
@Override
313-
@Deprecated
314-
public void checkRequiredMavenVersion(PluginDescriptor pluginDescriptor) throws PluginIncompatibleException {
315-
checkPrerequisites(pluginDescriptor);
316-
}
317-
318312
public void setupPluginRealm(
319313
PluginDescriptor pluginDescriptor,
320314
MavenSession session,

0 commit comments

Comments
 (0)