Skip to content

Commit f6e893d

Browse files
committed
Use JSR-305 annotations instead of Jetbrains annotations
1 parent 098114e commit f6e893d

File tree

91 files changed

+902
-948
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+902
-948
lines changed

build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ subprojects {
5050
targetCompatibility = javaVersion
5151
}
5252

53-
val implementation by configurations
53+
val api by configurations
5454
val testImplementation by configurations
5555

5656
dependencies {
57-
implementation("org.jetbrains:annotations:17.0.0")
57+
api("com.google.code.findbugs:jsr305:3.0.2")
5858

5959
testImplementation("com.google.guava:guava:28.1-jre")
6060
testImplementation("org.testng:testng:7.0.0")

gitlfs-client/src/main/java/ru/bozaro/gitlfs/client/AuthHelper.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
package ru.bozaro.gitlfs.client;
22

3-
import org.jetbrains.annotations.NotNull;
43
import ru.bozaro.gitlfs.client.auth.AuthProvider;
54
import ru.bozaro.gitlfs.client.auth.BasicAuthProvider;
65
import ru.bozaro.gitlfs.client.auth.ExternalAuthProvider;
76

7+
import javax.annotation.Nonnull;
88
import java.net.MalformedURLException;
99
import java.net.URI;
1010
import java.net.URISyntaxException;
@@ -34,7 +34,8 @@ private AuthHelper() {
3434
* @param gitURL URL to repository.
3535
* @return Created auth provider.
3636
*/
37-
public static AuthProvider create(@NotNull String gitURL) throws MalformedURLException {
37+
@Nonnull
38+
public static AuthProvider create(@Nonnull String gitURL) throws MalformedURLException {
3839
if (gitURL.contains("://")) {
3940
final URI uri = URI.create(gitURL);
4041
final String path = uri.getPath();
@@ -52,8 +53,8 @@ public static AuthProvider create(@NotNull String gitURL) throws MalformedURLExc
5253
return new ExternalAuthProvider(gitURL);
5354
}
5455

55-
@NotNull
56-
public static URI join(@NotNull URI href, @NotNull String... path) {
56+
@Nonnull
57+
public static URI join(@Nonnull URI href, @Nonnull String... path) {
5758
try {
5859
URI uri = new URI(href.getScheme(), href.getAuthority(), href.getPath() + (href.getPath().endsWith("/") ? "" : "/"), null, null);
5960
for (String fragment : path)

gitlfs-client/src/main/java/ru/bozaro/gitlfs/client/BatchDownloader.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
package ru.bozaro.gitlfs.client;
22

3-
import org.jetbrains.annotations.NotNull;
4-
import org.jetbrains.annotations.Nullable;
53
import ru.bozaro.gitlfs.client.internal.BatchWorker;
64
import ru.bozaro.gitlfs.client.internal.Work;
75
import ru.bozaro.gitlfs.client.io.StreamHandler;
@@ -10,6 +8,8 @@
108
import ru.bozaro.gitlfs.common.data.Meta;
119
import ru.bozaro.gitlfs.common.data.Operation;
1210

11+
import javax.annotation.CheckForNull;
12+
import javax.annotation.Nonnull;
1313
import java.io.IOException;
1414
import java.util.concurrent.CompletableFuture;
1515
import java.util.concurrent.ExecutorService;
@@ -20,22 +20,22 @@
2020
* @author Artem V. Navrotskiy
2121
*/
2222
public class BatchDownloader extends BatchWorker<StreamHandler<?>, Object> {
23-
public BatchDownloader(@NotNull Client client, @NotNull ExecutorService pool) {
23+
public BatchDownloader(@Nonnull Client client, @Nonnull ExecutorService pool) {
2424
this(client, pool, new BatchSettings());
2525
}
2626

27-
public BatchDownloader(@NotNull Client client, @NotNull ExecutorService pool, @NotNull BatchSettings settings) {
27+
public BatchDownloader(@Nonnull Client client, @Nonnull ExecutorService pool, @Nonnull BatchSettings settings) {
2828
super(client, pool, settings, Operation.Download);
2929
}
3030

3131
@SuppressWarnings("unchecked")
32-
@NotNull
33-
public <T> CompletableFuture<T> download(@NotNull final Meta meta, @NotNull StreamHandler<T> callback) {
32+
@Nonnull
33+
public <T> CompletableFuture<T> download(@Nonnull final Meta meta, @Nonnull StreamHandler<T> callback) {
3434
return (CompletableFuture<T>) enqueue(meta, callback);
3535
}
3636

37-
@Nullable
38-
protected Work<Object> objectTask(@NotNull State<StreamHandler<?>, Object> state, @NotNull BatchItem item) {
37+
@CheckForNull
38+
protected Work<Object> objectTask(@Nonnull State<StreamHandler<?>, Object> state, @Nonnull BatchItem item) {
3939
// Invalid links data
4040
if (!item.getLinks().containsKey(LinkType.Download)) {
4141
state.getFuture().completeExceptionally(new IOException("Download link not found"));

gitlfs-client/src/main/java/ru/bozaro/gitlfs/client/BatchSettings.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package ru.bozaro.gitlfs.client;
22

3-
import org.jetbrains.annotations.NotNull;
3+
import javax.annotation.Nonnull;
44

55
import static ru.bozaro.gitlfs.common.Constants.BATCH_SIZE;
66

@@ -36,7 +36,7 @@ public int getLimit() {
3636
return limit;
3737
}
3838

39-
@NotNull
39+
@Nonnull
4040
public BatchSettings setLimit(int limit) {
4141
this.limit = Math.min(limit, 1);
4242
return this;
@@ -46,7 +46,7 @@ public int getThreshold() {
4646
return threshold;
4747
}
4848

49-
@NotNull
49+
@Nonnull
5050
public BatchSettings setThreshold(int threshold) {
5151
this.threshold = Math.max(threshold, 0);
5252
return this;
@@ -56,7 +56,7 @@ public int getRetryCount() {
5656
return retryCount;
5757
}
5858

59-
@NotNull
59+
@Nonnull
6060
public BatchSettings setRetryCount(int retryCount) {
6161
this.retryCount = Math.max(retryCount, 1);
6262
return this;

gitlfs-client/src/main/java/ru/bozaro/gitlfs/client/BatchUploader.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
package ru.bozaro.gitlfs.client;
22

3-
import org.jetbrains.annotations.NotNull;
4-
import org.jetbrains.annotations.Nullable;
53
import ru.bozaro.gitlfs.client.internal.BatchWorker;
64
import ru.bozaro.gitlfs.client.internal.Work;
75
import ru.bozaro.gitlfs.client.io.StreamProvider;
@@ -10,6 +8,8 @@
108
import ru.bozaro.gitlfs.common.data.Meta;
119
import ru.bozaro.gitlfs.common.data.Operation;
1210

11+
import javax.annotation.CheckForNull;
12+
import javax.annotation.Nonnull;
1313
import java.util.concurrent.CompletableFuture;
1414
import java.util.concurrent.ExecutorService;
1515

@@ -19,11 +19,11 @@
1919
* @author Artem V. Navrotskiy
2020
*/
2121
public class BatchUploader extends BatchWorker<StreamProvider, Meta> {
22-
public BatchUploader(@NotNull Client client, @NotNull ExecutorService pool) {
22+
public BatchUploader(@Nonnull Client client, @Nonnull ExecutorService pool) {
2323
this(client, pool, new BatchSettings());
2424
}
2525

26-
public BatchUploader(@NotNull Client client, @NotNull ExecutorService pool, @NotNull BatchSettings settings) {
26+
public BatchUploader(@Nonnull Client client, @Nonnull ExecutorService pool, @Nonnull BatchSettings settings) {
2727
super(client, pool, settings, Operation.Upload);
2828
}
2929

@@ -33,8 +33,8 @@ public BatchUploader(@NotNull Client client, @NotNull ExecutorService pool, @Not
3333
* @param streamProvider Stream provider.
3434
* @return Return future with upload result.
3535
*/
36-
@NotNull
37-
public CompletableFuture<Meta> upload(@NotNull final StreamProvider streamProvider) {
36+
@Nonnull
37+
public CompletableFuture<Meta> upload(@Nonnull final StreamProvider streamProvider) {
3838
final CompletableFuture<Meta> future = new CompletableFuture<>();
3939
getPool().submit(() -> {
4040
try {
@@ -53,13 +53,13 @@ public CompletableFuture<Meta> upload(@NotNull final StreamProvider streamProvid
5353
* @param streamProvider Stream provider.
5454
* @return Return future with upload result. For same objects can return same future.
5555
*/
56-
@NotNull
57-
public CompletableFuture<Meta> upload(@NotNull final Meta meta, @NotNull final StreamProvider streamProvider) {
56+
@Nonnull
57+
public CompletableFuture<Meta> upload(@Nonnull final Meta meta, @Nonnull final StreamProvider streamProvider) {
5858
return enqueue(meta, streamProvider);
5959
}
6060

61-
@Nullable
62-
protected Work<Meta> objectTask(@NotNull State<StreamProvider, Meta> state, @NotNull BatchItem item) {
61+
@CheckForNull
62+
protected Work<Meta> objectTask(@Nonnull State<StreamProvider, Meta> state, @Nonnull BatchItem item) {
6363
if (item.getLinks().containsKey(LinkType.Upload)) {
6464
// Wait for upload.
6565
return auth -> {

0 commit comments

Comments
 (0)