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
@@ -17,8 +17,8 @@ public class AEItemDef
public int def;
private int itemID;
public Item item;
private final int itemID;
public final Item item;
public int damageValue;
public int displayDamage;
@@ -37,8 +37,8 @@ public class AEItemDef
public OreReference isOre;
static AESharedNBT lowTag = new AESharedNBT( Integer.MIN_VALUE );
static AESharedNBT highTag = new AESharedNBT( Integer.MAX_VALUE );
static final AESharedNBT lowTag = new AESharedNBT( Integer.MIN_VALUE );
static final AESharedNBT highTag = new AESharedNBT( Integer.MAX_VALUE );
public AEItemDef(Item it) {
item = it;
@@ -18,8 +18,9 @@ import appeng.util.Platform;
public class AESharedNBT extends NBTTagCompound implements IAETagCompound
{
private Item item;
private int meta, hash;
private final Item item;
private final int meta;
private int hash;
public SharedSearchObject sso;
private IItemComparison comp;
@@ -120,7 +121,7 @@ public class AESharedNBT extends NBTTagCompound implements IAETagCompound
/*
* Shared Tag Compound Cache.
*/
private static WeakHashMap<SharedSearchObject, WeakReference<SharedSearchObject>> sharedTagCompounds = new WeakHashMap<SharedSearchObject, WeakReference<SharedSearchObject>>();
private static final WeakHashMap<SharedSearchObject, WeakReference<SharedSearchObject>> sharedTagCompounds = new WeakHashMap<SharedSearchObject, WeakReference<SharedSearchObject>>();
/*
* Debug purposes.
@@ -11,7 +11,7 @@ import appeng.api.storage.data.IAEItemStack;
public class OreHelper
{
public static OreHelper instance = new OreHelper();
public static final OreHelper instance = new OreHelper();
class ItemRef
{
@@ -28,9 +28,9 @@ public class OreHelper
hash = ref.hashCode() ^ damage;
}
Item ref;
int damage;
int hash;
final Item ref;
final int damage;
final int hash;
@Override
public boolean equals(Object obj)
@@ -58,7 +58,7 @@ public class OreHelper
}
HashMap<ItemRef, OreResult> references = new HashMap<ItemRef, OreResult>();
final HashMap<ItemRef, OreResult> references = new HashMap<ItemRef, OreResult>();
public OreReference isOre(ItemStack ItemStack)
{
@@ -12,9 +12,9 @@ import appeng.api.storage.data.IAEItemStack;
public class OreReference
{
private LinkedList<ItemStack> otherOptions = new LinkedList<ItemStack>();
private final LinkedList<ItemStack> otherOptions = new LinkedList<ItemStack>();
private ArrayList<IAEItemStack> aeOtherOptions = null;
private HashSet<Integer> ores = new HashSet<Integer>();
private final HashSet<Integer> ores = new HashSet<Integer>();
public Collection<ItemStack> getEquivalents()
{
@@ -7,8 +7,8 @@ import appeng.util.Platform;
public class SharedSearchObject
{
int def;
int hash;
final int def;
final int hash;
NBTTagCompound compound;
public AESharedNBT shared;