From 0e8e9bf0ccb2f86a005851b47364b4e86bc41f56 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fridrich=20=C5=A0trba?= <fridrich.strba@bluewin.ch>
Date: Thu, 30 Mar 2023 13:20:35 +0200
Subject: [PATCH 6/7] Do not use the Jetbrains annotations

---
 common/src/main/java/io/netty/util/Recycler.java           | 2 --
 .../io/netty/util/concurrent/AbstractEventExecutor.java    | 7 ++-----
 .../java/io/netty/util/concurrent/GlobalEventExecutor.java | 4 +---
 .../netty/util/concurrent/SingleThreadEventExecutor.java   | 5 ++---
 .../java/io/netty/util/RecyclerFastThreadLocalTest.java    | 2 --
 common/src/test/java/io/netty/util/RecyclerTest.java       | 4 +---
 6 files changed, 6 insertions(+), 18 deletions(-)

diff --git a/common/src/main/java/io/netty/util/Recycler.java b/common/src/main/java/io/netty/util/Recycler.java
index 3f78aecd44..0f7ff6ca20 100644
--- a/common/src/main/java/io/netty/util/Recycler.java
+++ b/common/src/main/java/io/netty/util/Recycler.java
@@ -24,7 +24,6 @@ import io.netty.util.internal.UnstableApi;
 import io.netty.util.internal.logging.InternalLogger;
 import io.netty.util.internal.logging.InternalLoggerFactory;
 import org.jctools.queues.MessagePassingQueue;
-import org.jetbrains.annotations.VisibleForTesting;
 
 import java.util.ArrayDeque;
 import java.util.Queue;
@@ -208,7 +207,6 @@ public abstract class Recycler<T> {
         return true;
     }
 
-    @VisibleForTesting
     final int threadLocalSize() {
         LocalPool<T> localPool = threadLocal.getIfExists();
         return localPool == null ? 0 : localPool.pooledHandles.size() + localPool.batch.size();
diff --git a/common/src/main/java/io/netty/util/concurrent/AbstractEventExecutor.java b/common/src/main/java/io/netty/util/concurrent/AbstractEventExecutor.java
index ce6b1ac875..cda03f0425 100644
--- a/common/src/main/java/io/netty/util/concurrent/AbstractEventExecutor.java
+++ b/common/src/main/java/io/netty/util/concurrent/AbstractEventExecutor.java
@@ -19,9 +19,6 @@ import io.netty.util.internal.UnstableApi;
 import io.netty.util.internal.logging.InternalLogger;
 import io.netty.util.internal.logging.InternalLoggerFactory;
 
-import org.jetbrains.annotations.Async.Execute;
-import org.jetbrains.annotations.Async.Schedule;
-
 import java.util.Collection;
 import java.util.Collections;
 import java.util.Iterator;
@@ -170,7 +167,7 @@ public abstract class AbstractEventExecutor extends AbstractExecutorService impl
         }
     }
 
-    protected static void runTask(@Execute Runnable task) {
+    protected static void runTask(Runnable task) {
         task.run();
     }
 
@@ -188,7 +185,7 @@ public abstract class AbstractEventExecutor extends AbstractExecutorService impl
         lazyExecute0(task);
     }
 
-    private void lazyExecute0(@Schedule Runnable task) {
+    private void lazyExecute0(Runnable task) {
         execute(task);
     }
 
diff --git a/common/src/main/java/io/netty/util/concurrent/GlobalEventExecutor.java b/common/src/main/java/io/netty/util/concurrent/GlobalEventExecutor.java
index 4514c023a3..542eecee3f 100644
--- a/common/src/main/java/io/netty/util/concurrent/GlobalEventExecutor.java
+++ b/common/src/main/java/io/netty/util/concurrent/GlobalEventExecutor.java
@@ -21,8 +21,6 @@ import io.netty.util.internal.ThreadExecutorMap;
 import io.netty.util.internal.logging.InternalLogger;
 import io.netty.util.internal.logging.InternalLoggerFactory;
 
-import org.jetbrains.annotations.Async.Schedule;
-
 import java.security.AccessController;
 import java.security.PrivilegedAction;
 import java.util.Queue;
@@ -221,7 +219,7 @@ public final class GlobalEventExecutor extends AbstractScheduledEventExecutor im
         execute0(task);
     }
 
-    private void execute0(@Schedule Runnable task) {
+    private void execute0(Runnable task) {
         addTask(ObjectUtil.checkNotNull(task, "task"));
         if (!inEventLoop()) {
             startThread();
diff --git a/common/src/main/java/io/netty/util/concurrent/SingleThreadEventExecutor.java b/common/src/main/java/io/netty/util/concurrent/SingleThreadEventExecutor.java
index 6c7020ee23..fb9d9fd0ba 100644
--- a/common/src/main/java/io/netty/util/concurrent/SingleThreadEventExecutor.java
+++ b/common/src/main/java/io/netty/util/concurrent/SingleThreadEventExecutor.java
@@ -22,7 +22,6 @@ import io.netty.util.internal.ThreadExecutorMap;
 import io.netty.util.internal.UnstableApi;
 import io.netty.util.internal.logging.InternalLogger;
 import io.netty.util.internal.logging.InternalLoggerFactory;
-import org.jetbrains.annotations.Async.Schedule;
 
 import java.lang.Thread.State;
 import java.util.ArrayList;
@@ -822,12 +821,12 @@ public abstract class SingleThreadEventExecutor extends AbstractScheduledEventEx
         lazyExecute0(task);
     }
 
-    private void execute0(@Schedule Runnable task) {
+    private void execute0(Runnable task) {
         ObjectUtil.checkNotNull(task, "task");
         execute(task, !(task instanceof LazyRunnable) && wakesUpForTask(task));
     }
 
-    private void lazyExecute0(@Schedule Runnable task) {
+    private void lazyExecute0(Runnable task) {
         execute(ObjectUtil.checkNotNull(task, "task"), false);
     }
 
diff --git a/common/src/test/java/io/netty/util/RecyclerFastThreadLocalTest.java b/common/src/test/java/io/netty/util/RecyclerFastThreadLocalTest.java
index 7c8d4da113..1dfaffc7da 100644
--- a/common/src/test/java/io/netty/util/RecyclerFastThreadLocalTest.java
+++ b/common/src/test/java/io/netty/util/RecyclerFastThreadLocalTest.java
@@ -16,7 +16,6 @@
 package io.netty.util;
 
 import io.netty.util.concurrent.FastThreadLocalThread;
-import org.jetbrains.annotations.NotNull;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.Timeout;
 import org.junit.jupiter.api.extension.ExtendWith;
@@ -29,7 +28,6 @@ import static org.junit.jupiter.api.Assertions.assertFalse;
 
 @ExtendWith(RunInFastThreadLocalThreadExtension.class)
 public class RecyclerFastThreadLocalTest extends RecyclerTest {
-    @NotNull
     @Override
     protected Thread newThread(Runnable runnable) {
         return new FastThreadLocalThread(runnable);
diff --git a/common/src/test/java/io/netty/util/RecyclerTest.java b/common/src/test/java/io/netty/util/RecyclerTest.java
index 49359ff962..1ee4c6bd5c 100644
--- a/common/src/test/java/io/netty/util/RecyclerTest.java
+++ b/common/src/test/java/io/netty/util/RecyclerTest.java
@@ -15,7 +15,6 @@
 */
 package io.netty.util;
 
-import org.jetbrains.annotations.NotNull;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.Timeout;
 import org.junit.jupiter.api.function.Executable;
@@ -55,7 +54,6 @@ public class RecyclerTest {
         };
     }
 
-    @NotNull
     protected Thread newThread(Runnable runnable) {
         return new Thread(runnable);
     }
@@ -341,7 +339,7 @@ public class RecyclerTest {
 
         ExecutorService single = Executors.newSingleThreadExecutor(new ThreadFactory() {
             @Override
-            public Thread newThread(@NotNull Runnable r) {
+            public Thread newThread(Runnable r) {
                 return RecyclerTest.this.newThread(r);
             }
         });
-- 
2.40.0

