SPIGOT-2540: Add nullability annotations to entire Bukkit API

By: Darkyenus <darkyenus@gmail.com>
This commit is contained in:
Bukkit/Spigot
2019-03-13 17:42:57 +11:00
parent e069a80fd8
commit 416c865476
565 changed files with 5372 additions and 2008 deletions
@@ -2,6 +2,7 @@ package org.bukkit.scheduler;
import org.bukkit.Bukkit;
import org.bukkit.plugin.Plugin;
import org.jetbrains.annotations.NotNull;
/**
* This class is provided as an easy way to handle scheduling tasks.
@@ -38,7 +39,8 @@ public abstract class BukkitRunnable implements Runnable {
* @throws IllegalStateException if this was already scheduled
* @see BukkitScheduler#runTask(Plugin, Runnable)
*/
public synchronized BukkitTask runTask(Plugin plugin) throws IllegalArgumentException, IllegalStateException {
@NotNull
public synchronized BukkitTask runTask(@NotNull Plugin plugin) throws IllegalArgumentException, IllegalStateException {
checkNotYetScheduled();
return setupTask(Bukkit.getScheduler().runTask(plugin, (Runnable) this));
}
@@ -55,7 +57,8 @@ public abstract class BukkitRunnable implements Runnable {
* @throws IllegalStateException if this was already scheduled
* @see BukkitScheduler#runTaskAsynchronously(Plugin, Runnable)
*/
public synchronized BukkitTask runTaskAsynchronously(Plugin plugin) throws IllegalArgumentException, IllegalStateException {
@NotNull
public synchronized BukkitTask runTaskAsynchronously(@NotNull Plugin plugin) throws IllegalArgumentException, IllegalStateException {
checkNotYetScheduled();
return setupTask(Bukkit.getScheduler().runTaskAsynchronously(plugin, (Runnable) this));
}
@@ -70,7 +73,8 @@ public abstract class BukkitRunnable implements Runnable {
* @throws IllegalStateException if this was already scheduled
* @see BukkitScheduler#runTaskLater(Plugin, Runnable, long)
*/
public synchronized BukkitTask runTaskLater(Plugin plugin, long delay) throws IllegalArgumentException, IllegalStateException {
@NotNull
public synchronized BukkitTask runTaskLater(@NotNull Plugin plugin, long delay) throws IllegalArgumentException, IllegalStateException {
checkNotYetScheduled();
return setupTask(Bukkit.getScheduler().runTaskLater(plugin, (Runnable) this, delay));
}
@@ -89,7 +93,8 @@ public abstract class BukkitRunnable implements Runnable {
* @throws IllegalStateException if this was already scheduled
* @see BukkitScheduler#runTaskLaterAsynchronously(Plugin, Runnable, long)
*/
public synchronized BukkitTask runTaskLaterAsynchronously(Plugin plugin, long delay) throws IllegalArgumentException, IllegalStateException {
@NotNull
public synchronized BukkitTask runTaskLaterAsynchronously(@NotNull Plugin plugin, long delay) throws IllegalArgumentException, IllegalStateException {
checkNotYetScheduled();
return setupTask(Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, (Runnable) this, delay));
}
@@ -106,7 +111,8 @@ public abstract class BukkitRunnable implements Runnable {
* @throws IllegalStateException if this was already scheduled
* @see BukkitScheduler#runTaskTimer(Plugin, Runnable, long, long)
*/
public synchronized BukkitTask runTaskTimer(Plugin plugin, long delay, long period) throws IllegalArgumentException, IllegalStateException {
@NotNull
public synchronized BukkitTask runTaskTimer(@NotNull Plugin plugin, long delay, long period) throws IllegalArgumentException, IllegalStateException {
checkNotYetScheduled();
return setupTask(Bukkit.getScheduler().runTaskTimer(plugin, (Runnable) this, delay, period));
}
@@ -128,7 +134,8 @@ public abstract class BukkitRunnable implements Runnable {
* @see BukkitScheduler#runTaskTimerAsynchronously(Plugin, Runnable, long,
* long)
*/
public synchronized BukkitTask runTaskTimerAsynchronously(Plugin plugin, long delay, long period) throws IllegalArgumentException, IllegalStateException {
@NotNull
public synchronized BukkitTask runTaskTimerAsynchronously(@NotNull Plugin plugin, long delay, long period) throws IllegalArgumentException, IllegalStateException {
checkNotYetScheduled();
return setupTask(Bukkit.getScheduler().runTaskTimerAsynchronously(plugin, (Runnable) this, delay, period));
}
@@ -156,7 +163,8 @@ public abstract class BukkitRunnable implements Runnable {
}
}
private BukkitTask setupTask(final BukkitTask task) {
@NotNull
private BukkitTask setupTask(@NotNull final BukkitTask task) {
this.task = task;
return task;
}