Skip to content

Commit

Permalink
Move to JetBrains annotations over findbugs (#2199)
Browse files Browse the repository at this point in the history
  • Loading branch information
serenibyss authored Nov 27, 2023
1 parent d0c1700 commit 5901bc9
Show file tree
Hide file tree
Showing 594 changed files with 3,351 additions and 3,676 deletions.
4 changes: 2 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ ij_java_case_statement_on_separate_line = true
ij_java_catch_on_new_line = false
ij_java_class_annotation_wrap = split_into_lines
ij_java_class_brace_style = end_of_line
ij_java_class_count_to_use_import_on_demand = 5
ij_java_class_count_to_use_import_on_demand = 999
ij_java_class_names_in_javadoc = 1
ij_java_deconstruction_list_wrap = normal
ij_java_do_not_indent_top_level_class_members = false
Expand Down Expand Up @@ -111,7 +111,7 @@ ij_java_for_statement_wrap = off
ij_java_generate_final_locals = false
ij_java_generate_final_parameters = false
ij_java_if_brace_force = never
ij_java_imports_layout = *,|,javax.**,java.**,|,$*
ij_java_imports_layout = gregtech.**,|,net.**,|,codechickenlib.**,|,*,|,javax.**,java.**,|,$*
ij_java_indent_case_from_switch = true
ij_java_insert_inner_class_imports = false
ij_java_insert_override_annotation = true
Expand Down
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//version: 1699743071
//version: 1700970468
/*
* DO NOT CHANGE THIS FILE!
* Also, you may replace this file at any time if there is an update available.
Expand Down Expand Up @@ -501,8 +501,8 @@ dependencies {
testCompileOnly "me.eigenraven.java8unsupported:java-8-unsupported-shim:1.0.0"
}

compileOnlyApi 'org.jetbrains:annotations:23.0.0'
annotationProcessor 'org.jetbrains:annotations:23.0.0'
compileOnlyApi 'org.jetbrains:annotations:24.1.0'
annotationProcessor 'org.jetbrains:annotations:24.1.0'
patchedMinecraft('net.minecraft:launchwrapper:1.17.2') {
transitive = false
}
Expand Down
4 changes: 3 additions & 1 deletion dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,10 @@ minecraft {
}

configurations {
compileClassPath {
implementation {
// exclude GNU trove, FastUtil is superior and still updated
exclude group: "net.sf.trove4j", module: "trove4j"
// exclude javax.annotation from findbugs, jetbrains annotations are superior
exclude group: "com.google.code.findbugs", module: "jsr305"
}
}
17 changes: 8 additions & 9 deletions src/main/java/gregtech/api/block/BlockCustomParticle.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@

import codechicken.lib.vec.Vector3;
import org.apache.commons.lang3.tuple.Pair;

import javax.annotation.Nonnull;
import org.jetbrains.annotations.NotNull;

public abstract class BlockCustomParticle extends Block implements ICustomParticleBlock {

Expand All @@ -40,8 +39,8 @@ public BlockCustomParticle(Material materialIn) {

@Override
@SideOnly(Side.CLIENT)
public boolean addHitEffects(@Nonnull IBlockState state, @Nonnull World worldObj, RayTraceResult target,
@Nonnull ParticleManager manager) {
public boolean addHitEffects(@NotNull IBlockState state, @NotNull World worldObj, RayTraceResult target,
@NotNull ParticleManager manager) {
Pair<TextureAtlasSprite, Integer> atlasSprite = getParticleTexture(worldObj, target.getBlockPos());
ParticleHandlerUtil.addHitEffects(state, worldObj, target, atlasSprite.getLeft(), atlasSprite.getRight(),
manager);
Expand All @@ -50,7 +49,7 @@ public boolean addHitEffects(@Nonnull IBlockState state, @Nonnull World worldObj

@Override
@SideOnly(Side.CLIENT)
public boolean addDestroyEffects(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull ParticleManager manager) {
public boolean addDestroyEffects(@NotNull World world, @NotNull BlockPos pos, @NotNull ParticleManager manager) {
Pair<TextureAtlasSprite, Integer> atlasSprite = getParticleTexture(world, pos);
ParticleHandlerUtil.addBlockDestroyEffects(world.getBlockState(pos), world, pos, atlasSprite.getLeft(),
atlasSprite.getRight(), manager);
Expand All @@ -67,8 +66,8 @@ public void handleCustomParticle(World worldObj, BlockPos blockPos, ParticleMana
}

@Override
public boolean addRunningEffects(@Nonnull IBlockState state, World world, @Nonnull BlockPos pos,
@Nonnull Entity entity) {
public boolean addRunningEffects(@NotNull IBlockState state, World world, @NotNull BlockPos pos,
@NotNull Entity entity) {
if (world.isRemote) {
Pair<TextureAtlasSprite, Integer> atlasSprite = getParticleTexture(world, pos);
ParticleHandlerUtil.addBlockRunningEffects(world, entity, atlasSprite.getLeft(), atlasSprite.getRight());
Expand All @@ -77,8 +76,8 @@ public boolean addRunningEffects(@Nonnull IBlockState state, World world, @Nonnu
}

@Override
public boolean addLandingEffects(@Nonnull IBlockState state, @Nonnull WorldServer worldObj,
@Nonnull BlockPos blockPosition, @Nonnull IBlockState iblockstate,
public boolean addLandingEffects(@NotNull IBlockState state, @NotNull WorldServer worldObj,
@NotNull BlockPos blockPosition, @NotNull IBlockState iblockstate,
EntityLivingBase entity, int numberOfParticles) {
PacketBlockParticle packet = new PacketBlockParticle(blockPosition,
new Vector3(entity.posX, entity.posY, entity.posZ), numberOfParticles);
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/gregtech/api/block/BuiltInRenderBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,29 @@
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.BlockRenderLayer;

import javax.annotation.Nonnull;
import org.jetbrains.annotations.NotNull;

public abstract class BuiltInRenderBlock extends BlockCustomParticle {

public BuiltInRenderBlock(Material materialIn) {
super(materialIn);
}

@Nonnull
@NotNull
@Override
public BlockRenderLayer getRenderLayer() {
return BlockRenderLayer.CUTOUT_MIPPED;
}

@Override
@SuppressWarnings("deprecation")
public boolean isOpaqueCube(@Nonnull IBlockState state) {
public boolean isOpaqueCube(@NotNull IBlockState state) {
return false;
}

@Override
@SuppressWarnings("deprecation")
public boolean isFullCube(@Nonnull IBlockState state) {
public boolean isFullCube(@NotNull IBlockState state) {
return false;
}
}
6 changes: 3 additions & 3 deletions src/main/java/gregtech/api/block/IHeatingCoilBlockStats.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import gregtech.api.recipes.recipeproperties.TemperatureProperty;
import gregtech.api.unification.material.Material;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

/**
* Implement this interface on the Block Enum for your Heating Coil block
Expand All @@ -16,7 +16,7 @@ public interface IHeatingCoilBlockStats {
/**
* @return The Unique Name of the Heating Coil
*/
@Nonnull
@NotNull
String getName();

/**
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/gregtech/api/block/UnlistedBooleanProperty.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@

import net.minecraftforge.common.property.IUnlistedProperty;

import javax.annotation.Nonnull;
import org.jetbrains.annotations.NotNull;

public class UnlistedBooleanProperty implements IUnlistedProperty<Boolean> {

private final String name;

public UnlistedBooleanProperty(@Nonnull String name) {
public UnlistedBooleanProperty(@NotNull String name) {
this.name = name;
}

@Nonnull
@NotNull
@Override
public String getName() {
return this.name;
Expand All @@ -23,14 +23,14 @@ public boolean isValid(Boolean value) {
return true;
}

@Nonnull
@NotNull
@Override
public Class<Boolean> getType() {
return Boolean.class;
}

@Override
public String valueToString(@Nonnull Boolean value) {
public String valueToString(@NotNull Boolean value) {
return value.toString();
}
}
10 changes: 5 additions & 5 deletions src/main/java/gregtech/api/block/UnlistedIntegerProperty.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@

import net.minecraftforge.common.property.IUnlistedProperty;

import javax.annotation.Nonnull;
import org.jetbrains.annotations.NotNull;

public class UnlistedIntegerProperty implements IUnlistedProperty<Integer> {

private final String name;

public UnlistedIntegerProperty(@Nonnull String name) {
public UnlistedIntegerProperty(@NotNull String name) {
this.name = name;
}

@Nonnull
@NotNull
@Override
public String getName() {
return this.name;
Expand All @@ -23,14 +23,14 @@ public boolean isValid(Integer integer) {
return true;
}

@Nonnull
@NotNull
@Override
public Class<Integer> getType() {
return Integer.class;
}

@Override
public String valueToString(@Nonnull Integer integer) {
public String valueToString(@NotNull Integer integer) {
return integer.toString();
}
}
8 changes: 4 additions & 4 deletions src/main/java/gregtech/api/block/UnlistedStringProperty.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@

import net.minecraftforge.common.property.IUnlistedProperty;

import javax.annotation.Nonnull;
import org.jetbrains.annotations.NotNull;

public class UnlistedStringProperty implements IUnlistedProperty<String> {

private final String name;

public UnlistedStringProperty(@Nonnull String name) {
public UnlistedStringProperty(@NotNull String name) {
this.name = name;
}

@Nonnull
@NotNull
@Override
public String getName() {
return this.name;
Expand All @@ -23,7 +23,7 @@ public boolean isValid(String s) {
return true;
}

@Nonnull
@NotNull
@Override
public Class<String> getType() {
return String.class;
Expand Down
17 changes: 8 additions & 9 deletions src/main/java/gregtech/api/block/VariantActiveBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet;
import it.unimi.dsi.fastutil.objects.ObjectSet;
import org.jetbrains.annotations.NotNull;
import team.chisel.ctm.client.state.CTMExtendedState;

import java.util.EnumMap;
Expand All @@ -39,8 +40,6 @@
import java.util.concurrent.locks.ReentrantReadWriteLock;
import java.util.stream.Collectors;

import javax.annotation.Nonnull;

public class VariantActiveBlock<T extends Enum<T> & IStringSerializable> extends VariantBlock<T> {

private static final Int2ObjectMap<ObjectSet<BlockPos>> ACTIVE_BLOCKS = new Int2ObjectOpenHashMap<>();
Expand Down Expand Up @@ -91,19 +90,19 @@ protected boolean canSilkHarvest() {
return false;
}

@Nonnull
@NotNull
@Override
public BlockRenderLayer getRenderLayer() {
return BlockRenderLayer.CUTOUT;
}

@Override
public boolean canRenderInLayer(@Nonnull IBlockState state, @Nonnull BlockRenderLayer layer) {
public boolean canRenderInLayer(@NotNull IBlockState state, @NotNull BlockRenderLayer layer) {
return layer == getRenderLayer() ||
layer == BloomEffectUtil.getEffectiveBloomLayer(isBloomEnabled(getState(state)));
}

@Nonnull
@NotNull
@Override
public IBlockState getStateFromMeta(int meta) {
return super.getStateFromMeta(meta).withProperty(ACTIVE_DEPRECATED, false);
Expand All @@ -118,7 +117,7 @@ public int getMetaFromState(IBlockState state) {
return meta + state.getValue(VARIANT).ordinal();
}

@Nonnull
@NotNull
@Override
protected BlockStateContainer createBlockState() {
Class<T> enumClass = getActualTypeParameter(getClass(), VariantActiveBlock.class, 0);
Expand All @@ -128,10 +127,10 @@ protected BlockStateContainer createBlockState() {
new IUnlistedProperty[] { ACTIVE });
}

@Nonnull
@NotNull
@Override
public IExtendedBlockState getExtendedState(@Nonnull IBlockState state, @Nonnull IBlockAccess world,
@Nonnull BlockPos pos) {
public IExtendedBlockState getExtendedState(@NotNull IBlockState state, @NotNull IBlockAccess world,
@NotNull BlockPos pos) {
IExtendedBlockState ext = ((IExtendedBlockState) state)
.withProperty(ACTIVE, Minecraft.getMinecraft().world != null &&
isBlockActive(Minecraft.getMinecraft().world.provider.getDimension(), pos));
Expand Down
20 changes: 10 additions & 10 deletions src/main/java/gregtech/api/block/VariantBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.util.Collections;
import java.util.List;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;

public class VariantBlock<T extends Enum<T> & IStringSerializable> extends Block implements IWalkingSpeedBonus {

protected PropertyEnum<T> VARIANT;
Expand All @@ -48,7 +48,7 @@ public VariantBlock(Material materialIn) {
}

@Override
public void getSubBlocks(@Nonnull CreativeTabs tab, @Nonnull NonNullList<ItemStack> list) {
public void getSubBlocks(@NotNull CreativeTabs tab, @NotNull NonNullList<ItemStack> list) {
for (T variant : VALUES) {
list.add(getItemVariant(variant));
}
Expand All @@ -74,7 +74,7 @@ public ItemStack getItemVariant(T variant, int amount) {
return new ItemStack(this, amount, variant.ordinal());
}

@Nonnull
@NotNull
@Override
protected BlockStateContainer createBlockState() {
Class<T> enumClass = getActualTypeParameter(getClass(), VariantBlock.class, 0);
Expand All @@ -85,8 +85,8 @@ protected BlockStateContainer createBlockState() {

@Override
@SideOnly(Side.CLIENT)
public void addInformation(@Nonnull ItemStack stack, @Nullable World player, List<String> tooltip,
@Nonnull ITooltipFlag advanced) {
public void addInformation(@NotNull ItemStack stack, @Nullable World player, List<String> tooltip,
@NotNull ITooltipFlag advanced) {
// tier less tooltip like: tile.turbine_casing.tooltip
String unlocalizedVariantTooltip = getTranslationKey() + ".tooltip";
if (I18n.hasKey(unlocalizedVariantTooltip))
Expand All @@ -98,11 +98,11 @@ public void addInformation(@Nonnull ItemStack stack, @Nullable World player, Lis
}

@Override
public int damageDropped(@Nonnull IBlockState state) {
public int damageDropped(@NotNull IBlockState state) {
return getMetaFromState(state);
}

@Nonnull
@NotNull
@Override
@SuppressWarnings("deprecation")
public IBlockState getStateFromMeta(int meta) {
Expand All @@ -115,7 +115,7 @@ public int getMetaFromState(IBlockState state) {
}

@Override
public void onEntityWalk(@Nonnull World worldIn, @Nonnull BlockPos pos, @Nonnull Entity entityIn) {
public void onEntityWalk(@NotNull World worldIn, @NotNull BlockPos pos, @NotNull Entity entityIn) {
// Short circuit if there is no bonus speed
if (getWalkingSpeedBonus() == 1.0D) {
return;
Expand Down
Loading

0 comments on commit 5901bc9

Please sign in to comment.