From d04b0fde3f735f89e37b15bcef26b44379a13e6e Mon Sep 17 00:00:00 2001 From: Julien HENRY Date: Wed, 11 May 2016 09:13:08 +0200 Subject: [PATCH] SONAR-7612 Rework Initializer extension point to no more require to use Project --- .../java/org/sonar/api/batch/Initializer.java | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/Initializer.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/Initializer.java index 66e2f9f27db..2a5ec53ff73 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/Initializer.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/Initializer.java @@ -20,26 +20,39 @@ package org.sonar.api.batch; import org.sonar.api.ExtensionPoint; +import org.sonar.api.batch.fs.FileSystem; import org.sonar.api.resources.Project; /** *

- * Initializer can execute external tool (like a Maven plugin), change project configuration. For example CoberturaMavenInitializer invokes - * the Codehaus Cobertura Mojo and sets path to Cobertura report according to Maven POM. + * Initializer are executed at the very beginning of each module analysis, prior the core listing files to be analyzed. It means {@link FileSystem} should not be accessed. *

- * Initializers are executed first and once during project analysis. * @since 2.6 */ @BatchSide @ExtensionPoint public abstract class Initializer implements CheckProject { + /** + * @deprecated since 5.6 should no more be implemented by plugins + */ + @Deprecated @Override public boolean shouldExecuteOnProject(Project project) { return true; } - public abstract void execute(Project project); + /** + * @deprecated since 5.6 override {@link #execute()} instead + */ + @Deprecated + public void execute(Project project) { + execute(); + } + + public void execute() { + // To be implemented by client + } @Override public String toString() { -- 2.39.5