Make fields final if possible to ensure immutability

This commit is contained in:
thatsIch
2014-09-29 09:54:34 +02:00
parent 35f6c84d9f
commit 474596f095
261 changed files with 607 additions and 597 deletions
@@ -24,7 +24,7 @@ public class AEFeatureHandler implements AEItemDefinition
private final EnumSet<AEFeature> features;
private final String subName;
private IAEFeature feature;
private final IAEFeature feature;
private Item ItemData;
private Block BlockData;
@@ -10,7 +10,7 @@ import appeng.api.util.AEColoredItemDefinition;
public class ColoredItemDefinition implements AEColoredItemDefinition
{
ItemStackSrc colors[] = new ItemStackSrc[17];
final ItemStackSrc[] colors = new ItemStackSrc[17];
@Override
public Item item(AEColor color)
@@ -7,7 +7,7 @@ import appeng.items.materials.MaterialType;
public class MaterialStackSrc implements IStackSrc
{
MaterialType src;
final MaterialType src;
public MaterialStackSrc(MaterialType src) {
this.src = src;
@@ -13,7 +13,7 @@ import appeng.api.storage.StorageChannel;
public class CellRegistry implements ICellRegistry
{
List<ICellHandler> handlers;
final List<ICellHandler> handlers;
public CellRegistry() {
handlers = new ArrayList<ICellHandler>();
@@ -14,7 +14,7 @@ import appeng.core.features.registries.entries.ExternalIInv;
public class ExternalStorageRegistry implements IExternalStorageRegistry
{
List<IExternalStorageHandler> Handlers;
final List<IExternalStorageHandler> Handlers;
final ExternalIInv lastHandler = new ExternalIInv();
public ExternalStorageRegistry() {
@@ -21,7 +21,7 @@ import appeng.util.Platform;
public class GrinderRecipeManager implements IGrinderRegistry, IOreListener
{
public List<IGrinderEntry> RecipeList;
public final List<IGrinderEntry> RecipeList;
private ItemStack copy(ItemStack is)
{
@@ -149,9 +149,9 @@ public class GrinderRecipeManager implements IGrinderRegistry, IOreListener
return 2;
}
public Map<ItemStack, String> Ores = new HashMap<ItemStack, String>();
public Map<ItemStack, String> Ingots = new HashMap<ItemStack, String>();
public Map<String, ItemStack> Dusts = new HashMap<String, ItemStack>();
public final Map<ItemStack, String> Ores = new HashMap<ItemStack, String>();
public final Map<ItemStack, String> Ingots = new HashMap<ItemStack, String>();
public final Map<String, ItemStack> Dusts = new HashMap<String, ItemStack>();
private void addOre(String name, ItemStack item)
{
@@ -13,7 +13,7 @@ import cpw.mods.fml.common.eventhandler.SubscribeEvent;
public class LocatableRegistry implements ILocatableRegistry
{
private HashMap<Long, ILocatable> set;
private final HashMap<Long, ILocatable> set;
@SubscribeEvent
public void updateLocatable(LocatableEventAnnounce e)
@@ -12,7 +12,7 @@ import appeng.util.Platform;
public class MatterCannonAmmoRegistry implements IOreListener, IMatterCannonAmmoRegistry
{
private HashMap<ItemStack, Double> DamageModifiers = new HashMap<ItemStack, Double>();
private final HashMap<ItemStack, Double> DamageModifiers = new HashMap<ItemStack, Double>();
@Override
public void registerAmmo(ItemStack ammo, double weight)
@@ -15,14 +15,14 @@ import appeng.spatial.DefaultSpatialHandler;
public class MovableTileRegistry implements IMovableRegistry
{
private HashSet<Block> blacklisted = new HashSet<Block>();
private final HashSet<Block> blacklisted = new HashSet<Block>();
private HashMap<Class<? extends TileEntity>, IMovableHandler> Valid = new HashMap<Class<? extends TileEntity>, IMovableHandler>();
private LinkedList<Class<? extends TileEntity>> test = new LinkedList<Class<? extends TileEntity>>();
private LinkedList<IMovableHandler> handlers = new LinkedList<IMovableHandler>();
private DefaultSpatialHandler dsh = new DefaultSpatialHandler();
private final HashMap<Class<? extends TileEntity>, IMovableHandler> Valid = new HashMap<Class<? extends TileEntity>, IMovableHandler>();
private final LinkedList<Class<? extends TileEntity>> test = new LinkedList<Class<? extends TileEntity>>();
private final LinkedList<IMovableHandler> handlers = new LinkedList<IMovableHandler>();
private final DefaultSpatialHandler dsh = new DefaultSpatialHandler();
private IMovableHandler nullHandler = new DefaultSpatialHandler();
private final IMovableHandler nullHandler = new DefaultSpatialHandler();
private IMovableHandler testClass(Class myClass, TileEntity te)
{
@@ -18,7 +18,7 @@ import cpw.mods.fml.common.registry.GameRegistry;
public class P2PTunnelRegistry implements IP2PTunnelRegistry
{
HashMap<ItemStack, TunnelType> Tunnels = new HashMap<ItemStack, TunnelType>();
final HashMap<ItemStack, TunnelType> Tunnels = new HashMap<ItemStack, TunnelType>();
public ItemStack getModItem(String modID, String Name, int meta)
{
@@ -13,8 +13,8 @@ import appeng.recipes.RecipeHandler;
public class RecipeHandlerRegistry implements IRecipeHandlerRegistry
{
HashMap<String, Class<? extends ICraftHandler>> handlers = new HashMap<String, Class<? extends ICraftHandler>>();
LinkedList<ISubItemResolver> resolvers = new LinkedList<ISubItemResolver>();
final HashMap<String, Class<? extends ICraftHandler>> handlers = new HashMap<String, Class<? extends ICraftHandler>>();
final LinkedList<ISubItemResolver> resolvers = new LinkedList<ISubItemResolver>();
@Override
public void addNewCraftHandler(String name, Class<? extends ICraftHandler> handler)
@@ -18,18 +18,18 @@ import appeng.api.storage.IExternalStorageRegistry;
public class RegistryContainer implements IRegistryContainer
{
private GrinderRecipeManager GrinderRecipes = new GrinderRecipeManager();
private ExternalStorageRegistry ExternalStorageHandlers = new ExternalStorageRegistry();
private CellRegistry CellRegistry = new CellRegistry();
private LocatableRegistry LocatableRegistry = new LocatableRegistry();
private SpecialComparisonRegistry SpecialComparisonRegistry = new SpecialComparisonRegistry();
private WirelessRegistry WirelessRegistry = new WirelessRegistry();
private GridCacheRegistry GridCacheRegistry = new GridCacheRegistry();
private P2PTunnelRegistry P2PRegistry = new P2PTunnelRegistry();
private MovableTileRegistry MovableReg = new MovableTileRegistry();
private MatterCannonAmmoRegistry matterCannonReg = new MatterCannonAmmoRegistry();
private PlayerRegistry playerRegistry = new PlayerRegistry();
private IRecipeHandlerRegistry recipeReg = new RecipeHandlerRegistry();
private final GrinderRecipeManager GrinderRecipes = new GrinderRecipeManager();
private final ExternalStorageRegistry ExternalStorageHandlers = new ExternalStorageRegistry();
private final CellRegistry CellRegistry = new CellRegistry();
private final LocatableRegistry LocatableRegistry = new LocatableRegistry();
private final SpecialComparisonRegistry SpecialComparisonRegistry = new SpecialComparisonRegistry();
private final WirelessRegistry WirelessRegistry = new WirelessRegistry();
private final GridCacheRegistry GridCacheRegistry = new GridCacheRegistry();
private final P2PTunnelRegistry P2PRegistry = new P2PTunnelRegistry();
private final MovableTileRegistry MovableReg = new MovableTileRegistry();
private final MatterCannonAmmoRegistry matterCannonReg = new MatterCannonAmmoRegistry();
private final PlayerRegistry playerRegistry = new PlayerRegistry();
private final IRecipeHandlerRegistry recipeReg = new RecipeHandlerRegistry();
@Override
public IWirelessTermRegistry wireless()
@@ -11,7 +11,7 @@ import appeng.api.features.ISpecialComparisonRegistry;
public class SpecialComparisonRegistry implements ISpecialComparisonRegistry
{
private List<IItemComparisonProvider> CompRegistry;
private final List<IItemComparisonProvider> CompRegistry;
public SpecialComparisonRegistry() {
CompRegistry = new ArrayList<IItemComparisonProvider>();
@@ -16,7 +16,7 @@ import appeng.util.Platform;
public class WirelessRegistry implements IWirelessTermRegistry
{
List<IWirelessTermHandler> handlers;
final List<IWirelessTermHandler> handlers;
public WirelessRegistry() {
handlers = new ArrayList<IWirelessTermHandler>();
@@ -12,12 +12,12 @@ public class WorldGenRegistry implements IWorldGen
private class TypeSet
{
HashSet<Class<? extends WorldProvider>> badProviders = new HashSet<Class<? extends WorldProvider>>();
HashSet<Integer> badDimensions = new HashSet<Integer>();
final HashSet<Class<? extends WorldProvider>> badProviders = new HashSet<Class<? extends WorldProvider>>();
final HashSet<Integer> badDimensions = new HashSet<Integer>();
}
TypeSet[] types;
final TypeSet[] types;
static final public WorldGenRegistry instance = new WorldGenRegistry();