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
+2 -2
View File
@@ -11,8 +11,8 @@ import appeng.core.features.IAEFeature;
public class AEBaseItem extends Item implements IAEFeature
{
String featureFullName;
String featureSubName;
final String featureFullName;
final String featureSubName;
AEFeatureHandler feature;
@Override
@@ -23,8 +23,8 @@ import appeng.util.Platform;
public class PortableCellViewer extends MEMonitorHandler<IAEItemStack> implements IPortableCell
{
private ItemStack target;
private IAEItemPowerStorage ips;
private final ItemStack target;
private final IAEItemPowerStorage ips;
public PortableCellViewer(ItemStack is) {
super( CellInventory.getCell( is, null ) );
@@ -49,7 +49,7 @@ import com.google.common.collect.ImmutableSet;
public class ItemMultiMaterial extends AEBaseItem implements IStorageComponent, IUpgradeModule
{
HashMap<Integer, MaterialType> dmgToMaterial = new HashMap<Integer, MaterialType>();
final HashMap<Integer, MaterialType> dmgToMaterial = new HashMap<Integer, MaterialType>();
public static ItemMultiMaterial instance;
@@ -63,7 +63,7 @@ public class ItemMultiMaterial extends AEBaseItem implements IStorageComponent,
class SlightlyBetterSort implements Comparator<String>
{
Pattern p;
final Pattern p;
public SlightlyBetterSort(Pattern p) {
this.p = p;
@@ -66,7 +66,7 @@ public enum MaterialType
BlankPattern(52), CardCrafting(53);
private String oreName;
private EnumSet<AEFeature> features;
private final EnumSet<AEFeature> features;
private Class<? extends Entity> droppedEntity;
// IIcon for the material.
@@ -39,9 +39,9 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal
public static final int Fluix = SINGLE_OFFSET * 2;
public static final int END = SINGLE_OFFSET * 3;
IIcon certus[] = new IIcon[3];
IIcon fluix[] = new IIcon[3];
IIcon nether[] = new IIcon[3];
final IIcon[] certus = new IIcon[3];
final IIcon[] fluix = new IIcon[3];
final IIcon[] nether = new IIcon[3];
private int getProgress(ItemStack is)
{
@@ -114,7 +114,7 @@ public class ItemEncodedPattern extends AEBaseItem implements ICraftingPatternIt
}
// rather simple client side caching.
static WeakHashMap<ItemStack, ItemStack> simpleCache = new WeakHashMap<ItemStack, ItemStack>();
static final WeakHashMap<ItemStack, ItemStack> simpleCache = new WeakHashMap<ItemStack, ItemStack>();
public ItemStack getOutput(ItemStack item)
{
@@ -43,7 +43,7 @@ public class ItemMultiPart extends AEBaseItem implements IPartItem, IItemGroup
IIcon ico;
}
HashMap<Integer, PartTypeIst> dmgToPart = new HashMap<Integer, PartTypeIst>();
final HashMap<Integer, PartTypeIst> dmgToPart = new HashMap<Integer, PartTypeIst>();
public static ItemMultiPart instance;