diff --git a/pitest-entry/src/main/java/org/pitest/mutationtest/config/PluginServices.java b/pitest-entry/src/main/java/org/pitest/mutationtest/config/PluginServices.java index 97245ddba..4ddf6aad9 100644 --- a/pitest-entry/src/main/java/org/pitest/mutationtest/config/PluginServices.java +++ b/pitest-entry/src/main/java/org/pitest/mutationtest/config/PluginServices.java @@ -5,6 +5,7 @@ import org.pitest.mutationtest.build.MutationGrouperFactory; import org.pitest.mutationtest.build.MutationInterceptorFactory; import org.pitest.mutationtest.build.TestPrioritiserFactory; +import org.pitest.mutationtest.engine.gregor.MethodMutatorFactory; import org.pitest.plugin.ClientClasspathPlugin; import org.pitest.plugin.ProvidesFeature; import org.pitest.plugin.ToolClasspathPlugin; @@ -48,13 +49,19 @@ public Collection findToolClasspathPlugins() { * Lists all plugin classes that must be present on the classpath of the code * under test at runtime */ - public Iterable findClientClasspathPlugins() { + public List findClientClasspathPlugins() { final List l = new ArrayList<>(); l.addAll(findMutationEngines()); + l.addAll(findMutationOperators()); l.addAll(findTestFrameworkPlugins()); l.addAll(nullPlugins()); return l; } + + public Collection findMutationOperators() { + return ServiceLoader.load(MethodMutatorFactory.class, this.loader); + } + Collection findTestFrameworkPlugins() { return ServiceLoader.load(TestPluginFactory.class, this.loader); } diff --git a/pitest-maven/src/main/java/org/pitest/maven/AbstractPitMojo.java b/pitest-maven/src/main/java/org/pitest/maven/AbstractPitMojo.java index 7b7e899b3..a3b56f24e 100644 --- a/pitest-maven/src/main/java/org/pitest/maven/AbstractPitMojo.java +++ b/pitest-maven/src/main/java/org/pitest/maven/AbstractPitMojo.java @@ -9,9 +9,9 @@ import org.pitest.coverage.CoverageSummary; import org.pitest.mutationtest.config.PluginServices; import org.pitest.mutationtest.config.ReportOptions; +import org.pitest.mutationtest.engine.gregor.MethodMutatorFactory; import org.pitest.mutationtest.statistics.MutationStatistics; import org.pitest.mutationtest.tooling.CombinedStatistics; -import org.pitest.plugin.ClientClasspathPlugin; import org.pitest.plugin.ToolClasspathPlugin; import org.slf4j.bridge.SLF4JBridgeHandler; import uk.org.lidalia.sysoutslf4j.context.SysOutOverSLF4J; @@ -405,11 +405,16 @@ public final void execute() throws MojoExecutionException, this.getLog().info("Found plugin : " + each.description()); } - for (final ClientClasspathPlugin each : this.plugins - .findClientClasspathPlugins()) { - this.getLog().info( - "Found shared classpath plugin : " + each.description()); - } + this.plugins.findClientClasspathPlugins().stream() + .filter(p -> !(p instanceof MethodMutatorFactory)) + .forEach(p -> this.getLog().info( + "Found shared classpath plugin : " + p.description())); + + String operators = this.plugins.findMutationOperators().stream() + .map(m -> m.getName()) + .collect(Collectors.joining(",")); + + this.getLog().info("Available mutators : " + operators); final Optional result = analyse(); if (result.isPresent()) { diff --git a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/MethodMutatorFactory.java b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/MethodMutatorFactory.java index 2b496ebdd..550b39822 100644 --- a/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/MethodMutatorFactory.java +++ b/pitest/src/main/java/org/pitest/mutationtest/engine/gregor/MethodMutatorFactory.java @@ -15,6 +15,7 @@ package org.pitest.mutationtest.engine.gregor; import org.objectweb.asm.MethodVisitor; +import org.pitest.plugin.ClientClasspathPlugin; /** * A MethodMutatorFactory is a factory creating method mutating @@ -32,7 +33,7 @@ * * @author Henry Coles */ -public interface MethodMutatorFactory { +public interface MethodMutatorFactory extends ClientClasspathPlugin { MethodVisitor create(MutationContext context, MethodInfo methodInfo, MethodVisitor methodVisitor); @@ -55,4 +56,9 @@ MethodVisitor create(MutationContext context, */ String getName(); + @Override + default String description() { + return getName(); + } + }