1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2024-06-16 01:59:54 +00:00

Update ErrorProne

This commit is contained in:
Jonathan Coates 2024-04-28 18:32:19 +01:00
parent 4e90240922
commit 6e9799316a
No known key found for this signature in database
GPG Key ID: B9E431FF07C98D06
19 changed files with 24 additions and 27 deletions

View File

@ -94,9 +94,8 @@ sourceSets.all {
check("InlineMeSuggester", CheckSeverity.OFF) // Minecraft uses @Deprecated liberally check("InlineMeSuggester", CheckSeverity.OFF) // Minecraft uses @Deprecated liberally
// Too many false positives right now. Maybe we need an indirection for it later on. // Too many false positives right now. Maybe we need an indirection for it later on.
check("ReferenceEquality", CheckSeverity.OFF) check("ReferenceEquality", CheckSeverity.OFF)
check("UnusedVariable", CheckSeverity.OFF) // Too many false positives with records. check("EnumOrdinal", CheckSeverity.OFF) // For now. We could replace most of these with EnumMap.
check("OperatorPrecedence", CheckSeverity.OFF) // For now. check("OperatorPrecedence", CheckSeverity.OFF) // For now.
check("AlreadyChecked", CheckSeverity.OFF) // Seems to be broken?
check("NonOverridingEquals", CheckSeverity.OFF) // Peripheral.equals makes this hard to avoid check("NonOverridingEquals", CheckSeverity.OFF) // Peripheral.equals makes this hard to avoid
check("FutureReturnValueIgnored", CheckSeverity.OFF) // Too many false positives with Netty check("FutureReturnValueIgnored", CheckSeverity.OFF) // Too many false positives with Netty

View File

@ -35,7 +35,6 @@
import java.io.File import java.io.File
import java.io.IOException import java.io.IOException
import java.net.URI import java.net.URI
import java.net.URL
import java.util.regex.Pattern import java.util.regex.Pattern
abstract class CCTweakedExtension( abstract class CCTweakedExtension(
@ -226,12 +225,12 @@ fun <T> jacoco(task: NamedDomainObjectProvider<T>) where T : Task, T : JavaForkO
* where possible. * where possible.
*/ */
fun downloadFile(label: String, url: String): File { fun downloadFile(label: String, url: String): File {
val url = URL(url) val uri = URI(url)
val path = File(url.path) val path = File(uri.path)
project.repositories.ivy { project.repositories.ivy {
name = label name = label
setUrl(URI(url.protocol, url.userInfo, url.host, url.port, path.parent, null, null)) setUrl(URI(uri.scheme, uri.userInfo, uri.host, uri.port, path.parent, null, null))
patternLayout { patternLayout {
artifact("[artifact].[ext]") artifact("[artifact].[ext]")
} }

View File

@ -57,7 +57,7 @@ jmh = "1.37"
cctJavadoc = "1.8.2" cctJavadoc = "1.8.2"
checkstyle = "10.14.1" checkstyle = "10.14.1"
curseForgeGradle = "1.0.14" curseForgeGradle = "1.0.14"
errorProne-core = "2.23.0" errorProne-core = "2.27.0"
errorProne-plugin = "3.1.0" errorProne-plugin = "3.1.0"
fabric-loom = "1.6.7" fabric-loom = "1.6.7"
forgeGradle = "6.0.21" forgeGradle = "6.0.21"

View File

@ -13,8 +13,6 @@
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.util.ArrayList; import java.util.ArrayList;
@ -29,8 +27,6 @@
* @param <C> A platform-specific type, used for the invalidation callback. * @param <C> A platform-specific type, used for the invalidation callback.
*/ */
public final class GenericPeripheralProvider<C extends Runnable> { public final class GenericPeripheralProvider<C extends Runnable> {
private static final Logger LOG = LoggerFactory.getLogger(GenericPeripheralProvider.class);
private final List<ComponentLookup<? super C>> lookups = new ArrayList<>(); private final List<ComponentLookup<? super C>> lookups = new ArrayList<>();
/** /**

View File

@ -33,7 +33,6 @@ public final class IDAssigner {
private final Path idFile; private final Path idFile;
private final Path newIdFile; private final Path newIdFile;
private boolean atomicMove = true;
private @Nullable Map<String, Integer> ids; private @Nullable Map<String, Integer> ids;
public IDAssigner(Path path) { public IDAssigner(Path path) {

View File

@ -4,6 +4,7 @@
package dan200.computercraft.shared.util; package dan200.computercraft.shared.util;
import com.google.errorprone.annotations.Keep;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceKey;
import net.minecraft.server.level.ChunkLevel; import net.minecraft.server.level.ChunkLevel;
@ -132,6 +133,7 @@ public static class Token {
/** /**
* The current state of this token. * The current state of this token.
*/ */
@Keep
private volatile State $state = State.IDLE; private volatile State $state = State.IDLE;
public Token(BlockEntity owner) { public Token(BlockEntity owner) {

View File

@ -42,6 +42,7 @@ public void tickAndContinue(long ticks) {
} }
@Shadow @Shadow
@SuppressWarnings("unused")
private void tick(long tick) { private void tick(long tick) {
} }
} }

View File

@ -38,7 +38,7 @@ class MinecraftMixin implements MinecraftExtensions {
private final AtomicBoolean isStable = new AtomicBoolean(false); private final AtomicBoolean isStable = new AtomicBoolean(false);
@Inject(method = "runTick", at = @At("TAIL")) @Inject(method = "runTick", at = @At("TAIL"))
@SuppressWarnings("UnusedMethod") @SuppressWarnings("unused")
private void updateStable(boolean render, CallbackInfo ci) { private void updateStable(boolean render, CallbackInfo ci) {
isStable.set( isStable.set(
level != null && player != null && level != null && player != null &&

View File

@ -22,7 +22,7 @@ public class WorldOpenFlowsMixin {
* @reason Makes it easier to run tests. We can switch to an @Inject if this becomes a problem. * @reason Makes it easier to run tests. We can switch to an @Inject if this becomes a problem.
*/ */
@Overwrite @Overwrite
@SuppressWarnings("UnusedMethod") @SuppressWarnings("unused")
private void askForBackup(Screen screen, String level, boolean customised, Runnable action) { private void askForBackup(Screen screen, String level, boolean customised, Runnable action) {
action.run(); action.run();
} }

View File

@ -27,7 +27,7 @@ class GameRendererMixin {
private Map<String, ShaderInstance> shaders; private Map<String, ShaderInstance> shaders;
@Inject(method = "reloadShaders", at = @At(value = "TAIL")) @Inject(method = "reloadShaders", at = @At(value = "TAIL"))
@SuppressWarnings("UnusedMethod") @SuppressWarnings("unused")
private void onReloadShaders(ResourceProvider resourceManager, CallbackInfo ci) { private void onReloadShaders(ResourceProvider resourceManager, CallbackInfo ci) {
try { try {
ClientRegistry.registerShaders(resourceManager, (shader, callback) -> { ClientRegistry.registerShaders(resourceManager, (shader, callback) -> {

View File

@ -22,7 +22,7 @@ class ItemFrameRendererMixin {
at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/vertex/PoseStack;mulPose(Lorg/joml/Quaternionf;)V", ordinal = 2, shift = At.Shift.AFTER), at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/vertex/PoseStack;mulPose(Lorg/joml/Quaternionf;)V", ordinal = 2, shift = At.Shift.AFTER),
cancellable = true cancellable = true
) )
@SuppressWarnings("UnusedMethod") @SuppressWarnings("unused")
private void render(ItemFrame entity, float yaw, float partialTicks, PoseStack pose, MultiBufferSource buffers, int light, CallbackInfo ci) { private void render(ItemFrame entity, float yaw, float partialTicks, PoseStack pose, MultiBufferSource buffers, int light, CallbackInfo ci) {
if (ClientHooks.onRenderItemFrame(pose, buffers, entity, entity.getItem(), light)) { if (ClientHooks.onRenderItemFrame(pose, buffers, entity, entity.getItem(), light)) {
ci.cancel(); ci.cancel();

View File

@ -19,7 +19,7 @@
@Mixin(ItemInHandRenderer.class) @Mixin(ItemInHandRenderer.class)
class ItemInHandRendererMixin { class ItemInHandRendererMixin {
@Inject(method = "renderArmWithItem", at = @At("HEAD"), cancellable = true) @Inject(method = "renderArmWithItem", at = @At("HEAD"), cancellable = true)
@SuppressWarnings("UnusedMethod") @SuppressWarnings("unused")
private void onRenderItem( private void onRenderItem(
AbstractClientPlayer player, float partialTicks, float pitch, InteractionHand hand, float swingProgress, ItemStack stack, AbstractClientPlayer player, float partialTicks, float pitch, InteractionHand hand, float swingProgress, ItemStack stack,
float equippedProgress, PoseStack transform, MultiBufferSource buffer, int combinedLight, CallbackInfo ci float equippedProgress, PoseStack transform, MultiBufferSource buffer, int combinedLight, CallbackInfo ci

View File

@ -25,13 +25,13 @@ class MinecraftMixin {
private ReloadableResourceManager resourceManager; private ReloadableResourceManager resourceManager;
@Inject(method = "clearLevel(Lnet/minecraft/client/gui/screens/Screen;)V", at = @At("HEAD")) @Inject(method = "clearLevel(Lnet/minecraft/client/gui/screens/Screen;)V", at = @At("HEAD"))
@SuppressWarnings("UnusedMethod") @SuppressWarnings("unused")
private void clearLevel(Screen screen, CallbackInfo ci) { private void clearLevel(Screen screen, CallbackInfo ci) {
ClientHooks.onWorldUnload(); ClientHooks.onWorldUnload();
} }
@Inject(method = "setLevel", at = @At("HEAD")) @Inject(method = "setLevel", at = @At("HEAD"))
@SuppressWarnings("UnusedMethod") @SuppressWarnings("unused")
private void setLevel(ClientLevel screen, CallbackInfo ci) { private void setLevel(ClientLevel screen, CallbackInfo ci) {
ClientHooks.onWorldUnload(); ClientHooks.onWorldUnload();
} }
@ -44,6 +44,7 @@ private void setLevel(ClientLevel screen, CallbackInfo ci) {
ordinal = 0 ordinal = 0
) )
) )
@SuppressWarnings("unused")
public void beforeInitialResourceReload(GameConfig gameConfig, CallbackInfo ci) { public void beforeInitialResourceReload(GameConfig gameConfig, CallbackInfo ci) {
ClientRegistry.registerReloadListeners(resourceManager::registerReloadListener, (Minecraft) (Object) this); ClientRegistry.registerReloadListeners(resourceManager::registerReloadListener, (Minecraft) (Object) this);
} }

View File

@ -31,7 +31,7 @@ class MultiPlayerGameModeMixin {
cancellable = true, cancellable = true,
locals = LocalCapture.CAPTURE_FAILHARD locals = LocalCapture.CAPTURE_FAILHARD
) )
@SuppressWarnings("UnusedMethod") @SuppressWarnings("unused")
private void onBlockBreak(BlockPos pos, CallbackInfoReturnable<Boolean> cir, Level level, BlockState state, Block block) { private void onBlockBreak(BlockPos pos, CallbackInfoReturnable<Boolean> cir, Level level, BlockState state, Block block) {
if (!FabricCommonHooks.onBlockDestroy(level, minecraft.player, pos, state, null)) cir.setReturnValue(true); if (!FabricCommonHooks.onBlockDestroy(level, minecraft.player, pos, state, null)) cir.setReturnValue(true);
} }

View File

@ -26,13 +26,13 @@ class SoundEngineMixin {
private static SoundEngine self; private static SoundEngine self;
@Inject(method = "play", at = @At(value = "HEAD")) @Inject(method = "play", at = @At(value = "HEAD"))
@SuppressWarnings("UnusedMethod") @SuppressWarnings("unused")
private void playSound(SoundInstance sound, CallbackInfo ci) { private void playSound(SoundInstance sound, CallbackInfo ci) {
self = (SoundEngine) (Object) this; self = (SoundEngine) (Object) this;
} }
@Inject(at = @At("TAIL"), method = "method_19755") @Inject(at = @At("TAIL"), method = "method_19755")
@SuppressWarnings("UnusedMethod") @SuppressWarnings("unused")
private static void onStream(AudioStream stream, Channel channel, CallbackInfo ci) { private static void onStream(AudioStream stream, Channel channel, CallbackInfo ci) {
SpeakerManager.onPlayStreaming(assertNonNull(self), channel, stream); SpeakerManager.onPlayStreaming(assertNonNull(self), channel, stream);
} }

View File

@ -29,13 +29,13 @@ class ChunkMapMixin {
ServerLevel level; ServerLevel level;
@Inject(method = "playerLoadedChunk", at = @At("TAIL")) @Inject(method = "playerLoadedChunk", at = @At("TAIL"))
@SuppressWarnings("UnusedMethod") @SuppressWarnings("unused")
private void onPlayerLoadedChunk(ServerPlayer player, MutableObject<ClientboundLevelChunkWithLightPacket> packetCache, LevelChunk chunk, CallbackInfo callback) { private void onPlayerLoadedChunk(ServerPlayer player, MutableObject<ClientboundLevelChunkWithLightPacket> packetCache, LevelChunk chunk, CallbackInfo callback) {
CommonHooks.onChunkWatch(chunk, player); CommonHooks.onChunkWatch(chunk, player);
} }
@Inject(method = "updateChunkScheduling", at = @At("HEAD")) @Inject(method = "updateChunkScheduling", at = @At("HEAD"))
@SuppressWarnings("UnusedMethod") @SuppressWarnings("unused")
private void onUpdateChunkScheduling(long chunkPos, int newLevel, @Nullable ChunkHolder holder, int oldLevel, CallbackInfoReturnable<ChunkHolder> callback) { private void onUpdateChunkScheduling(long chunkPos, int newLevel, @Nullable ChunkHolder holder, int oldLevel, CallbackInfoReturnable<ChunkHolder> callback) {
CommonHooks.onChunkTicketLevelChanged(level, chunkPos, oldLevel, newLevel); CommonHooks.onChunkTicketLevelChanged(level, chunkPos, oldLevel, newLevel);
} }

View File

@ -20,7 +20,7 @@ class EntityMixin {
at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/Level;addFreshEntity(Lnet/minecraft/world/entity/Entity;)Z"), at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/Level;addFreshEntity(Lnet/minecraft/world/entity/Entity;)Z"),
cancellable = true cancellable = true
) )
@SuppressWarnings("UnusedMethod") @SuppressWarnings("unused")
private void spawnAtLocation(ItemStack stack, float yOffset, CallbackInfoReturnable<ItemEntity> cb) { private void spawnAtLocation(ItemStack stack, float yOffset, CallbackInfoReturnable<ItemEntity> cb) {
if (CommonHooks.onLivingDrop((Entity) (Object) this, stack)) cb.setReturnValue(null); if (CommonHooks.onLivingDrop((Entity) (Object) this, stack)) cb.setReturnValue(null);
} }

View File

@ -16,7 +16,7 @@
@Mixin(ItemEntity.class) @Mixin(ItemEntity.class)
abstract class ItemEntityMixin { abstract class ItemEntityMixin {
@Inject(method = "tick", at = @At("HEAD")) @Inject(method = "tick", at = @At("HEAD"))
@SuppressWarnings("UnusedMethod") @SuppressWarnings("unused")
private void onTick(CallbackInfo ci) { private void onTick(CallbackInfo ci) {
var stack = getItem(); var stack = getItem();
if (stack.getItem() instanceof PocketComputerItem pocket) { if (stack.getItem() instanceof PocketComputerItem pocket) {

View File

@ -21,7 +21,7 @@
@Mixin(TagsProvider.class) @Mixin(TagsProvider.class)
class TagsProviderMixin { class TagsProviderMixin {
@Inject(at = @At("HEAD"), method = "method_49658", cancellable = true) @Inject(at = @At("HEAD"), method = "method_49658", cancellable = true)
@SuppressWarnings("UnusedMethod") @SuppressWarnings("unused")
private static void onVerifyPresent(Predicate<?> predicate1, Predicate<?> predicate2, TagEntry tag, CallbackInfoReturnable<Boolean> cir) { private static void onVerifyPresent(Predicate<?> predicate1, Predicate<?> predicate2, TagEntry tag, CallbackInfoReturnable<Boolean> cir) {
var element = ((TagEntryAccessor) tag).computercraft$elementOrTag(); var element = ((TagEntryAccessor) tag).computercraft$elementOrTag();
if (element.tag() && element.id().getNamespace().equals("minecraft")) cir.setReturnValue(false); if (element.tag() && element.id().getNamespace().equals("minecraft")) cir.setReturnValue(false);