From afa311514804079dd9f6fb82a04265b032b3453e Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Tue, 28 Mar 2023 04:58:46 +0200 Subject: [PATCH] Deprecate public Timings classes for removal (#8949) --- patches/api/Timings-v2.patch | 25 ++++++++++++++++++++++++- patches/server/Timings-v2.patch | 3 +++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/patches/api/Timings-v2.patch b/patches/api/Timings-v2.patch index 6b1c3bc64a..8c2fbbab28 100644 --- a/patches/api/Timings-v2.patch +++ b/patches/api/Timings-v2.patch @@ -19,6 +19,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import org.bukkit.Bukkit; +import org.jetbrains.annotations.NotNull; + ++@Deprecated(forRemoval = true) +public class FullServerTickHandler extends TimingHandler { + private static final TimingIdentifier IDENTITY = new TimingIdentifier("Minecraft", "Full Server Tick", null); + final TimingData minuteData; @@ -131,6 +132,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + ++@Deprecated(forRemoval = true) +public final class NullTimingHandler implements Timing { + public static final Timing NULL = new NullTimingHandler(); + @NotNull @@ -213,6 +215,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + ++@Deprecated(forRemoval = true) +public class TimedEventExecutor implements EventExecutor { + + private final EventExecutor executor; @@ -296,7 +299,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + +/** + * Provides an ability to time sections of code within the Minecraft Server ++ * ++ * @deprecated Timings will likely be replaced with Spark in the future + */ ++@Deprecated(forRemoval = true) +public interface Timing extends AutoCloseable { + /** + * Starts timing the execution until {@link #stopTiming()} is called. @@ -767,6 +773,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import static co.aikar.timings.TimingsManager.MINUTE_REPORTS; +import static co.aikar.util.JSONUtil.*; + ++@Deprecated(forRemoval = true) +@SuppressWarnings({"deprecation", "SuppressionAnnotation", "Convert2Lambda", "Anonymous2MethodRef"}) +public class TimingHistory { + public static long lastMinuteTime; @@ -1299,6 +1306,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + ++/** ++ * @deprecated Timings will likely be replaced with Spark in the future ++ */ ++@Deprecated(forRemoval = true) +@SuppressWarnings({"UnusedDeclaration", "WeakerAccess", "SameParameterValue"}) +public final class Timings { + @@ -1556,6 +1567,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return TimingsManager.getHandler(groupName, name, groupHandler); + } +} ++ diff --git a/src/main/java/co/aikar/timings/TimingsCommand.java b/src/main/java/co/aikar/timings/TimingsCommand.java new file mode 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 @@ -1601,6 +1613,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import static net.kyori.adventure.text.Component.text; + + ++@Deprecated(forRemoval = true) +public class TimingsCommand extends BukkitCommand { + private static final List TIMINGS_SUBCOMMANDS = ImmutableList.of("report", "reset", "on", "off", "paste", "verbon", "verboff"); + private long lastResetAttempt = 0; @@ -1729,6 +1742,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + ++/** ++ * @deprecated Timings will likely be replaced with Spark in the future ++ */ ++@Deprecated(forRemoval = true) +public final class TimingsManager { + static final Map TIMING_MAP = LoadingMap.of( + new ConcurrentHashMap<>(4096, .5F), TimingHandler::new @@ -1896,6 +1913,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + +import java.util.List; + ++@Deprecated(forRemoval = true) +@SuppressWarnings("WeakerAccess") +public class TimingsReportListener implements net.kyori.adventure.audience.ForwardingAudience, MessageCommandSender { + private final List senders; @@ -2042,6 +2060,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + ++@Deprecated(forRemoval = true) +public class Counter extends ForwardingMap { + private final Map counts = new HashMap<>(); + @@ -2096,6 +2115,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * Provides Utility methods that assist with generating JSON Objects + */ +@SuppressWarnings({"rawtypes", "SuppressionAnnotation"}) ++@Deprecated(forRemoval = true) +public final class JSONUtil { + private JSONUtil() {} + @@ -2251,6 +2271,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * + * @param Value + */ ++@Deprecated(forRemoval = true) +public class LoadingIntMap extends Int2ObjectOpenHashMap { + private final Function loader; + @@ -2357,6 +2378,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * @param Key + * @param Value + */ ++@Deprecated(forRemoval = true) +public class LoadingMap extends AbstractMap { + private final Map backingMap; + private final java.util.function.Function loader; @@ -2717,6 +2739,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * @param Key Type of the Map + * @param Value Type of the Map + */ ++@Deprecated(forRemoval = true) +public class MRUMapCache extends AbstractMap { + final Map backingMap; + Object cacheKey; @@ -3604,7 +3627,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - private long totalTime = 0; - private long curTickTotal = 0; - private long violations = 0; -+@Deprecated ++@Deprecated(forRemoval = true) +public final class CustomTimingsHandler { + private final Timing handler; diff --git a/patches/server/Timings-v2.patch b/patches/server/Timings-v2.patch index 980872ccf5..9932ed044f 100644 --- a/patches/server/Timings-v2.patch +++ b/patches/server/Timings-v2.patch @@ -26,6 +26,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import java.util.Map; + +// TODO: Re-implement missing timers ++@Deprecated(forRemoval = true) +public final class MinecraftTimings { + + public static final Timing serverOversleep = Timings.ofSafe("Server Oversleep"); @@ -252,6 +253,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import static net.kyori.adventure.text.Component.text; + +@SuppressWarnings({"rawtypes", "SuppressionAnnotation"}) ++@Deprecated(forRemoval = true) +public class TimingsExport extends Thread { + + private final TimingsReportListener listeners; @@ -585,6 +587,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * Set of timers per world, to track world specific timings. + */ +// TODO: Re-implement missing timers ++@Deprecated(forRemoval = true) +public class WorldTimingsHandler { + public final Timing mobSpawn; + public final Timing doChunkUnload;