From 18346a0564ba1144f876e25d58354bde04758392 Mon Sep 17 00:00:00 2001 From: dordsor21 Date: Sat, 12 Nov 2022 11:45:47 +0000 Subject: [PATCH] refactor: adjust specific Nullable annotations used - Fixes #3860 - Guice requires javax annotations be used for Inject annotated constructors - Guice does not require not-null annotations, this is assumed - Also to do with #3413 --- .../bukkit/generator/LegacyBlockStatePopulator.java | 3 +-- .../bukkit/util/fawe/FaweRegionManager.java | 12 ++++-------- .../bukkit/util/fawe/FaweSchematicHandler.java | 6 +++--- .../configuration/caption/ClickStripTransform.java | 5 ++--- .../plotsquared/core/generator/HybridPlotWorld.java | 6 +++--- .../java/com/plotsquared/core/plot/PlotTitle.java | 3 ++- 6 files changed, 15 insertions(+), 20 deletions(-) diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/generator/LegacyBlockStatePopulator.java b/Bukkit/src/main/java/com/plotsquared/bukkit/generator/LegacyBlockStatePopulator.java index eb8ad0201..d9482c5f2 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/generator/LegacyBlockStatePopulator.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/generator/LegacyBlockStatePopulator.java @@ -33,7 +33,6 @@ import org.bukkit.Chunk; import org.bukkit.World; import org.bukkit.generator.BlockPopulator; import org.checkerframework.checker.nullness.qual.NonNull; -import org.jetbrains.annotations.NotNull; import java.util.Random; @@ -51,7 +50,7 @@ final class LegacyBlockStatePopulator extends BlockPopulator { } @Override - public void populate(@NotNull final World world, @NotNull final Random random, @NotNull final Chunk source) { + public void populate(@NonNull final World world, @NonNull final Random random, @NonNull final Chunk source) { int chunkMinX = source.getX() << 4; int chunkMinZ = source.getZ() << 4; PlotArea area = Location.at(world.getName(), chunkMinX, 0, chunkMinZ).getPlotArea(); diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/util/fawe/FaweRegionManager.java b/Bukkit/src/main/java/com/plotsquared/bukkit/util/fawe/FaweRegionManager.java index 1751710bb..0272a49e4 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/util/fawe/FaweRegionManager.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/util/fawe/FaweRegionManager.java @@ -36,8 +36,7 @@ import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.world.biome.BiomeType; import org.checkerframework.checker.nullness.qual.NonNull; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import org.checkerframework.checker.nullness.qual.Nullable; import java.util.Set; @@ -46,10 +45,7 @@ public class FaweRegionManager extends BukkitRegionManager { private final FaweDelegateRegionManager delegate = new FaweDelegateRegionManager(); @Inject - public FaweRegionManager( - @NonNull WorldUtil worldUtil, @NonNull GlobalBlockQueue blockQueue, @NonNull - ProgressSubscriberFactory subscriberFactory - ) { + public FaweRegionManager(WorldUtil worldUtil, GlobalBlockQueue blockQueue, ProgressSubscriberFactory subscriberFactory) { super(worldUtil, blockQueue, subscriberFactory); } @@ -76,9 +72,9 @@ public class FaweRegionManager extends BukkitRegionManager { @Override public boolean handleClear( - @NotNull Plot plot, + @NonNull Plot plot, @Nullable Runnable whenDone, - @NotNull PlotManager manager, + @NonNull PlotManager manager, final @Nullable PlotPlayer player ) { if (!Settings.FAWE_Components.CLEAR || !(manager instanceof HybridPlotManager)) { diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/util/fawe/FaweSchematicHandler.java b/Bukkit/src/main/java/com/plotsquared/bukkit/util/fawe/FaweSchematicHandler.java index 9b909439a..c1b2bbd7e 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/util/fawe/FaweSchematicHandler.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/util/fawe/FaweSchematicHandler.java @@ -29,7 +29,7 @@ import com.plotsquared.core.util.SchematicHandler; import com.plotsquared.core.util.WorldUtil; import com.plotsquared.core.util.task.RunnableVal; import com.sk89q.jnbt.CompoundTag; -import org.jetbrains.annotations.NotNull; +import org.checkerframework.checker.nullness.qual.NonNull; import java.io.InputStream; import java.net.URL; @@ -40,7 +40,7 @@ public class FaweSchematicHandler extends SchematicHandler { private final FaweDelegateSchematicHandler delegate = new FaweDelegateSchematicHandler(); @Inject - public FaweSchematicHandler(@NotNull WorldUtil worldUtil, @NotNull ProgressSubscriberFactory subscriberFactory) { + public FaweSchematicHandler(WorldUtil worldUtil, ProgressSubscriberFactory subscriberFactory) { super(worldUtil, subscriberFactory); } @@ -75,7 +75,7 @@ public class FaweSchematicHandler extends SchematicHandler { } @Override - public Schematic getSchematic(@NotNull InputStream is) { + public Schematic getSchematic(@NonNull InputStream is) { return delegate.getSchematic(is); } diff --git a/Core/src/main/java/com/plotsquared/core/configuration/caption/ClickStripTransform.java b/Core/src/main/java/com/plotsquared/core/configuration/caption/ClickStripTransform.java index 470f1b914..2ebdf2c87 100644 --- a/Core/src/main/java/com/plotsquared/core/configuration/caption/ClickStripTransform.java +++ b/Core/src/main/java/com/plotsquared/core/configuration/caption/ClickStripTransform.java @@ -21,16 +21,15 @@ package com.plotsquared.core.configuration.caption; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.event.ClickEvent; import org.checkerframework.checker.nullness.qual.NonNull; -import org.jetbrains.annotations.NotNull; import java.util.EnumSet; import java.util.Set; final class ClickStripTransform implements ComponentTransform { - private final Set actionsToStrip; + private final Set actionsToStrip; - public ClickStripTransform(final Set actionsToStrip) { + public ClickStripTransform(final Set actionsToStrip) { this.actionsToStrip = EnumSet.copyOf(actionsToStrip); } diff --git a/Core/src/main/java/com/plotsquared/core/generator/HybridPlotWorld.java b/Core/src/main/java/com/plotsquared/core/generator/HybridPlotWorld.java index 6138f5325..532cc691a 100644 --- a/Core/src/main/java/com/plotsquared/core/generator/HybridPlotWorld.java +++ b/Core/src/main/java/com/plotsquared/core/generator/HybridPlotWorld.java @@ -93,10 +93,10 @@ public class HybridPlotWorld extends ClassicPlotWorld { @Inject public HybridPlotWorld( @Assisted("world") final String worldName, - @Nullable @Assisted("id") final String id, + @javax.annotation.Nullable @Assisted("id") final String id, @Assisted final @NonNull IndependentPlotGenerator generator, - @Nullable @Assisted("min") final PlotId min, - @Nullable @Assisted("max") final PlotId max, + @javax.annotation.Nullable @Assisted("min") final PlotId min, + @javax.annotation.Nullable @Assisted("max") final PlotId max, @WorldConfig final @NonNull YamlConfiguration worldConfiguration, final @NonNull GlobalBlockQueue blockQueue ) { diff --git a/Core/src/main/java/com/plotsquared/core/plot/PlotTitle.java b/Core/src/main/java/com/plotsquared/core/plot/PlotTitle.java index 58ec05999..fe4302d0b 100644 --- a/Core/src/main/java/com/plotsquared/core/plot/PlotTitle.java +++ b/Core/src/main/java/com/plotsquared/core/plot/PlotTitle.java @@ -18,7 +18,8 @@ */ package com.plotsquared.core.plot; -import javax.annotation.Nullable; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.util.Objects; public class PlotTitle {