1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2024-11-05 17:46:21 +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
// Too many false positives right now. Maybe we need an indirection for it later on.
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("AlreadyChecked", CheckSeverity.OFF) // Seems to be broken?
check("NonOverridingEquals", CheckSeverity.OFF) // Peripheral.equals makes this hard to avoid
check("FutureReturnValueIgnored", CheckSeverity.OFF) // Too many false positives with Netty

View File

@ -35,7 +35,6 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import java.io.File
import java.io.IOException
import java.net.URI
import java.net.URL
import java.util.regex.Pattern
abstract class CCTweakedExtension(
@ -226,12 +225,12 @@ abstract class CCTweakedExtension(
* where possible.
*/
fun downloadFile(label: String, url: String): File {
val url = URL(url)
val path = File(url.path)
val uri = URI(url)
val path = File(uri.path)
project.repositories.ivy {
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 {
artifact("[artifact].[ext]")
}

View File

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

View File

@ -13,8 +13,6 @@ import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.level.block.entity.BlockEntity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.annotation.Nullable;
import java.util.ArrayList;
@ -29,8 +27,6 @@ import java.util.Objects;
* @param <C> A platform-specific type, used for the invalidation callback.
*/
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<>();
/**

View File

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

View File

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

View File

@ -42,6 +42,7 @@ class GameTestSequenceMixin {
}
@Shadow
@SuppressWarnings("unused")
private void tick(long tick) {
}
}

View File

@ -38,7 +38,7 @@ class MinecraftMixin implements MinecraftExtensions {
private final AtomicBoolean isStable = new AtomicBoolean(false);
@Inject(method = "runTick", at = @At("TAIL"))
@SuppressWarnings("UnusedMethod")
@SuppressWarnings("unused")
private void updateStable(boolean render, CallbackInfo ci) {
isStable.set(
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.
*/
@Overwrite
@SuppressWarnings("UnusedMethod")
@SuppressWarnings("unused")
private void askForBackup(Screen screen, String level, boolean customised, Runnable action) {
action.run();
}

View File

@ -27,7 +27,7 @@ class GameRendererMixin {
private Map<String, ShaderInstance> shaders;
@Inject(method = "reloadShaders", at = @At(value = "TAIL"))
@SuppressWarnings("UnusedMethod")
@SuppressWarnings("unused")
private void onReloadShaders(ResourceProvider resourceManager, CallbackInfo ci) {
try {
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),
cancellable = true
)
@SuppressWarnings("UnusedMethod")
@SuppressWarnings("unused")
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)) {
ci.cancel();

View File

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

View File

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

View File

@ -31,7 +31,7 @@ class MultiPlayerGameModeMixin {
cancellable = true,
locals = LocalCapture.CAPTURE_FAILHARD
)
@SuppressWarnings("UnusedMethod")
@SuppressWarnings("unused")
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);
}

View File

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

View File

@ -29,13 +29,13 @@ class ChunkMapMixin {
ServerLevel level;
@Inject(method = "playerLoadedChunk", at = @At("TAIL"))
@SuppressWarnings("UnusedMethod")
@SuppressWarnings("unused")
private void onPlayerLoadedChunk(ServerPlayer player, MutableObject<ClientboundLevelChunkWithLightPacket> packetCache, LevelChunk chunk, CallbackInfo callback) {
CommonHooks.onChunkWatch(chunk, player);
}
@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) {
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"),
cancellable = true
)
@SuppressWarnings("UnusedMethod")
@SuppressWarnings("unused")
private void spawnAtLocation(ItemStack stack, float yOffset, CallbackInfoReturnable<ItemEntity> cb) {
if (CommonHooks.onLivingDrop((Entity) (Object) this, stack)) cb.setReturnValue(null);
}

View File

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

View File

@ -21,7 +21,7 @@ import java.util.function.Predicate;
@Mixin(TagsProvider.class)
class TagsProviderMixin {
@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) {
var element = ((TagEntryAccessor) tag).computercraft$elementOrTag();
if (element.tag() && element.id().getNamespace().equals("minecraft")) cir.setReturnValue(false);