diff --git a/.gitmodules b/.gitmodules
index 82fbf4f..c029ccf 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,3 +1,3 @@
[submodule "src/test/resources"]
path = src/test/resources
- url = git@github.com:git-commit-id/git-test-resources.git
+ url = https://github.com/git-commit-id/git-test-resources.git
diff --git a/pom.xml b/pom.xml
index de348e3..00136ed 100644
--- a/pom.xml
+++ b/pom.xml
@@ -55,17 +55,6 @@
3.27.7
-
-
-
- com.google.code.findbugs
- jsr305
- 3.0.2
- true
-
-
-
-
@@ -239,15 +228,10 @@
org.eclipse.jgit.ssh.jsch
${jgit.version}
-
-
- joda-time
- joda-time
- 2.14.1
-
- com.google.code.findbugs
- jsr305
+ org.jspecify
+ jspecify
+ 1.0.0
nu.studer
@@ -314,7 +298,7 @@
org.slf4j
slf4j-simple
- 2.0.17
+ 1.7.36
test
diff --git a/src/main/java/pl/project13/core/GitCommitIdPlugin.java b/src/main/java/pl/project13/core/GitCommitIdPlugin.java
index 83fd130..981a3c9 100644
--- a/src/main/java/pl/project13/core/GitCommitIdPlugin.java
+++ b/src/main/java/pl/project13/core/GitCommitIdPlugin.java
@@ -17,14 +17,14 @@
package pl.project13.core;
+import org.jspecify.annotations.NonNull;
+import org.jspecify.annotations.Nullable;
import pl.project13.core.cibuild.BuildServerDataProvider;
import pl.project13.core.git.GitDescribeConfig;
import pl.project13.core.log.LogInterface;
import pl.project13.core.util.BuildFileChangeListener;
import pl.project13.core.util.GitDirLocator;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
import java.io.File;
import java.nio.charset.Charset;
import java.nio.file.Path;
@@ -55,14 +55,14 @@ default Map getSystemEnv() {
/**
* @return Logging Interface
*/
- @Nonnull
+ @NonNull
LogInterface getLogInterface();
/**
* @return The date format to be used for any dates exported by this plugin.
* It should be a valid {@link SimpleDateFormat} string.
*/
- @Nonnull
+ @NonNull
String getDateFormat();
/**
@@ -74,7 +74,7 @@ default Map getSystemEnv() {
*
* @return The timezone used in the date format of dates exported by this plugin.
*/
- @Nonnull
+ @NonNull
String getDateFormatTimeZone();
/**
@@ -82,7 +82,7 @@ default Map getSystemEnv() {
*
* @return The prefix to expose the properties on.
*/
- @Nonnull
+ @NonNull
String getPrefixDot();
/**
@@ -297,7 +297,7 @@ default Map getSystemEnv() {
protected static final Pattern allowedCharactersForEvaluateOnCommit = Pattern.compile("[a-zA-Z0-9\\_\\-\\^\\/\\.]+");
- public static void runPlugin(@Nonnull Callback cb, @Nullable Properties contextProperties) throws GitCommitIdExecutionException {
+ public static void runPlugin(@NonNull Callback cb, @Nullable Properties contextProperties) throws GitCommitIdExecutionException {
PropertiesFilterer propertiesFilterer = new PropertiesFilterer(cb.getLogInterface());
// The properties we store our data in and then expose them.
@@ -334,7 +334,7 @@ public static void runPlugin(@Nonnull Callback cb, @Nullable Properties contextP
cb.performPublishToAllSystemEnvironments(properties);
}
- protected static void loadBuildData(@Nonnull Callback cb, @Nonnull Properties properties) throws GitCommitIdExecutionException {
+ protected static void loadBuildData(@NonNull Callback cb, @NonNull Properties properties) throws GitCommitIdExecutionException {
Map> additionalProperties = Collections.singletonMap(
GitCommitPropertyConstant.BUILD_VERSION, cb.supplyProjectVersion());
BuildServerDataProvider buildServerDataProvider = BuildServerDataProvider.getBuildServerProvider(
@@ -349,7 +349,7 @@ protected static void loadBuildData(@Nonnull Callback cb, @Nonnull Properties pr
buildServerDataProvider.loadBuildData(properties, cb.getReproducibleBuildOutputTimestamp());
}
- protected static void loadGitData(@Nonnull Callback cb, @Nonnull Properties properties) throws GitCommitIdExecutionException {
+ protected static void loadGitData(@NonNull Callback cb, @NonNull Properties properties) throws GitCommitIdExecutionException {
String evaluateOnCommit = cb.getEvaluateOnCommit();
if ((evaluateOnCommit == null) || !allowedCharactersForEvaluateOnCommit.matcher(evaluateOnCommit).matches()) {
throw new GitCommitIdExecutionException("suspicious argument for evaluateOnCommit, aborting execution!");
@@ -375,9 +375,9 @@ protected static void loadGitData(@Nonnull Callback cb, @Nonnull Properties prop
}
private static void loadGitDataWithNativeGit(
- @Nonnull Callback cb,
- @Nonnull File dotGitDirectory,
- @Nonnull Properties properties) throws GitCommitIdExecutionException {
+ @NonNull Callback cb,
+ @NonNull File dotGitDirectory,
+ @NonNull Properties properties) throws GitCommitIdExecutionException {
GitDataProvider nativeGitProvider = NativeGitProvider
.on(dotGitDirectory, cb.getNativeGitTimeoutInMs(), cb.getLogInterface());
@@ -387,9 +387,9 @@ private static void loadGitDataWithNativeGit(
}
private static void loadGitDataWithJGit(
- @Nonnull Callback cb,
- @Nonnull File dotGitDirectory,
- @Nonnull Properties properties) throws GitCommitIdExecutionException {
+ @NonNull Callback cb,
+ @NonNull File dotGitDirectory,
+ @NonNull Properties properties) throws GitCommitIdExecutionException {
GitDataProvider jGitProvider = JGitProvider
.on(dotGitDirectory, cb.getLogInterface());
@@ -399,9 +399,9 @@ private static void loadGitDataWithJGit(
}
private static void configureCommonProvider(
- @Nonnull GitDataProvider provider,
- @Nonnull Callback cb,
- @Nonnull File dotGitDirectory) {
+ @NonNull GitDataProvider provider,
+ @NonNull Callback cb,
+ @NonNull File dotGitDirectory) {
provider
.setPrefixDot(cb.getPrefixDot())
.setAbbrevLength(cb.getAbbrevLength())
@@ -425,7 +425,7 @@ private static void configureCommonProvider(
* Returns null if the project directory is not within the repository or if resolution fails.
*/
@Nullable
- private static String resolveRelativeModulePath(@Nonnull Callback cb, @Nonnull File dotGitDirectory) {
+ private static String resolveRelativeModulePath(@NonNull Callback cb, @NonNull File dotGitDirectory) {
try {
// Determine repository work tree
// If dotGitDirectory is named ".git", the work tree is its parent
diff --git a/src/main/java/pl/project13/core/GitDataProvider.java b/src/main/java/pl/project13/core/GitDataProvider.java
index 237b8c9..14f0f40 100644
--- a/src/main/java/pl/project13/core/GitDataProvider.java
+++ b/src/main/java/pl/project13/core/GitDataProvider.java
@@ -17,13 +17,13 @@
package pl.project13.core;
+import org.jspecify.annotations.NonNull;
import pl.project13.core.git.GitDescribeConfig;
import pl.project13.core.cibuild.BuildServerDataProvider;
import pl.project13.core.cibuild.UnknownBuildServerData;
import pl.project13.core.log.LogInterface;
import pl.project13.core.util.PropertyManager;
-import javax.annotation.Nonnull;
import java.net.URI;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
@@ -44,7 +44,7 @@ public abstract class GitDataProvider implements GitProvider {
/**
* Logging provider which will be used to log events.
*/
- @Nonnull
+ @NonNull
protected final LogInterface log;
/**
@@ -126,7 +126,7 @@ public abstract class GitDataProvider implements GitProvider {
* Constructor to encapsulates all references required to dertermine all git-data.
* @param log logging provider which will be used to log events
*/
- public GitDataProvider(@Nonnull LogInterface log) {
+ public GitDataProvider(@NonNull LogInterface log) {
this.log = log;
}
@@ -268,7 +268,7 @@ public GitDataProvider setPathFilter(String pathFilter) {
* @param properties The Properties-Set that should be enriched by the generated one.
* @throws GitCommitIdExecutionException In case any problem occurred during loading of the properties from the git repository.
*/
- protected void loadGitData(@Nonnull String evaluateOnCommit, @Nonnull Map env, @Nonnull Properties properties) throws GitCommitIdExecutionException {
+ protected void loadGitData(@NonNull String evaluateOnCommit, @NonNull Map env, @NonNull Properties properties) throws GitCommitIdExecutionException {
this.evaluateOnCommit = evaluateOnCommit;
init();
// git.user.name
@@ -337,7 +337,7 @@ protected void loadGitData(@Nonnull String evaluateOnCommit, @Nonnull Map env) throws GitCommitIdExecutionException {
+ protected String determineBranchName(@NonNull Map env) throws GitCommitIdExecutionException {
BuildServerDataProvider buildServerDataProvider = BuildServerDataProvider.getBuildServerProvider(env, log);
if (useBranchNameFromBuildEnvironment && !(buildServerDataProvider instanceof UnknownBuildServerData)) {
String branchName = buildServerDataProvider.getBuildBranch();
@@ -404,7 +404,7 @@ protected SimpleDateFormat getSimpleDateFormatWithTimeZone() {
return smf;
}
- protected void maybePut(@Nonnull Properties properties, String key, SupplierEx value)
+ protected void maybePut(@NonNull Properties properties, String key, SupplierEx value)
throws GitCommitIdExecutionException {
String keyWithPrefix = prefixDot + key;
if (properties.stringPropertyNames().contains(keyWithPrefix)) {
@@ -531,4 +531,4 @@ protected String stripCredentialsFromOriginUrl(String gitRemoteString) throws Gi
return "";
}
}
-}
\ No newline at end of file
+}
diff --git a/src/main/java/pl/project13/core/JGitProvider.java b/src/main/java/pl/project13/core/JGitProvider.java
index 22bbfe8..435b499 100644
--- a/src/main/java/pl/project13/core/JGitProvider.java
+++ b/src/main/java/pl/project13/core/JGitProvider.java
@@ -27,6 +27,8 @@
import org.eclipse.jgit.storage.file.FileRepositoryBuilder;
import org.eclipse.jgit.util.FS;
+import org.jspecify.annotations.NonNull;
+import org.jspecify.annotations.Nullable;
import pl.project13.core.jgit.DescribeResult;
import pl.project13.core.jgit.JGitCommon;
import pl.project13.core.jgit.DescribeCommand;
@@ -40,9 +42,6 @@
import org.eclipse.jgit.storage.file.WindowCacheConfig;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-
public class JGitProvider extends GitDataProvider {
private File dotGitDirectory;
@@ -52,12 +51,12 @@ public class JGitProvider extends GitDataProvider {
private RevCommit evalCommit;
private JGitCommon jGitCommon;
- @Nonnull
- public static JGitProvider on(@Nonnull File dotGitDirectory, @Nonnull LogInterface log) {
+ @NonNull
+ public static JGitProvider on(@NonNull File dotGitDirectory, @NonNull LogInterface log) {
return new JGitProvider(dotGitDirectory, log);
}
- JGitProvider(@Nonnull File dotGitDirectory, @Nonnull LogInterface log) {
+ JGitProvider(@NonNull File dotGitDirectory, @NonNull LogInterface log) {
super(log);
this.dotGitDirectory = dotGitDirectory;
FS.FileStoreAttributes.setBackground(true);
@@ -130,7 +129,7 @@ public void prepareGitToExtractMoreDetailedRepoInformation() throws GitCommitIdE
* Returns the commit hash or null if no commits found.
*/
@Nullable
- private String findLatestCommitForPath(@Nonnull String path) throws GitCommitIdExecutionException {
+ private String findLatestCommitForPath(@NonNull String path) throws GitCommitIdExecutionException {
try {
ObjectId start = git.resolve(evaluateOnCommit);
if (start == null) {
@@ -412,7 +411,7 @@ private String getAbbrevCommitId(ObjectReader objectReader, RevCommit headCommit
}
}
- @Nonnull
+ @NonNull
private Repository getGitRepository() throws GitCommitIdExecutionException {
Repository repository;
diff --git a/src/main/java/pl/project13/core/NativeGitProvider.java b/src/main/java/pl/project13/core/NativeGitProvider.java
index 8cda37e..140f40f 100644
--- a/src/main/java/pl/project13/core/NativeGitProvider.java
+++ b/src/main/java/pl/project13/core/NativeGitProvider.java
@@ -19,11 +19,11 @@
import static java.lang.String.format;
+import org.jspecify.annotations.NonNull;
+import org.jspecify.annotations.Nullable;
import pl.project13.core.git.GitDescribeConfig;
import pl.project13.core.log.LogInterface;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
import java.io.*;
import java.text.SimpleDateFormat;
@@ -44,12 +44,12 @@ public class NativeGitProvider extends GitDataProvider {
final File canonical;
- @Nonnull
- public static NativeGitProvider on(@Nonnull File dotGitDirectory, long nativeGitTimeoutInMs, @Nonnull LogInterface log) {
+ @NonNull
+ public static NativeGitProvider on(@NonNull File dotGitDirectory, long nativeGitTimeoutInMs, @NonNull LogInterface log) {
return new NativeGitProvider(dotGitDirectory, nativeGitTimeoutInMs, log);
}
- NativeGitProvider(@Nonnull File dotGitDirectory, long nativeGitTimeoutInMs, @Nonnull LogInterface log) {
+ NativeGitProvider(@NonNull File dotGitDirectory, long nativeGitTimeoutInMs, @NonNull LogInterface log) {
super(log);
this.dotGitDirectory = dotGitDirectory;
this.nativeGitTimeoutInMs = nativeGitTimeoutInMs;
@@ -251,7 +251,7 @@ public String getCommitId() throws GitCommitIdExecutionException {
* Returns the commit hash or null if no commits found.
*/
@Nullable
- private String findLatestCommitForPath(@Nonnull String path) throws GitCommitIdExecutionException {
+ private String findLatestCommitForPath(@NonNull String path) throws GitCommitIdExecutionException {
try {
return runQuietGitCommand(
canonical, nativeGitTimeoutInMs,
diff --git a/src/main/java/pl/project13/core/PropertiesFileGenerator.java b/src/main/java/pl/project13/core/PropertiesFileGenerator.java
index 45d3a5c..a568a35 100644
--- a/src/main/java/pl/project13/core/PropertiesFileGenerator.java
+++ b/src/main/java/pl/project13/core/PropertiesFileGenerator.java
@@ -18,10 +18,10 @@
package pl.project13.core;
import nu.studer.java.util.OrderedProperties;
+import org.jspecify.annotations.NonNull;
import pl.project13.core.log.LogInterface;
import pl.project13.core.util.*;
-import javax.annotation.Nonnull;
import java.io.*;
import java.nio.charset.Charset;
import java.util.Comparator;
@@ -44,7 +44,7 @@ public PropertiesFileGenerator(LogInterface log, BuildFileChangeListener buildFi
}
public void maybeGeneratePropertiesFile(
- @Nonnull Properties localProperties,
+ @NonNull Properties localProperties,
File projectDir,
File propsFile,
Charset sourceCharset,
diff --git a/src/main/java/pl/project13/core/PropertiesFilterer.java b/src/main/java/pl/project13/core/PropertiesFilterer.java
index 37f6ef5..aa602ea 100644
--- a/src/main/java/pl/project13/core/PropertiesFilterer.java
+++ b/src/main/java/pl/project13/core/PropertiesFilterer.java
@@ -20,9 +20,9 @@
import java.util.List;
import java.util.Properties;
+import org.jspecify.annotations.Nullable;
import pl.project13.core.log.LogInterface;
-import javax.annotation.Nullable;
public class PropertiesFilterer {
diff --git a/src/main/java/pl/project13/core/cibuild/AwsCodeBuildBuildServerData.java b/src/main/java/pl/project13/core/cibuild/AwsCodeBuildBuildServerData.java
index 141e545..a9abf03 100644
--- a/src/main/java/pl/project13/core/cibuild/AwsCodeBuildBuildServerData.java
+++ b/src/main/java/pl/project13/core/cibuild/AwsCodeBuildBuildServerData.java
@@ -17,16 +17,16 @@
package pl.project13.core.cibuild;
+import org.jspecify.annotations.NonNull;
import pl.project13.core.GitCommitPropertyConstant;
import pl.project13.core.log.LogInterface;
-import javax.annotation.Nonnull;
import java.util.Map;
import java.util.Properties;
public class AwsCodeBuildBuildServerData extends BuildServerDataProvider {
- AwsCodeBuildBuildServerData(LogInterface log, @Nonnull Map env) {
+ AwsCodeBuildBuildServerData(LogInterface log, @NonNull Map env) {
super(log,env);
}
@@ -40,7 +40,7 @@ public static boolean isActiveServer(Map env) {
}
@Override
- void loadBuildNumber(@Nonnull Properties properties) {
+ void loadBuildNumber(@NonNull Properties properties) {
String buildNumber = env.getOrDefault("CODEBUILD_BUILD_NUMBER", "");
maybePut(properties, GitCommitPropertyConstant.BUILD_NUMBER, () -> buildNumber);
diff --git a/src/main/java/pl/project13/core/cibuild/AzureDevOpsBuildServerData.java b/src/main/java/pl/project13/core/cibuild/AzureDevOpsBuildServerData.java
index 5eaf657..31a4f95 100644
--- a/src/main/java/pl/project13/core/cibuild/AzureDevOpsBuildServerData.java
+++ b/src/main/java/pl/project13/core/cibuild/AzureDevOpsBuildServerData.java
@@ -17,16 +17,16 @@
package pl.project13.core.cibuild;
+import org.jspecify.annotations.NonNull;
import pl.project13.core.log.LogInterface;
import pl.project13.core.GitCommitPropertyConstant;
-import javax.annotation.Nonnull;
import java.util.Map;
import java.util.Properties;
public class AzureDevOpsBuildServerData extends BuildServerDataProvider {
- AzureDevOpsBuildServerData(@Nonnull LogInterface log, @Nonnull Map env) {
+ AzureDevOpsBuildServerData(@NonNull LogInterface log, @NonNull Map env) {
super(log, env);
}
@@ -35,12 +35,12 @@ public class AzureDevOpsBuildServerData extends BuildServerDataProvider {
* @return true, if the system environment variables contain the Azure specific environment variable; false otherwise
* @see Azure DevOps - Build variables
*/
- public static boolean isActiveServer(@Nonnull Map env) {
+ public static boolean isActiveServer(@NonNull Map env) {
return env.containsKey("AZURE_HTTP_USER_AGENT") || env.containsKey("TF_BUILD");
}
@Override
- void loadBuildNumber(@Nonnull Properties properties) {
+ void loadBuildNumber(@NonNull Properties properties) {
String buildNumber = env.getOrDefault("BUILD_BUILDNUMBER", "");
maybePut(properties, GitCommitPropertyConstant.BUILD_NUMBER, () -> buildNumber);
diff --git a/src/main/java/pl/project13/core/cibuild/BambooBuildServerData.java b/src/main/java/pl/project13/core/cibuild/BambooBuildServerData.java
index 2b100b7..6943e16 100644
--- a/src/main/java/pl/project13/core/cibuild/BambooBuildServerData.java
+++ b/src/main/java/pl/project13/core/cibuild/BambooBuildServerData.java
@@ -17,15 +17,15 @@
package pl.project13.core.cibuild;
+import org.jspecify.annotations.NonNull;
import pl.project13.core.GitCommitPropertyConstant;
import pl.project13.core.log.LogInterface;
-import javax.annotation.Nonnull;
import java.util.*;
public class BambooBuildServerData extends BuildServerDataProvider {
- BambooBuildServerData(LogInterface log, @Nonnull Map env) {
+ BambooBuildServerData(LogInterface log, @NonNull Map env) {
super(log, env);
}
@@ -41,7 +41,7 @@ public static boolean isActiveServer(Map env) {
}
@Override
- void loadBuildNumber(@Nonnull Properties properties) {
+ void loadBuildNumber(@NonNull Properties properties) {
String buildNumber = Optional.ofNullable(env.get("bamboo.buildNumber"))
.or(() -> Optional.ofNullable(env.get("BAMBOO_BUILDNUMBER")))
.orElseGet(() -> env.getOrDefault("bamboo_buildNumber", ""));
diff --git a/src/main/java/pl/project13/core/cibuild/BitbucketBuildServerData.java b/src/main/java/pl/project13/core/cibuild/BitbucketBuildServerData.java
index 7f4fa56..efa0dd5 100644
--- a/src/main/java/pl/project13/core/cibuild/BitbucketBuildServerData.java
+++ b/src/main/java/pl/project13/core/cibuild/BitbucketBuildServerData.java
@@ -17,17 +17,17 @@
package pl.project13.core.cibuild;
+import org.jspecify.annotations.NonNull;
import pl.project13.core.GitCommitPropertyConstant;
import pl.project13.core.log.LogInterface;
import java.util.Map;
import java.util.Optional;
import java.util.Properties;
-import javax.annotation.Nonnull;
public class BitbucketBuildServerData extends BuildServerDataProvider {
- BitbucketBuildServerData(LogInterface log, @Nonnull Map env) {
+ BitbucketBuildServerData(LogInterface log, @NonNull Map env) {
super(log, env);
}
@@ -41,7 +41,7 @@ public static boolean isActiveServer(Map env) {
}
@Override
- void loadBuildNumber(@Nonnull Properties properties) {
+ void loadBuildNumber(@NonNull Properties properties) {
String buildNumber = Optional.ofNullable(env.get("BITBUCKET_BUILD_NUMBER")).orElse("");
maybePut(properties, GitCommitPropertyConstant.BUILD_NUMBER, () -> buildNumber);
diff --git a/src/main/java/pl/project13/core/cibuild/BuildServerDataProvider.java b/src/main/java/pl/project13/core/cibuild/BuildServerDataProvider.java
index 8b171ab..70b9512 100644
--- a/src/main/java/pl/project13/core/cibuild/BuildServerDataProvider.java
+++ b/src/main/java/pl/project13/core/cibuild/BuildServerDataProvider.java
@@ -17,13 +17,13 @@
package pl.project13.core.cibuild;
+import org.jspecify.annotations.NonNull;
+import org.jspecify.annotations.Nullable;
import pl.project13.core.GitCommitPropertyConstant;
import pl.project13.core.PropertiesFilterer;
import pl.project13.core.log.LogInterface;
import pl.project13.core.util.PropertyManager;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.text.SimpleDateFormat;
@@ -43,22 +43,22 @@ public abstract class BuildServerDataProvider {
protected static final String PULL_REQUEST_REF_PREFIX = "refs/pull/";
protected static final String TAG_REF_PREFIX = "refs/tags/";
- BuildServerDataProvider(@Nonnull LogInterface log, @Nonnull Map env) {
+ BuildServerDataProvider(@NonNull LogInterface log, @NonNull Map env) {
this.log = log;
this.env = env;
}
- public BuildServerDataProvider setDateFormat(@Nonnull String dateFormat) {
+ public BuildServerDataProvider setDateFormat(@NonNull String dateFormat) {
this.dateFormat = dateFormat;
return this;
}
- public BuildServerDataProvider setDateFormatTimeZone(@Nonnull String dateFormatTimeZone) {
+ public BuildServerDataProvider setDateFormatTimeZone(@NonNull String dateFormatTimeZone) {
this.dateFormatTimeZone = dateFormatTimeZone;
return this;
}
- public BuildServerDataProvider setPrefixDot(@Nonnull String prefixDot) {
+ public BuildServerDataProvider setPrefixDot(@NonNull String prefixDot) {
this.prefixDot = prefixDot;
return this;
}
@@ -85,7 +85,7 @@ public BuildServerDataProvider setAdditionalProperties(Map env, @Nonnull LogInterface log) {
+ public static BuildServerDataProvider getBuildServerProvider(@NonNull Map env, @NonNull LogInterface log) {
if (BambooBuildServerData.isActiveServer(env)) {
return new BambooBuildServerData(log, env);
}
@@ -119,7 +119,7 @@ public static BuildServerDataProvider getBuildServerProvider(@Nonnull Map buildTimeSupplier = () -> {
Date buildDate = (reproducibleBuildOutputTimestamp == null) ? new Date() : reproducibleBuildOutputTimestamp;
SimpleDateFormat smf = new SimpleDateFormat(dateFormat);
@@ -157,7 +157,7 @@ private void loadBuildVersionAndTimeData(@Nonnull Properties properties, @Nullab
}
}
- private void loadBuildHostData(@Nonnull Properties properties) {
+ private void loadBuildHostData(@NonNull Properties properties) {
Supplier buildHostSupplier = () -> {
String buildHost = null;
try {
@@ -173,7 +173,7 @@ private void loadBuildHostData(@Nonnull Properties properties) {
maybePut(properties, GitCommitPropertyConstant.BUILD_HOST, buildHostSupplier);
}
- protected void maybePut(@Nonnull Properties properties, @Nonnull String key, Supplier supplier) {
+ protected void maybePut(@NonNull Properties properties, @NonNull String key, Supplier supplier) {
String keyWithPrefix = prefixDot + key;
if (properties.stringPropertyNames().contains(keyWithPrefix)) {
String propertyValue = properties.getProperty(keyWithPrefix);
diff --git a/src/main/java/pl/project13/core/cibuild/CircleCiBuildServerData.java b/src/main/java/pl/project13/core/cibuild/CircleCiBuildServerData.java
index a56bab9..7e39189 100644
--- a/src/main/java/pl/project13/core/cibuild/CircleCiBuildServerData.java
+++ b/src/main/java/pl/project13/core/cibuild/CircleCiBuildServerData.java
@@ -17,16 +17,16 @@
package pl.project13.core.cibuild;
+import org.jspecify.annotations.NonNull;
import pl.project13.core.GitCommitPropertyConstant;
import pl.project13.core.log.LogInterface;
-import javax.annotation.Nonnull;
import java.util.Map;
import java.util.Properties;
public class CircleCiBuildServerData extends BuildServerDataProvider {
- CircleCiBuildServerData(LogInterface log, @Nonnull Map env) {
+ CircleCiBuildServerData(LogInterface log, @NonNull Map env) {
super(log,env);
}
@@ -40,7 +40,7 @@ public static boolean isActiveServer(Map env) {
}
@Override
- void loadBuildNumber(@Nonnull Properties properties) {
+ void loadBuildNumber(@NonNull Properties properties) {
String buildNumber = env.getOrDefault("CIRCLE_BUILD_NUM", "");
maybePut(properties, GitCommitPropertyConstant.BUILD_NUMBER, () -> buildNumber);
}
diff --git a/src/main/java/pl/project13/core/cibuild/GitHubBuildServerData.java b/src/main/java/pl/project13/core/cibuild/GitHubBuildServerData.java
index 1b88fdb..76c3a43 100644
--- a/src/main/java/pl/project13/core/cibuild/GitHubBuildServerData.java
+++ b/src/main/java/pl/project13/core/cibuild/GitHubBuildServerData.java
@@ -17,15 +17,15 @@
package pl.project13.core.cibuild;
+import org.jspecify.annotations.NonNull;
import pl.project13.core.GitCommitPropertyConstant;
import pl.project13.core.log.LogInterface;
-import javax.annotation.Nonnull;
import java.util.Map;
import java.util.Properties;
public class GitHubBuildServerData extends BuildServerDataProvider {
- GitHubBuildServerData(LogInterface log, @Nonnull Map env) {
+ GitHubBuildServerData(LogInterface log, @NonNull Map env) {
super(log, env);
}
@@ -39,7 +39,7 @@ public static boolean isActiveServer(Map env) {
}
@Override
- void loadBuildNumber(@Nonnull Properties properties) {
+ void loadBuildNumber(@NonNull Properties properties) {
String runId = env.getOrDefault("GITHUB_RUN_ID", "0");
String runNumber = env.getOrDefault("GITHUB_RUN_NUMBER", "0");
String runAttempt = env.getOrDefault("GITHUB_RUN_ATTEMPT", "0");
diff --git a/src/main/java/pl/project13/core/cibuild/GitlabBuildServerData.java b/src/main/java/pl/project13/core/cibuild/GitlabBuildServerData.java
index d8d6ab4..4c00235 100644
--- a/src/main/java/pl/project13/core/cibuild/GitlabBuildServerData.java
+++ b/src/main/java/pl/project13/core/cibuild/GitlabBuildServerData.java
@@ -17,16 +17,16 @@
package pl.project13.core.cibuild;
+import org.jspecify.annotations.NonNull;
import pl.project13.core.GitCommitPropertyConstant;
import pl.project13.core.log.LogInterface;
-import javax.annotation.Nonnull;
import java.util.Map;
import java.util.Properties;
public class GitlabBuildServerData extends BuildServerDataProvider {
- GitlabBuildServerData(LogInterface log, @Nonnull Map env) {
+ GitlabBuildServerData(LogInterface log, @NonNull Map env) {
super(log,env);
}
@@ -41,7 +41,7 @@ public static boolean isActiveServer(Map env) {
}
@Override
- void loadBuildNumber(@Nonnull Properties properties) {
+ void loadBuildNumber(@NonNull Properties properties) {
// GITLAB CI
// CI_PIPELINE_ID will be present if in a Gitlab CI environment (Gitlab >8.10 & Gitlab CI >0.5) and contains a server wide unique ID for a pipeline run
String uniqueBuildNumber = env.getOrDefault("CI_PIPELINE_ID", "");
diff --git a/src/main/java/pl/project13/core/cibuild/HudsonJenkinsBuildServerData.java b/src/main/java/pl/project13/core/cibuild/HudsonJenkinsBuildServerData.java
index 5f61a6f..bdd1247 100644
--- a/src/main/java/pl/project13/core/cibuild/HudsonJenkinsBuildServerData.java
+++ b/src/main/java/pl/project13/core/cibuild/HudsonJenkinsBuildServerData.java
@@ -17,16 +17,16 @@
package pl.project13.core.cibuild;
+import org.jspecify.annotations.NonNull;
import pl.project13.core.GitCommitPropertyConstant;
import pl.project13.core.log.LogInterface;
-import javax.annotation.Nonnull;
import java.util.Map;
import java.util.Properties;
public class HudsonJenkinsBuildServerData extends BuildServerDataProvider {
- HudsonJenkinsBuildServerData(@Nonnull LogInterface log, @Nonnull Map env) {
+ HudsonJenkinsBuildServerData(@NonNull LogInterface log, @NonNull Map env) {
super(log, env);
}
@@ -35,13 +35,13 @@ public class HudsonJenkinsBuildServerData extends BuildServerDataProvider {
* @return true, if the system environment variables contain the Hudson/Jenkins specific environment variable; false otherwise
* @see JenkinsSetEnvironmentVariables
*/
- public static boolean isActiveServer(@Nonnull Map env) {
+ public static boolean isActiveServer(@NonNull Map env) {
return env.containsKey("JENKINS_URL") || env.containsKey("JENKINS_HOME") ||
env.containsKey("HUDSON_URL") || env.containsKey("HUDSON_HOME");
}
@Override
- void loadBuildNumber(@Nonnull Properties properties) {
+ void loadBuildNumber(@NonNull Properties properties) {
String buildNumber = env.getOrDefault("BUILD_NUMBER", "");
maybePut(properties, GitCommitPropertyConstant.BUILD_NUMBER, () -> buildNumber);
diff --git a/src/main/java/pl/project13/core/cibuild/TeamCityBuildServerData.java b/src/main/java/pl/project13/core/cibuild/TeamCityBuildServerData.java
index 9d5ef00..74bdcba 100644
--- a/src/main/java/pl/project13/core/cibuild/TeamCityBuildServerData.java
+++ b/src/main/java/pl/project13/core/cibuild/TeamCityBuildServerData.java
@@ -17,10 +17,10 @@
package pl.project13.core.cibuild;
+import org.jspecify.annotations.NonNull;
import pl.project13.core.log.LogInterface;
import pl.project13.core.GitCommitPropertyConstant;
-import javax.annotation.Nonnull;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Map;
@@ -30,7 +30,7 @@ public class TeamCityBuildServerData extends BuildServerDataProvider {
private final Properties teamcitySystemProperties = new Properties();
- TeamCityBuildServerData(@Nonnull LogInterface log, @Nonnull Map env) {
+ TeamCityBuildServerData(@NonNull LogInterface log, @NonNull Map env) {
super(log, env);
if (isActiveServer(env)) {
//https://confluence.jetbrains.com/display/TCD18/Predefined+Build+Parameters
@@ -47,12 +47,12 @@ public class TeamCityBuildServerData extends BuildServerDataProvider {
* @return true, if the system environment variables contain the TeamCity specific environment variable; false otherwise
* @see TeamCity
*/
- public static boolean isActiveServer(@Nonnull Map env) {
+ public static boolean isActiveServer(@NonNull Map env) {
return env.containsKey("TEAMCITY_VERSION");
}
@Override
- void loadBuildNumber(@Nonnull Properties properties) {
+ void loadBuildNumber(@NonNull Properties properties) {
String buildNumber = env.getOrDefault("BUILD_NUMBER", "");
String buildNumberUnique = teamcitySystemProperties.getProperty("teamcity.build.id", "");
diff --git a/src/main/java/pl/project13/core/cibuild/TravisBuildServerData.java b/src/main/java/pl/project13/core/cibuild/TravisBuildServerData.java
index c355fc2..4583578 100644
--- a/src/main/java/pl/project13/core/cibuild/TravisBuildServerData.java
+++ b/src/main/java/pl/project13/core/cibuild/TravisBuildServerData.java
@@ -17,16 +17,16 @@
package pl.project13.core.cibuild;
+import org.jspecify.annotations.NonNull;
import pl.project13.core.GitCommitPropertyConstant;
import pl.project13.core.log.LogInterface;
-import javax.annotation.Nonnull;
import java.util.Map;
import java.util.Properties;
public class TravisBuildServerData extends BuildServerDataProvider {
- TravisBuildServerData(LogInterface log, @Nonnull Map env) {
+ TravisBuildServerData(LogInterface log, @NonNull Map env) {
super(log, env);
}
@@ -35,12 +35,12 @@ public class TravisBuildServerData extends BuildServerDataProvider {
* @return true, if the system environment variables contain the Travis specific environment variable; false otherwise
* @see Travis
*/
- public static boolean isActiveServer(@Nonnull Map env) {
+ public static boolean isActiveServer(@NonNull Map env) {
return env.containsKey("TRAVIS");
}
@Override
- void loadBuildNumber(@Nonnull Properties properties) {
+ void loadBuildNumber(@NonNull Properties properties) {
String buildNumber = env.getOrDefault("TRAVIS_BUILD_NUMBER", "");
String uniqueBuildNumber = env.getOrDefault("TRAVIS_BUILD_ID", "");
diff --git a/src/main/java/pl/project13/core/cibuild/UnknownBuildServerData.java b/src/main/java/pl/project13/core/cibuild/UnknownBuildServerData.java
index 7cb9c0c..3dbd8c1 100644
--- a/src/main/java/pl/project13/core/cibuild/UnknownBuildServerData.java
+++ b/src/main/java/pl/project13/core/cibuild/UnknownBuildServerData.java
@@ -17,19 +17,19 @@
package pl.project13.core.cibuild;
+import org.jspecify.annotations.NonNull;
import pl.project13.core.log.LogInterface;
-import javax.annotation.Nonnull;
import java.util.Map;
import java.util.Properties;
public class UnknownBuildServerData extends BuildServerDataProvider {
- public UnknownBuildServerData(@Nonnull LogInterface log, @Nonnull Map env) {
+ public UnknownBuildServerData(@NonNull LogInterface log, @NonNull Map env) {
super(log, env);
}
@Override
- void loadBuildNumber(@Nonnull Properties properties) {
+ void loadBuildNumber(@NonNull Properties properties) {
}
@Override
diff --git a/src/main/java/pl/project13/core/example/GitRepositoryState.java b/src/main/java/pl/project13/core/example/GitRepositoryState.java
index 0ae3162..8457752 100644
--- a/src/main/java/pl/project13/core/example/GitRepositoryState.java
+++ b/src/main/java/pl/project13/core/example/GitRepositoryState.java
@@ -17,7 +17,8 @@
package pl.project13.core.example;
-import javax.annotation.Nonnull;
+import org.jspecify.annotations.NonNull;
+
import java.util.Set;
/**
@@ -178,7 +179,7 @@ public String toJson() {
return sb.append("}").toString();
}
- private void appendProperty(@Nonnull StringBuilder sb, String label, String value) {
+ private void appendProperty(@NonNull StringBuilder sb, String label, String value) {
sb.append(String.format("\"%s\": \"%s\",", label, value));
}
diff --git a/src/main/java/pl/project13/core/jgit/DescribeCommand.java b/src/main/java/pl/project13/core/jgit/DescribeCommand.java
index 798c214..dacee09 100644
--- a/src/main/java/pl/project13/core/jgit/DescribeCommand.java
+++ b/src/main/java/pl/project13/core/jgit/DescribeCommand.java
@@ -25,12 +25,12 @@
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.revwalk.RevCommit;
+import org.jspecify.annotations.NonNull;
+import org.jspecify.annotations.Nullable;
import pl.project13.core.git.GitDescribeConfig;
import pl.project13.core.log.LogInterface;
import pl.project13.core.util.Pair;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
import java.io.IOException;
import java.util.*;
@@ -84,12 +84,12 @@ public class DescribeCommand extends GitCommand {
* @param log logger bridge to direct logs to
* @return itself with the options set as specified by the arguments to allow fluent configuration
*/
- @Nonnull
+ @NonNull
public static DescribeCommand on(String evaluateOnCommit, Repository repo, LogInterface log) {
return new DescribeCommand(evaluateOnCommit, repo, log, null);
}
- @Nonnull
+ @NonNull
public static DescribeCommand on(String evaluateOnCommit, Repository repo, LogInterface log, String pathFilter) {
return new DescribeCommand(evaluateOnCommit, repo, log, pathFilter);
}
@@ -102,7 +102,7 @@ public static DescribeCommand on(String evaluateOnCommit, Repository repo, LogIn
* @param log logger bridge to direct logs to
* @return itself with the options set as specified by the arguments to allow fluent configuration
*/
- private DescribeCommand(@Nonnull String evaluateOnCommit, @Nonnull Repository repo, @Nonnull LogInterface log, String pathFilter) {
+ private DescribeCommand(@NonNull String evaluateOnCommit, @NonNull Repository repo, @NonNull LogInterface log, String pathFilter) {
super(repo);
this.evaluateOnCommit = evaluateOnCommit;
this.jGitCommon = new JGitCommon(log);
@@ -120,7 +120,7 @@ private DescribeCommand(@Nonnull String evaluateOnCommit, @Nonnull Repository re
* @param always set to `true` when you want the describe command show uniquely abbreviated commit object as fallback.
* @return itself with the `--always` option set as specified by the argument to allow fluent configuration
*/
- @Nonnull
+ @NonNull
public DescribeCommand always(boolean always) {
this.alwaysFlag = always;
log.debug(String.format("--always = %s", always));
@@ -141,7 +141,7 @@ public DescribeCommand always(boolean always) {
* @param forceLongFormat set to `true` if you always want to output the long format
* @return itself with the `--long` option set as specified by the argument to allow fluent configuration
*/
- @Nonnull
+ @NonNull
public DescribeCommand forceLongFormat(@Nullable Boolean forceLongFormat) {
if (forceLongFormat != null && forceLongFormat) {
this.forceLongFormat = true;
@@ -161,7 +161,7 @@ public DescribeCommand forceLongFormat(@Nullable Boolean forceLongFormat) {
* @param n the length of the abbreviated object name
* @return itself with the `--abbrev` option set as specified by the argument to allow fluent configuration
*/
- @Nonnull
+ @NonNull
public DescribeCommand abbrev(@Nullable Integer n) {
if (n != null) {
if (n >= 41) {
@@ -207,7 +207,7 @@ public DescribeCommand abbrev(@Nullable Integer n) {
* @param includeLightweightTagsInSearch set to `true` if you want to matching a lightweight (non-annotated) tag
* @return itself with the `--tags` option set as specified by the argument to allow fluent configuration
*/
- @Nonnull
+ @NonNull
public DescribeCommand tags(@Nullable Boolean includeLightweightTagsInSearch) {
if (includeLightweightTagsInSearch != null && includeLightweightTagsInSearch) {
tagsFlag = includeLightweightTagsInSearch;
@@ -231,7 +231,7 @@ public DescribeCommand tags() {
* @param config A configuration that shall be applied to the current one
* @return itself, after applying the settings
*/
- @Nonnull
+ @NonNull
public DescribeCommand apply(@Nullable GitDescribeConfig config) {
if (config != null) {
always(config.isAlways());
@@ -252,7 +252,7 @@ public DescribeCommand apply(@Nullable GitDescribeConfig config) {
* @param dirtyMarker the marker name to be appended to the describe output when the workspace is dirty
* @return itself with the `--dirty` option set as specified by the argument to allow fluent configuration
*/
- @Nonnull
+ @NonNull
public DescribeCommand dirty(@Nullable String dirtyMarker) {
Optional option = Optional.ofNullable(dirtyMarker);
log.debug(String.format("--dirty = %s", option.orElse("")));
@@ -267,7 +267,7 @@ public DescribeCommand dirty(@Nullable String dirtyMarker) {
* @param pattern the glob style pattern to match against the tag names
* @return itself with the `--match` option set as specified by the argument to allow fluent configuration
*/
- @Nonnull
+ @NonNull
public DescribeCommand match(@Nullable String pattern) {
if (!"*".equals(pattern)) {
matchOption = Optional.ofNullable(pattern);
@@ -377,7 +377,7 @@ private DescribeResult createDescribeResult(ObjectReader objectReader, ObjectId
}
}
- private static boolean foundZeroTags(@Nonnull Map> tags) {
+ private static boolean foundZeroTags(@NonNull Map> tags) {
return tags.isEmpty();
}
@@ -387,11 +387,11 @@ boolean findDirtyState(Repository repo) throws GitAPIException {
}
// Visible for testing
- static boolean hasTags(ObjectId headCommit, @Nonnull Map> tagObjectIdToName) {
+ static boolean hasTags(ObjectId headCommit, @NonNull Map> tagObjectIdToName) {
return tagObjectIdToName.containsKey(headCommit);
}
- RevCommit findEvalCommitObjectId(@Nonnull String evaluateOnCommit, @Nonnull Repository repo) throws RuntimeException {
+ RevCommit findEvalCommitObjectId(@NonNull String evaluateOnCommit, @NonNull Repository repo) throws RuntimeException {
return jGitCommon.findEvalCommitObjectId(evaluateOnCommit, repo);
}
@@ -400,7 +400,7 @@ RevCommit findEvalCommitObjectId(@Nonnull String evaluateOnCommit, @Nonnull Repo
* Returns the commit hash or null if no commits found.
*/
@Nullable
- private String findLatestCommitForPath(@Nonnull String path) throws GitAPIException, IOException {
+ private String findLatestCommitForPath(@NonNull String path) throws GitAPIException, IOException {
ObjectId start = repo.resolve(evaluateOnCommit);
if (start == null) {
return null;
diff --git a/src/main/java/pl/project13/core/jgit/DescribeResult.java b/src/main/java/pl/project13/core/jgit/DescribeResult.java
index 635df74..ebe776a 100644
--- a/src/main/java/pl/project13/core/jgit/DescribeResult.java
+++ b/src/main/java/pl/project13/core/jgit/DescribeResult.java
@@ -23,9 +23,8 @@
import org.eclipse.jgit.lib.AbbreviatedObjectId;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.ObjectReader;
-
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
+import org.jspecify.annotations.NonNull;
+import org.jspecify.annotations.Nullable;
/**
* Represents the result of a git describe command.
@@ -51,33 +50,33 @@ public class DescribeResult {
public static final DescribeResult EMPTY = new DescribeResult("");
- public DescribeResult(@Nonnull String tagName) {
+ public DescribeResult(@NonNull String tagName) {
this(tagName, false, Optional.empty());
}
- public DescribeResult(@Nonnull ObjectReader objectReader, String tagName, int commitsAwayFromTag, @Nonnull ObjectId commitId) {
+ public DescribeResult(@NonNull ObjectReader objectReader, String tagName, int commitsAwayFromTag, @NonNull ObjectId commitId) {
this(objectReader, tagName, commitsAwayFromTag, commitId, false, Optional.empty(), false);
}
- public DescribeResult(@Nonnull ObjectReader objectReader, @Nonnull ObjectId commitId) {
+ public DescribeResult(@NonNull ObjectReader objectReader, @NonNull ObjectId commitId) {
this.objectReader = objectReader;
this.commitId = Optional.of(commitId);
this.abbreviatedObjectId = createAbbreviatedCommitId(objectReader, commitId, this.abbrev);
}
- public DescribeResult(@Nonnull ObjectReader objectReader, String tagName, int commitsAwayFromTag, ObjectId commitId, boolean dirty, String dirtyMarker) {
+ public DescribeResult(@NonNull ObjectReader objectReader, String tagName, int commitsAwayFromTag, ObjectId commitId, boolean dirty, String dirtyMarker) {
this(objectReader, tagName, commitsAwayFromTag, commitId, dirty, Optional.of(dirtyMarker), false);
}
- public DescribeResult(@Nonnull ObjectReader objectReader, String tagName, int commitsAwayFromTag, ObjectId commitId, boolean dirty, Optional dirtyMarker, boolean forceLongFormat) {
+ public DescribeResult(@NonNull ObjectReader objectReader, String tagName, int commitsAwayFromTag, ObjectId commitId, boolean dirty, Optional dirtyMarker, boolean forceLongFormat) {
this(objectReader, commitId, dirty, dirtyMarker);
this.tagName = Optional.of(tagName);
this.commitsAwayFromTag = commitsAwayFromTag;
this.forceLongFormat = forceLongFormat;
}
- public DescribeResult(@Nonnull ObjectReader objectReader, @Nonnull ObjectId commitId, boolean dirty, @Nonnull Optional dirtyMarker) {
+ public DescribeResult(@NonNull ObjectReader objectReader, @NonNull ObjectId commitId, boolean dirty, @NonNull Optional dirtyMarker) {
this.objectReader = objectReader;
this.commitId = Optional.of(commitId);
@@ -87,13 +86,13 @@ public DescribeResult(@Nonnull ObjectReader objectReader, @Nonnull ObjectId comm
this.dirtyMarker = dirtyMarker.orElse("");
}
- public DescribeResult(@Nonnull String tagName, boolean dirty, @Nonnull Optional dirtyMarker) {
+ public DescribeResult(@NonNull String tagName, boolean dirty, @NonNull Optional dirtyMarker) {
this.tagName = Optional.of(tagName);
this.dirty = dirty;
this.dirtyMarker = dirtyMarker.orElse("");
}
- @Nonnull
+ @NonNull
public DescribeResult withCommitIdAbbrev(int n) {
if (n < 0) {
throw new IllegalArgumentException("The --abbrev parameter must be >= 0, but it was: [" + n + "]");
@@ -210,7 +209,7 @@ private String gPrefixedCommitId(String name) {
*
* @return the abbreviated commit id, possibly longer than the requested len (if it wouldn't be unique)
*/
- private static Optional createAbbreviatedCommitId(@Nonnull ObjectReader objectReader, ObjectId commitId, int requestedLength) {
+ private static Optional createAbbreviatedCommitId(@NonNull ObjectReader objectReader, ObjectId commitId, int requestedLength) {
if (requestedLength < 2) {
// 0 means we don't want to print commit id's at all
return Optional.empty();
diff --git a/src/main/java/pl/project13/core/jgit/JGitCommon.java b/src/main/java/pl/project13/core/jgit/JGitCommon.java
index 95ae54c..5bcff1f 100644
--- a/src/main/java/pl/project13/core/jgit/JGitCommon.java
+++ b/src/main/java/pl/project13/core/jgit/JGitCommon.java
@@ -33,14 +33,13 @@
import org.eclipse.jgit.revwalk.RevTag;
import org.eclipse.jgit.revwalk.RevWalk;
+import org.jspecify.annotations.NonNull;
import pl.project13.core.jgit.dummy.DatedRevTag;
import pl.project13.core.git.GitDescribeConfig;
import pl.project13.core.log.LogInterface;
import pl.project13.core.util.Pair;
-import javax.annotation.Nonnull;
-
public class JGitCommon {
private final LogInterface log;
@@ -102,14 +101,14 @@ private Collection getTagsOnObjectId(final Git git, final ObjectId objec
.collect(Collectors.toList());
}
- public String getClosestTagName(@Nonnull String evaluateOnCommit, @Nonnull Repository repo, GitDescribeConfig gitDescribe) {
+ public String getClosestTagName(@NonNull String evaluateOnCommit, @NonNull Repository repo, GitDescribeConfig gitDescribe) {
// TODO: Why does some tests fail when it gets headCommit from JGitprovider?
RevCommit headCommit = findEvalCommitObjectId(evaluateOnCommit, repo);
Pair pair = getClosestRevCommit(repo, headCommit, gitDescribe);
return pair.second;
}
- public String getClosestTagCommitCount(@Nonnull String evaluateOnCommit, @Nonnull Repository repo, GitDescribeConfig gitDescribe) {
+ public String getClosestTagCommitCount(@NonNull String evaluateOnCommit, @NonNull Repository repo, GitDescribeConfig gitDescribe) {
// TODO: Why does some tests fail when it gets headCommit from JGitprovider?
RevCommit headCommit = findEvalCommitObjectId(evaluateOnCommit, repo);
Pair pair = getClosestRevCommit(repo, headCommit, gitDescribe);
@@ -118,7 +117,7 @@ public String getClosestTagCommitCount(@Nonnull String evaluateOnCommit, @Nonnul
return String.valueOf(distance);
}
- private Pair getClosestRevCommit(@Nonnull Repository repo, RevCommit headCommit, GitDescribeConfig gitDescribe) {
+ private Pair getClosestRevCommit(@NonNull Repository repo, RevCommit headCommit, GitDescribeConfig gitDescribe) {
boolean includeLightweightTags = false;
String matchPattern = ".*";
if (gitDescribe != null) {
@@ -145,7 +144,7 @@ protected String createMatchPattern(String pattern) {
"\\E$";
}
- protected Map> findTagObjectIds(@Nonnull Repository repo, boolean includeLightweightTags, String matchPattern) {
+ protected Map> findTagObjectIds(@NonNull Repository repo, boolean includeLightweightTags, String matchPattern) {
Map> commitIdsToTags = getCommitIdsToTags(repo, includeLightweightTags, matchPattern);
Map> commitIdsToTagNames = transformRevTagsMapToDateSortedTagNames(commitIdsToTags);
log.debug(String.format("Created map: [%s]", commitIdsToTagNames));
@@ -153,7 +152,7 @@ protected Map> findTagObjectIds(@Nonnull Repository repo,
return commitIdsToTagNames;
}
- protected RevCommit findEvalCommitObjectId(@Nonnull String evaluateOnCommit, @Nonnull Repository repo) throws RuntimeException {
+ protected RevCommit findEvalCommitObjectId(@NonNull String evaluateOnCommit, @NonNull Repository repo) throws RuntimeException {
try {
ObjectId evalCommitId = repo.resolve(evaluateOnCommit);
@@ -169,7 +168,7 @@ protected RevCommit findEvalCommitObjectId(@Nonnull String evaluateOnCommit, @No
}
}
- protected Map> getCommitIdsToTags(@Nonnull Repository repo, boolean includeLightweightTags, String matchPattern) {
+ protected Map> getCommitIdsToTags(@NonNull Repository repo, boolean includeLightweightTags, String matchPattern) {
Map> commitIdsToTags = new HashMap<>();
try (RevWalk walk = new RevWalk(repo)) {
@@ -262,11 +261,11 @@ private Comparator datedRevTagComparator() {
}
// Visible for testing
- protected String trimFullTagName(@Nonnull String tagName) {
+ protected String trimFullTagName(@NonNull String tagName) {
return tagName.replaceFirst("refs/tags/", "");
}
- public List findCommitsUntilSomeTag(Repository repo, RevCommit head, @Nonnull Map> tagObjectIdToName) {
+ public List findCommitsUntilSomeTag(Repository repo, RevCommit head, @NonNull Map> tagObjectIdToName) {
try (RevWalk revWalk = new RevWalk(repo)) {
revWalk.markStart(head);
@@ -294,7 +293,7 @@ public List findCommitsUntilSomeTag(Repository repo, RevCommit head,
* @return distance (number of commits) between the given commits
* @see mdonoughe/jgit-describe/blob/master/src/org/mdonoughe/JGitDescribeTask.java
*/
- protected int distanceBetween(@Nonnull Repository repo, @Nonnull RevCommit child, @Nonnull RevCommit parent) {
+ protected int distanceBetween(@NonNull Repository repo, @NonNull RevCommit child, @NonNull RevCommit parent) {
try (RevWalk revWalk = new RevWalk(repo)) {
revWalk.markStart(child);
@@ -341,7 +340,7 @@ protected int distanceBetween(@Nonnull Repository repo, @Nonnull RevCommit child
}
}
- private void seeAllParents(@Nonnull RevWalk revWalk, RevCommit child, @Nonnull Set seen) throws IOException {
+ private void seeAllParents(@NonNull RevWalk revWalk, RevCommit child, @NonNull Set seen) throws IOException {
Queue q = new ArrayDeque<>();
q.add(child);
diff --git a/src/main/java/pl/project13/core/jgit/dummy/DatedRevTag.java b/src/main/java/pl/project13/core/jgit/dummy/DatedRevTag.java
index 2a70b2f..dea3cd2 100644
--- a/src/main/java/pl/project13/core/jgit/dummy/DatedRevTag.java
+++ b/src/main/java/pl/project13/core/jgit/dummy/DatedRevTag.java
@@ -19,35 +19,43 @@
import org.eclipse.jgit.lib.AnyObjectId;
import org.eclipse.jgit.revwalk.RevTag;
-import org.joda.time.DateTime;
-import org.joda.time.format.DateTimeFormat;
+
+import java.time.Instant;
+import java.time.temporal.ChronoUnit;
public class DatedRevTag {
public final AnyObjectId id;
public final String tagName;
- public final DateTime date;
+ public final Instant date;
public DatedRevTag(RevTag tag) {
- this(tag.getId(), tag.getTagName(), (tag.getTaggerIdent() != null) ? new DateTime(tag.getTaggerIdent().getWhen()) : DateTime.now().minusYears(1900));
+ this(tag.getId(), tag.getTagName(), tag.getTaggerIdent() != null
+ ? tag.getTaggerIdent().getWhen().toInstant()
+ : nowMinusYears(1900));
}
public DatedRevTag(AnyObjectId id, String tagName) {
- this(id, tagName, DateTime.now().minusYears(2000));
+ this(id, tagName, nowMinusYears(2000));
}
- public DatedRevTag(AnyObjectId id, String tagName, DateTime date) {
+ public DatedRevTag(AnyObjectId id, String tagName, Instant date) {
this.id = id;
this.tagName = tagName;
this.date = date;
}
+ static Instant nowMinusYears(final int years) {
+ // Instant does not support operations using > DAYS
+ return Instant.now().minus(years * 365L, ChronoUnit.DAYS);
+ }
+
@Override
public String toString() {
return "DatedRevTag{" +
"id=" + id.name() +
", tagName='" + tagName + '\'' +
- ", date=" + DateTimeFormat.longDateTime().print(date) +
+ ", date=" + date +
'}';
}
}
diff --git a/src/main/java/pl/project13/core/util/BuildFileChangeListener.java b/src/main/java/pl/project13/core/util/BuildFileChangeListener.java
index d1faa3a..37777c3 100644
--- a/src/main/java/pl/project13/core/util/BuildFileChangeListener.java
+++ b/src/main/java/pl/project13/core/util/BuildFileChangeListener.java
@@ -17,7 +17,8 @@
package pl.project13.core.util;
-import javax.annotation.Nonnull;
+import org.jspecify.annotations.NonNull;
+
import java.io.File;
import java.util.EventListener;
@@ -29,12 +30,12 @@ public interface BuildFileChangeListener extends EventListener {
* {code}
* BuildContext buildContext = ...
* new BuildFileChangeListener() {
- * void changed(@Nonnull File file) {
+ * void changed(@NonNull File file) {
* buildContext.refresh(file);
* }
* }
* {code}
* @param file The output properties File that was changed by the generator
*/
- void changed(@Nonnull File file);
+ void changed(@NonNull File file);
}
diff --git a/src/main/java/pl/project13/core/util/GenericFileManager.java b/src/main/java/pl/project13/core/util/GenericFileManager.java
index 0ac8709..a2d7694 100644
--- a/src/main/java/pl/project13/core/util/GenericFileManager.java
+++ b/src/main/java/pl/project13/core/util/GenericFileManager.java
@@ -18,14 +18,14 @@
package pl.project13.core.util;
import nu.studer.java.util.OrderedProperties;
+import org.jspecify.annotations.NonNull;
+import org.jspecify.annotations.Nullable;
import pl.project13.core.CannotReadFileException;
import pl.project13.core.CommitIdPropertiesOutputFormat;
import pl.project13.core.GitCommitIdExecutionException;
import pl.project13.core.PropertiesFileGenerator;
import pl.project13.core.log.LogInterface;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
@@ -33,15 +33,12 @@
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
-import java.util.Arrays;
-import java.util.HashSet;
import java.util.Properties;
-import java.util.Set;
public class GenericFileManager {
public static Properties readPropertiesAsUtf8(
- @Nonnull CommitIdPropertiesOutputFormat propertiesOutputFormat,
- @Nonnull File gitPropsFile
+ @NonNull CommitIdPropertiesOutputFormat propertiesOutputFormat,
+ @NonNull File gitPropsFile
) throws GitCommitIdExecutionException {
return readProperties(
propertiesOutputFormat,
@@ -51,9 +48,9 @@ public static Properties readPropertiesAsUtf8(
}
public static Properties readProperties(
- @Nonnull CommitIdPropertiesOutputFormat propertiesOutputFormat,
- @Nonnull File gitPropsFile,
- @Nonnull Charset sourceCharset
+ @NonNull CommitIdPropertiesOutputFormat propertiesOutputFormat,
+ @NonNull File gitPropsFile,
+ @NonNull Charset sourceCharset
) throws GitCommitIdExecutionException {
return readProperties(
null,
@@ -64,12 +61,12 @@ public static Properties readProperties(
);
}
- @Nonnull
+ @NonNull
public static Properties readProperties(
@Nullable LogInterface log,
- @Nonnull CommitIdPropertiesOutputFormat propertiesOutputFormat,
- @Nonnull File gitPropsFile,
- @Nonnull Charset sourceCharset,
+ @NonNull CommitIdPropertiesOutputFormat propertiesOutputFormat,
+ @NonNull File gitPropsFile,
+ @NonNull Charset sourceCharset,
@Nullable String projectName
) throws GitCommitIdExecutionException {
final Properties persistedProperties;
@@ -105,12 +102,12 @@ public static Properties readProperties(
public static void dumpProperties(
@Nullable LogInterface log,
- @Nonnull CommitIdPropertiesOutputFormat propertiesOutputFormat,
- @Nonnull File gitPropsFile,
- @Nonnull Charset sourceCharset,
+ @NonNull CommitIdPropertiesOutputFormat propertiesOutputFormat,
+ @NonNull File gitPropsFile,
+ @NonNull Charset sourceCharset,
boolean escapeUnicode,
@Nullable String projectName,
- @Nonnull Properties propertiesToDump
+ @NonNull Properties propertiesToDump
) throws GitCommitIdExecutionException {
try {
if (log != null) {
diff --git a/src/main/java/pl/project13/core/util/GitDirLocator.java b/src/main/java/pl/project13/core/util/GitDirLocator.java
index e47d8ac..e5f01f5 100644
--- a/src/main/java/pl/project13/core/util/GitDirLocator.java
+++ b/src/main/java/pl/project13/core/util/GitDirLocator.java
@@ -22,9 +22,9 @@
import java.io.FileReader;
import java.io.IOException;
import java.nio.file.Path;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
import org.eclipse.jgit.lib.Constants;
+import org.jspecify.annotations.NonNull;
+import org.jspecify.annotations.Nullable;
import pl.project13.core.GitCommitIdExecutionException;
/**
@@ -67,7 +67,7 @@ public GitDirLocator(
* location or within the project or it's reactor projects.
*/
@Nullable
- public File lookupGitDirectory(@Nonnull File manuallyConfiguredDir) throws GitCommitIdExecutionException {
+ public File lookupGitDirectory(@NonNull File manuallyConfiguredDir) throws GitCommitIdExecutionException {
File dotGitDirectory = runSearch(manuallyConfiguredDir, true);
if (shouldFailOnNoGitDirectory && !directoryExists(dotGitDirectory)) {
throw new GitCommitIdExecutionException(
@@ -121,7 +121,7 @@ private static boolean directoryExists(@Nullable File fileLocation) {
}
@Nullable
- private File runSearch(@Nonnull File manuallyConfiguredDir, boolean resolveGitReferenceFile) {
+ private File runSearch(@NonNull File manuallyConfiguredDir, boolean resolveGitReferenceFile) {
if (manuallyConfiguredDir.exists()) {
// If manuallyConfiguredDir is a directory then we can use it as the git path.
@@ -183,7 +183,7 @@ private File findProjectGitDirectory(boolean resolveGitReferenceFile) {
*
* @return File object with path loaded or null
*/
- private File processGitDirFile(@Nonnull File file) {
+ private File processGitDirFile(@NonNull File file) {
try (BufferedReader reader = new BufferedReader(new FileReader(file))) {
// There should be just one line in the file, e.g.
// "gitdir: /usr/local/src/parentproject/.git/modules/submodule"
diff --git a/src/main/java/pl/project13/core/util/JsonManager.java b/src/main/java/pl/project13/core/util/JsonManager.java
index 87776df..27d247f 100644
--- a/src/main/java/pl/project13/core/util/JsonManager.java
+++ b/src/main/java/pl/project13/core/util/JsonManager.java
@@ -23,9 +23,9 @@
import jakarta.json.stream.JsonGenerator;
import jakarta.json.stream.JsonGeneratorFactory;
import nu.studer.java.util.OrderedProperties;
+import org.jspecify.annotations.NonNull;
import pl.project13.core.CannotReadFileException;
-import javax.annotation.Nonnull;
import java.io.*;
import java.nio.charset.Charset;
import java.util.Collections;
@@ -50,7 +50,7 @@ protected static void dumpJson(OutputStream outputStream, OrderedProperties sort
}
- protected static Properties readJsonProperties(@Nonnull File jsonFile, Charset sourceCharset) throws CannotReadFileException {
+ protected static Properties readJsonProperties(@NonNull File jsonFile, Charset sourceCharset) throws CannotReadFileException {
Properties retVal = new Properties();
try (FileInputStream fis = new FileInputStream(jsonFile)) {
try (InputStreamReader reader = new InputStreamReader(fis, sourceCharset)) {
diff --git a/src/main/java/pl/project13/core/util/Pair.java b/src/main/java/pl/project13/core/util/Pair.java
index 854c66d..65cfb36 100644
--- a/src/main/java/pl/project13/core/util/Pair.java
+++ b/src/main/java/pl/project13/core/util/Pair.java
@@ -17,16 +17,17 @@
package pl.project13.core.util;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
+import org.jspecify.annotations.NonNull;
+import org.jspecify.annotations.Nullable;
+
import java.util.Objects;
public class Pair {
- @Nonnull
+ @NonNull
public final A first;
- @Nonnull
+ @NonNull
public final B second;
@SuppressWarnings("ConstantConditions")
@@ -38,7 +39,7 @@ public Pair(A first, B second) {
this.second = second;
}
- @Nonnull
+ @NonNull
public static Pair of(A first, B second) {
return new Pair<>(first, second);
}
@@ -72,7 +73,7 @@ public int hashCode() {
return result;
}
- @Nonnull
+ @NonNull
@Override
public String toString() {
return String.format("Pair(%s, %s)", first, second);
diff --git a/src/main/java/pl/project13/core/util/PropertyManager.java b/src/main/java/pl/project13/core/util/PropertyManager.java
index 76418d6..f621369 100644
--- a/src/main/java/pl/project13/core/util/PropertyManager.java
+++ b/src/main/java/pl/project13/core/util/PropertyManager.java
@@ -18,10 +18,10 @@
package pl.project13.core.util;
import nu.studer.java.util.OrderedProperties;
+import org.jspecify.annotations.NonNull;
+import org.jspecify.annotations.Nullable;
import pl.project13.core.CannotReadFileException;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
import java.io.*;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
@@ -29,7 +29,7 @@
import java.util.Properties;
public class PropertyManager {
- public static void putWithoutPrefix(@Nonnull Properties properties, String key, String value) {
+ public static void putWithoutPrefix(@NonNull Properties properties, String key, String value) {
if (!isNotEmpty(value)) {
value = "Unknown";
}
@@ -40,11 +40,11 @@ private static boolean isNotEmpty(@Nullable String value) {
return null != value && !" ".equals(value.trim().replaceAll(" ", ""));
}
- protected static Properties readProperties(@Nonnull File propertiesFile) throws CannotReadFileException {
+ protected static Properties readProperties(@NonNull File propertiesFile) throws CannotReadFileException {
return PropertyManager.readProperties(propertiesFile, StandardCharsets.ISO_8859_1);
}
- protected static Properties readProperties(@Nonnull File propertiesFile, @Nonnull Charset charset) throws CannotReadFileException {
+ protected static Properties readProperties(@NonNull File propertiesFile, @NonNull Charset charset) throws CannotReadFileException {
try (FileInputStream fis = new FileInputStream(propertiesFile);
InputStreamReader reader = new InputStreamReader(fis, charset)) {
final OrderedProperties retVal = new OrderedProperties();
diff --git a/src/main/java/pl/project13/core/util/XmlManager.java b/src/main/java/pl/project13/core/util/XmlManager.java
index bd728ef..54a5916 100644
--- a/src/main/java/pl/project13/core/util/XmlManager.java
+++ b/src/main/java/pl/project13/core/util/XmlManager.java
@@ -18,9 +18,9 @@
package pl.project13.core.util;
import nu.studer.java.util.OrderedProperties;
+import org.jspecify.annotations.NonNull;
import pl.project13.core.CannotReadFileException;
-import javax.annotation.Nonnull;
import javax.xml.XMLConstants;
import javax.xml.stream.*;
import java.io.*;
@@ -66,7 +66,7 @@ protected static void dumpXml(OutputStream outputStream, OrderedProperties sorte
}
- protected static Properties readXmlProperties(@Nonnull File xmlFile, Charset sourceCharset) throws CannotReadFileException {
+ protected static Properties readXmlProperties(@NonNull File xmlFile, Charset sourceCharset) throws CannotReadFileException {
Properties retVal = new Properties();
try (FileInputStream fis = new FileInputStream(xmlFile)) {
diff --git a/src/main/java/pl/project13/core/util/YmlManager.java b/src/main/java/pl/project13/core/util/YmlManager.java
index a215766..6ef06da 100644
--- a/src/main/java/pl/project13/core/util/YmlManager.java
+++ b/src/main/java/pl/project13/core/util/YmlManager.java
@@ -18,12 +18,12 @@
package pl.project13.core.util;
import nu.studer.java.util.OrderedProperties;
+import org.jspecify.annotations.NonNull;
import org.yaml.snakeyaml.DumperOptions;
import org.yaml.snakeyaml.LoaderOptions;
import org.yaml.snakeyaml.Yaml;
import pl.project13.core.CannotReadFileException;
-import javax.annotation.Nonnull;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
@@ -56,7 +56,7 @@ protected static void dumpYml(OutputStream outputStream, OrderedProperties sorte
}
}
- protected static Properties readYmlProperties(@Nonnull File xmlFile, Charset sourceCharset) throws CannotReadFileException {
+ protected static Properties readYmlProperties(@NonNull File xmlFile, Charset sourceCharset) throws CannotReadFileException {
Properties retVal = new Properties();
try (FileInputStream fis = new FileInputStream(xmlFile)) {
diff --git a/src/test/java/pl/project13/core/AvailableGitTestRepo.java b/src/test/java/pl/project13/core/AvailableGitTestRepo.java
index 3436253..e740d2e 100644
--- a/src/test/java/pl/project13/core/AvailableGitTestRepo.java
+++ b/src/test/java/pl/project13/core/AvailableGitTestRepo.java
@@ -18,7 +18,8 @@
package pl.project13.core;
-import javax.annotation.Nonnull;
+import org.jspecify.annotations.NonNull;
+
import java.io.File;
public enum AvailableGitTestRepo {
@@ -148,7 +149,7 @@ public enum AvailableGitTestRepo {
this.dir = dir;
}
- @Nonnull
+ @NonNull
public File getDir() {
return new File(dir);
}
diff --git a/src/test/java/pl/project13/core/GitCommitIdPluginIntegrationTest.java b/src/test/java/pl/project13/core/GitCommitIdPluginIntegrationTest.java
index 9de1b71..3776028 100644
--- a/src/test/java/pl/project13/core/GitCommitIdPluginIntegrationTest.java
+++ b/src/test/java/pl/project13/core/GitCommitIdPluginIntegrationTest.java
@@ -23,6 +23,7 @@
import org.apache.commons.io.FileUtils;
import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.api.ResetCommand;
+import org.jspecify.annotations.NonNull;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
@@ -32,7 +33,6 @@
import org.junit.jupiter.params.provider.MethodSource;
import pl.project13.core.git.GitDescribeConfig;
import pl.project13.core.util.GenericFileManager;
-import javax.annotation.Nonnull;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
@@ -1858,7 +1858,7 @@ private void assertGitPropertiesPresentInProject(Properties properties) {
);
}
- private File createTmpDotGitDirectory(@Nonnull AvailableGitTestRepo availableGitTestRepo) throws IOException {
+ private File createTmpDotGitDirectory(@NonNull AvailableGitTestRepo availableGitTestRepo) throws IOException {
Path dotGitDirectory = sandbox.resolve(".git");
deleteDir(dotGitDirectory);
@@ -1867,13 +1867,13 @@ private File createTmpDotGitDirectory(@Nonnull AvailableGitTestRepo availableGit
return dotGitDirectory.toFile();
}
- private void deleteDir(@Nonnull Path toBeDeleted) throws IOException {
+ private void deleteDir(@NonNull Path toBeDeleted) throws IOException {
if (toBeDeleted.toFile().exists()) {
FileUtils.forceDelete(toBeDeleted.toFile());
}
}
- private Git git(@Nonnull File dotGitDirectory) throws IOException {
+ private Git git(@NonNull File dotGitDirectory) throws IOException {
return Git.open(dotGitDirectory);
}
}
diff --git a/src/test/java/pl/project13/core/GitCommitIdTestCallback.java b/src/test/java/pl/project13/core/GitCommitIdTestCallback.java
index b76ccbc..ef8355c 100644
--- a/src/test/java/pl/project13/core/GitCommitIdTestCallback.java
+++ b/src/test/java/pl/project13/core/GitCommitIdTestCallback.java
@@ -17,13 +17,13 @@
package pl.project13.core;
+import org.jspecify.annotations.NonNull;
+import org.jspecify.annotations.Nullable;
import pl.project13.core.git.GitDescribeConfig;
import pl.project13.core.log.DummyLogInterface;
import pl.project13.core.log.LogInterface;
import pl.project13.core.util.BuildFileChangeListener;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
import java.io.File;
import java.io.IOException;
import java.nio.charset.Charset;
@@ -219,25 +219,25 @@ public Supplier supplyProjectVersion() {
return () -> projectVersion;
}
- @Nonnull
+ @NonNull
@Override
public LogInterface getLogInterface() {
return logInterface;
}
- @Nonnull
+ @NonNull
@Override
public String getDateFormat() {
return dateFormat;
}
- @Nonnull
+ @NonNull
@Override
public String getDateFormatTimeZone() {
return dateFormatTimeZone;
}
- @Nonnull
+ @NonNull
@Override
public String getPrefixDot() {
return prefixDot;
diff --git a/src/test/java/pl/project13/core/log/DummyLogInterface.java b/src/test/java/pl/project13/core/log/DummyLogInterface.java
index ffb8939..0614f8c 100644
--- a/src/test/java/pl/project13/core/log/DummyLogInterface.java
+++ b/src/test/java/pl/project13/core/log/DummyLogInterface.java
@@ -17,29 +17,34 @@
package pl.project13.core.log;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
public class DummyLogInterface implements LogInterface {
+ private static final Logger LOG = LoggerFactory.getLogger(DummyLogInterface.class);
+
@Override
public void debug(String msg) {
- // ignore
+ LOG.debug(msg);
}
@Override
public void info(String msg) {
- // ignore
+ LOG.info(msg);
}
@Override
public void warn(String msg) {
- // ignore
+ LOG.warn(msg);
}
@Override
public void error(String msg) {
- // ignore
+ LOG.error(msg);
}
@Override
public void error(String msg, Throwable t) {
- // ignore
+ LOG.error(msg, t);
}
}