Finish converting most of the undeprecated api to jspecify

This commit is contained in:
Jake Potrebic 2024-09-30 11:44:36 -07:00
parent ba3c29b92e
commit e7e1ab56ca
No known key found for this signature in database
GPG key ID: ECE0B3C133C016C5
45 changed files with 1046 additions and 982 deletions

View file

@ -15,20 +15,21 @@ Co-authored-by: Yannick Lamprecht <yannicklamprecht@live.de>
diff --git a/src/main/java/io/papermc/paper/potion/SuspiciousEffectEntry.java b/src/main/java/io/papermc/paper/potion/SuspiciousEffectEntry.java
new file mode 100644
index 0000000000000000000000000000000000000000..6a96e339ff1466df5743b5d42a31ce6a67e48f16
index 0000000000000000000000000000000000000000..6311ede3e3812da2ccdbcb19522facd7b2e3bd5c
--- /dev/null
+++ b/src/main/java/io/papermc/paper/potion/SuspiciousEffectEntry.java
@@ -0,0 +1,38 @@
@@ -0,0 +1,39 @@
+package io.papermc.paper.potion;
+
+import org.bukkit.potion.PotionEffect;
+import org.bukkit.potion.PotionEffectType;
+import org.jetbrains.annotations.Contract;
+import org.jetbrains.annotations.NotNull;
+import org.jspecify.annotations.NullMarked;
+
+/**
+ * Represents a {@link PotionEffectType} paired with a duration.
+ */
+@NullMarked
+public sealed interface SuspiciousEffectEntry permits SuspiciousEffectEntryImpl {
+
+ /**
@ -36,7 +37,7 @@ index 0000000000000000000000000000000000000000..6a96e339ff1466df5743b5d42a31ce6a
+ *
+ * @return effect type
+ */
+ @NotNull PotionEffectType effect();
+ PotionEffectType effect();
+
+ /**
+ * Gets the duration for this effect instance.
@ -53,22 +54,25 @@ index 0000000000000000000000000000000000000000..6a96e339ff1466df5743b5d42a31ce6a
+ * @return new instance of an entry
+ */
+ @Contract(value = "_, _ -> new", pure = true)
+ static @NotNull SuspiciousEffectEntry create(final @NotNull PotionEffectType effectType, final int duration) {
+ static SuspiciousEffectEntry create(final PotionEffectType effectType, final int duration) {
+ return new SuspiciousEffectEntryImpl(effectType, duration);
+ }
+}
diff --git a/src/main/java/io/papermc/paper/potion/SuspiciousEffectEntryImpl.java b/src/main/java/io/papermc/paper/potion/SuspiciousEffectEntryImpl.java
new file mode 100644
index 0000000000000000000000000000000000000000..e5002ccaef9ea7a9db94296ad0d66cdae050cdd1
index 0000000000000000000000000000000000000000..a91d37ee450944ea779bd6b61d416467948bb55f
--- /dev/null
+++ b/src/main/java/io/papermc/paper/potion/SuspiciousEffectEntryImpl.java
@@ -0,0 +1,7 @@
@@ -0,0 +1,10 @@
+package io.papermc.paper.potion;
+
+import org.bukkit.potion.PotionEffectType;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.ApiStatus;
+import org.jspecify.annotations.NullMarked;
+
+record SuspiciousEffectEntryImpl(@NotNull PotionEffectType effect, int duration) implements SuspiciousEffectEntry {
+@ApiStatus.Internal
+@NullMarked
+record SuspiciousEffectEntryImpl(PotionEffectType effect, int duration) implements SuspiciousEffectEntry {
+}
diff --git a/src/main/java/org/bukkit/entity/MushroomCow.java b/src/main/java/org/bukkit/entity/MushroomCow.java
index 86c0043ef4e1288b6fe2f68a9b6d01c3de2c3454..3677f19ef1c05b76d946b1b2b491a6c3cec76140 100644