From b9cb350a697c895ad9fb71e2faae445abb7ef454 Mon Sep 17 00:00:00 2001 From: Ilpo Ruotsalainen Date: Mon, 11 Feb 2019 13:31:45 +0100 Subject: Mark abi-check-plugin as thread safe. Quick code review suggests this is okay as long as per-lookup instantiation strategy is used. --- .../src/main/java/com/yahoo/abicheck/mojo/AbiCheck.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/abi-check-plugin/src/main/java/com/yahoo/abicheck/mojo/AbiCheck.java b/abi-check-plugin/src/main/java/com/yahoo/abicheck/mojo/AbiCheck.java index 2ee7bd495b3..a09e23bbe9e 100644 --- a/abi-check-plugin/src/main/java/com/yahoo/abicheck/mojo/AbiCheck.java +++ b/abi-check-plugin/src/main/java/com/yahoo/abicheck/mojo/AbiCheck.java @@ -1,6 +1,5 @@ package com.yahoo.abicheck.mojo; -import com.google.common.collect.Ordering; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.reflect.TypeToken; @@ -29,6 +28,7 @@ import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugin.logging.Log; +import org.apache.maven.plugins.annotations.InstantiationStrategy; import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; @@ -39,13 +39,16 @@ import org.objectweb.asm.ClassReader; @Mojo( name = "abicheck", defaultPhase = LifecyclePhase.PACKAGE, - requiresDependencyResolution = ResolutionScope.RUNTIME + requiresDependencyResolution = ResolutionScope.RUNTIME, + instantiationStrategy = InstantiationStrategy.PER_LOOKUP, + threadSafe = true ) public class AbiCheck extends AbstractMojo { public static final String PACKAGE_INFO_CLASS_FILE_NAME = "package-info.class"; private static final String DEFAULT_SPEC_FILE = "abi-spec.json"; private static final String WRITE_SPEC_PROPERTY = "abicheck.writeSpec"; + @Parameter(defaultValue = "${project}", readonly = true) private MavenProject project = null; -- cgit v1.2.3