Skip to content

Commit d3eb08b

Browse files
committed
build: ban jetbrains notnull/nullable annotations
1 parent 80d9f80 commit d3eb08b

File tree

10 files changed

+47
-47
lines changed

10 files changed

+47
-47
lines changed

jooby/src/test/java/io/jooby/Issue2525.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
import java.util.Objects;
1313
import java.util.function.Consumer;
1414

15-
import org.jetbrains.annotations.NotNull;
1615
import org.junit.jupiter.api.Test;
1716

17+
import edu.umd.cs.findbugs.annotations.NonNull;
1818
import io.jooby.internal.UrlParser;
1919
import io.jooby.value.ConversionHint;
2020
import io.jooby.value.Converter;
@@ -26,7 +26,7 @@ public class Issue2525 {
2626

2727
public class VC2525 implements Converter {
2828
@Override
29-
public Object convert(@NotNull Type type, @NotNull Value value, @NotNull ConversionHint hint) {
29+
public Object convert(@NonNull Type type, @NonNull Value value, @NonNull ConversionHint hint) {
3030
return new MyID2525(value.value());
3131
}
3232
}

jooby/src/test/java/io/jooby/Issue3653.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,34 +5,34 @@
55
*/
66
package io.jooby;
77

8-
import org.jetbrains.annotations.NotNull;
98
import org.junit.jupiter.api.Test;
109
import org.mockito.Mockito;
1110
import org.slf4j.Logger;
1211
import org.slf4j.LoggerFactory;
1312

13+
import edu.umd.cs.findbugs.annotations.NonNull;
1414
import io.jooby.output.OutputFactory;
1515

1616
public class Issue3653 {
1717

1818
private static class TestServer extends Server.Base {
1919

20-
@NotNull @Override
20+
@NonNull @Override
2121
public OutputFactory getOutputFactory() {
2222
return null;
2323
}
2424

25-
@NotNull @Override
25+
@NonNull @Override
2626
public String getName() {
2727
return "Test";
2828
}
2929

30-
@NotNull @Override
31-
public Server start(@NotNull Jooby... application) {
30+
@NonNull @Override
31+
public Server start(@NonNull Jooby... application) {
3232
return this;
3333
}
3434

35-
@NotNull @Override
35+
@NonNull @Override
3636
public Server stop() {
3737
return this;
3838
}

modules/jooby-apt/src/test/java/tests/i2325/VC2325.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,13 @@
77

88
import java.lang.reflect.Type;
99

10-
import org.jetbrains.annotations.NotNull;
11-
10+
import edu.umd.cs.findbugs.annotations.NonNull;
1211
import io.jooby.value.ConversionHint;
1312
import io.jooby.value.Converter;
1413
import io.jooby.value.Value;
1514

1615
public class VC2325 implements Converter {
17-
@Override
18-
public Object convert(@NotNull Type type, @NotNull Value value, @NotNull ConversionHint hint) {
16+
public Object convert(@NonNull Type type, @NonNull Value value, @NonNull ConversionHint hint) {
1917
return new MyID2325(value.value());
2018
}
2119
}

modules/jooby-apt/src/test/java/tests/i2405/Converter2405.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77

88
import java.lang.reflect.Type;
99

10-
import org.jetbrains.annotations.NotNull;
11-
1210
import edu.umd.cs.findbugs.annotations.NonNull;
1311
import io.jooby.value.ConversionHint;
1412
import io.jooby.value.Converter;
@@ -17,7 +15,7 @@
1715
public class Converter2405 implements Converter {
1816

1917
@Override
20-
public Object convert(@NotNull Type type, @NotNull Value value, @NonNull ConversionHint hint) {
18+
public Object convert(@NonNull Type type, @NonNull Value value, @NonNull ConversionHint hint) {
2119
return new Bean2405(value.value());
2220
}
2321
}

modules/jooby-openapi/src/test/java/issues/i2968/C2968_.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77

88
import java.util.function.Function;
99

10-
import org.jetbrains.annotations.NotNull;
11-
10+
import edu.umd.cs.findbugs.annotations.NonNull;
1211
import io.jooby.Context;
1312
import io.jooby.Extension;
1413
import io.jooby.Jooby;
@@ -23,7 +22,7 @@ public C2968_() {
2322
}
2423

2524
@Override
26-
public void install(@NotNull Jooby app) throws Exception {
25+
public void install(@NonNull Jooby app) throws Exception {
2726
app.get("/hello", this::hello);
2827
}
2928

pom.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1467,11 +1467,22 @@
14671467
<requireJavaVersion>
14681468
<version>[${maven.compiler.source},)</version>
14691469
</requireJavaVersion>
1470+
<RestrictImports>
1471+
<reason>Use edu.umd.cs.findbugs.annotations.*</reason>
1472+
<bannedImport>org.jetbrains.annotations.**</bannedImport>
1473+
</RestrictImports>
14701474
<banDuplicatePomDependencyVersions/>
14711475
</rules>
14721476
</configuration>
14731477
</execution>
14741478
</executions>
1479+
<dependencies>
1480+
<dependency>
1481+
<groupId>de.skuzzle.enforcer</groupId>
1482+
<artifactId>restrict-imports-enforcer-rule</artifactId>
1483+
<version>3.0.0</version>
1484+
</dependency>
1485+
</dependencies>
14751486
</plugin>
14761487

14771488
<plugin>

tests/src/test/java/io/jooby/i2325/VC2325.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,15 @@
77

88
import java.lang.reflect.Type;
99

10-
import org.jetbrains.annotations.NotNull;
11-
10+
import edu.umd.cs.findbugs.annotations.NonNull;
1211
import io.jooby.QueryString;
1312
import io.jooby.value.ConversionHint;
1413
import io.jooby.value.Converter;
1514
import io.jooby.value.Value;
1615

1716
public class VC2325 implements Converter {
1817
@Override
19-
public Object convert(@NotNull Type type, @NotNull Value value, @NotNull ConversionHint hint) {
18+
public Object convert(@NonNull Type type, @NonNull Value value, @NonNull ConversionHint hint) {
2019
var v = value instanceof QueryString query ? query.get("value").value() : value.value();
2120
return new MyID2325(v);
2221
}

tests/src/test/java/io/jooby/i3814/Issue3814.java

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@
77

88
import java.util.concurrent.CountDownLatch;
99

10-
import org.jetbrains.annotations.NotNull;
11-
import org.jetbrains.annotations.Nullable;
12-
10+
import edu.umd.cs.findbugs.annotations.NonNull;
11+
import edu.umd.cs.findbugs.annotations.Nullable;
1312
import io.jooby.junit.ServerTest;
1413
import io.jooby.junit.ServerTestRunner;
1514
import okhttp3.Response;
@@ -41,38 +40,38 @@ public void shouldJettyWebSocketWorks(ServerTestRunner runner) {
4140
"/3814",
4241
new WebSocketListener() {
4342
@Override
44-
public void onOpen(@NotNull WebSocket ws, @NotNull Response response) {
43+
public void onOpen(@NonNull WebSocket ws, @NonNull Response response) {
4544
for (int i = 0; i < messageCount; i++) {
4645
ws.send(">" + i);
4746
}
4847
}
4948

5049
@Override
51-
public void onMessage(@NotNull WebSocket webSocket, @NotNull String text) {
50+
public void onMessage(@NonNull WebSocket webSocket, @NonNull String text) {
5251
super.onMessage(webSocket, text);
5352
}
5453

5554
@Override
56-
public void onMessage(@NotNull WebSocket webSocket, @NotNull ByteString bytes) {
55+
public void onMessage(@NonNull WebSocket webSocket, @NonNull ByteString bytes) {
5756
super.onMessage(webSocket, bytes);
5857
}
5958

6059
@Override
6160
public void onClosing(
62-
@NotNull WebSocket webSocket, int code, @NotNull String reason) {
61+
@NonNull WebSocket webSocket, int code, @NonNull String reason) {
6362
super.onClosing(webSocket, code, reason);
6463
}
6564

6665
@Override
6766
public void onClosed(
68-
@NotNull WebSocket webSocket, int code, @NotNull String reason) {
67+
@NonNull WebSocket webSocket, int code, @NonNull String reason) {
6968
super.onClosed(webSocket, code, reason);
7069
}
7170

7271
@Override
7372
public void onFailure(
74-
@NotNull WebSocket webSocket,
75-
@NotNull Throwable t,
73+
@NonNull WebSocket webSocket,
74+
@NonNull Throwable t,
7675
@Nullable Response response) {
7776
super.onFailure(webSocket, t, response);
7877
}

tests/src/test/java/io/jooby/test/MyValueBeanConverter.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77

88
import java.lang.reflect.Type;
99

10-
import org.jetbrains.annotations.NotNull;
11-
1210
import edu.umd.cs.findbugs.annotations.NonNull;
1311
import io.jooby.value.ConversionHint;
1412
import io.jooby.value.Converter;
@@ -17,7 +15,7 @@
1715
public class MyValueBeanConverter implements Converter {
1816

1917
@Override
20-
public Object convert(@NotNull Type type, @NotNull Value value, @NonNull ConversionHint hint) {
18+
public Object convert(@NonNull Type type, @NonNull Value value, @NonNull ConversionHint hint) {
2119
MyValue result = new MyValue();
2220
result.setString(value.get("string").value());
2321
return result;

tests/src/test/java/io/jooby/test/WebClient.java

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,8 @@
2323
import javax.net.ssl.TrustManager;
2424
import javax.net.ssl.X509TrustManager;
2525

26-
import org.jetbrains.annotations.NotNull;
27-
import org.jetbrains.annotations.Nullable;
28-
2926
import edu.umd.cs.findbugs.annotations.NonNull;
27+
import edu.umd.cs.findbugs.annotations.Nullable;
3028
import io.jooby.Server;
3129
import io.jooby.ServerSentMessage;
3230
import io.jooby.SneakyThrows;
@@ -54,26 +52,26 @@ public SyncWebSocketListener(String testName) {
5452
}
5553

5654
@Override
57-
public void onOpen(@NotNull WebSocket webSocket, @NotNull Response response) {
55+
public void onOpen(@NonNull WebSocket webSocket, @NonNull Response response) {
5856
opened.countDown();
5957
}
6058

6159
@Override
62-
public void onClosed(@NotNull WebSocket webSocket, int code, @NotNull String reason) {
60+
public void onClosed(@NonNull WebSocket webSocket, int code, @NonNull String reason) {
6361
closed.set(true);
6462
}
6563

6664
@Override
6765
public void onFailure(
68-
@NotNull WebSocket webSocket, @NotNull Throwable e, @Nullable Response response) {
66+
@NonNull WebSocket webSocket, @NonNull Throwable e, @Nullable Response response) {
6967
if (!Server.connectionLost(e)) {
7068
System.err.println("Unexpected web socket error: " + testName);
7169
e.printStackTrace();
7270
}
7371
}
7472

7573
@Override
76-
public void onMessage(@NotNull WebSocket webSocket, @NotNull String text) {
74+
public void onMessage(@NonNull WebSocket webSocket, @NonNull String text) {
7775
messages.offer(text);
7876
}
7977

@@ -91,7 +89,7 @@ public String lastMessage() {
9189
}
9290

9391
@Override
94-
public void onClosing(@NotNull WebSocket webSocket, int code, @NotNull String reason) {
92+
public void onClosing(@NonNull WebSocket webSocket, int code, @NonNull String reason) {
9593
super.onClosing(webSocket, code, reason);
9694
}
9795
}
@@ -261,31 +259,31 @@ public ServerSentMessageIterator sse(String path) {
261259
req.build(),
262260
new EventSourceListener() {
263261
@Override
264-
public void onClosed(@NotNull EventSource eventSource) {
262+
public void onClosed(@NonNull EventSource eventSource) {
265263
eventSource.cancel();
266264
}
267265

268266
@Override
269267
public void onEvent(
270-
@NotNull EventSource eventSource,
268+
@NonNull EventSource eventSource,
271269
@Nullable String id,
272270
@Nullable String type,
273-
@NotNull String data) {
271+
@NonNull String data) {
274272
// retry is not part of public API
275273
ServerSentMessage message = new ServerSentMessage(data).setId(id).setEvent(type);
276274
messages.offer(message);
277275
}
278276

279277
@Override
280278
public void onFailure(
281-
@NotNull EventSource eventSource,
279+
@NonNull EventSource eventSource,
282280
@Nullable Throwable t,
283281
@Nullable Response response) {
284282
super.onFailure(eventSource, t, response);
285283
}
286284

287285
@Override
288-
public void onOpen(@NotNull EventSource eventSource, @NotNull Response response) {
286+
public void onOpen(@NonNull EventSource eventSource, @NonNull Response response) {
289287
super.onOpen(eventSource, response);
290288
}
291289
});

0 commit comments

Comments
 (0)