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
+1 -1
View File
@@ -57,7 +57,7 @@ public class AEBasePart implements IPart, IGridProxyable, IActionHost, IUpgradea
protected ISimplifiedBundle renderCache = null;
protected AENetworkProxy proxy;
protected final AENetworkProxy proxy;
protected TileEntity tile = null;
protected IPartHost host = null;
protected ForgeDirection side = null;
@@ -53,7 +53,7 @@ import cpw.mods.fml.relauncher.SideOnly;
public class CableBusContainer extends CableBusStorage implements AEMultiTile, ICableBusContainer
{
private EnumSet<LayerFlags> myLayerFlags = EnumSet.noneOf( LayerFlags.class );
private final EnumSet<LayerFlags> myLayerFlags = EnumSet.noneOf( LayerFlags.class );
public YesNo hasRedstone = YesNo.UNDECIDED;
public IPartHost tcb;
@@ -45,7 +45,7 @@ import cpw.mods.fml.common.gameevent.TickEvent;
public class PartPlacement
{
private ThreadLocal<Object> placing = new ThreadLocal<Object>();
private final ThreadLocal<Object> placing = new ThreadLocal<Object>();
private boolean wasCanceled = false;
@SubscribeEvent
@@ -170,8 +170,8 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
}
boolean breaking = false;
LinkedList<IAEItemStack> Buffer = new LinkedList<IAEItemStack>();
BaseActionSource mySrc = new MachineSource( this );
final LinkedList<IAEItemStack> Buffer = new LinkedList<IAEItemStack>();
final BaseActionSource mySrc = new MachineSource( this );
@Override
public void writeToNBT(NBTTagCompound data)
@@ -66,8 +66,8 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
int priority = 0;
boolean wasActive = false;
boolean blocked = false;
MEInventoryHandler myHandler = new MEInventoryHandler( this, StorageChannel.ITEMS );
AppEngInternalAEInventory Config = new AppEngInternalAEInventory( this, 63 );
final MEInventoryHandler myHandler = new MEInventoryHandler( this, StorageChannel.ITEMS );
final AppEngInternalAEInventory Config = new AppEngInternalAEInventory( this, 63 );
public PartFormationPlane(ItemStack is) {
super( PartFormationPlane.class, is );
@@ -37,7 +37,7 @@ import cpw.mods.fml.relauncher.SideOnly;
public class PartImportBus extends PartSharedItemBus implements IGridTickable, IInventoryDestination
{
BaseActionSource mySrc;
final BaseActionSource mySrc;
IMEInventory<IAEItemStack> destination = null;
IAEItemStack lastItemChecked = null;
@@ -63,7 +63,7 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
final int FLAG_ON = 4;
AppEngInternalAEInventory config = new AppEngInternalAEInventory( this, 1 );
final AppEngInternalAEInventory config = new AppEngInternalAEInventory( this, 1 );
boolean prevState = false;
@@ -58,7 +58,7 @@ public abstract class PartSharedItemBus extends PartUpgradeable implements IGrid
config.readFromNBT( extra, "config" );
}
AppEngInternalAEInventory config = new AppEngInternalAEInventory( this, 9 );
final AppEngInternalAEInventory config = new AppEngInternalAEInventory( this, 9 );
int adaptorHash = 0;
InventoryAdaptor adaptor;
@@ -17,8 +17,8 @@ import appeng.util.IConfigManagerHost;
public class PartUpgradeable extends PartBasicState implements ISegmentedInventory, IAEAppEngInventory, IConfigManagerHost
{
IConfigManager settings = new ConfigManager( this );
private UpgradeInventory upgrades = new UpgradeInventory( is, this, getUpgradeSlots() );
final IConfigManager settings = new ConfigManager( this );
private final UpgradeInventory upgrades = new UpgradeInventory( is, this, getUpgradeSlots() );
@Override
public int getInstalledUpgrades(Upgrades u)
@@ -56,7 +56,7 @@ public class PartInterface extends PartBasicState implements IGridTickable, ISeg
ISidedInventory, IAEAppEngInventory, ITileStorageMonitorable, IPriorityHost
{
DualityInterface duality = new DualityInterface( proxy, this );
final DualityInterface duality = new DualityInterface( proxy, this );
public PartInterface(ItemStack is) {
super( PartInterface.class, is );
@@ -71,9 +71,9 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
{
int priority = 0;
BaseActionSource mySrc;
final BaseActionSource mySrc;
AppEngInternalAEInventory Config = new AppEngInternalAEInventory( this, 63 );
final AppEngInternalAEInventory Config = new AppEngInternalAEInventory( this, 63 );
public PartStorageBus(ItemStack is)
{
@@ -32,7 +32,7 @@ import cpw.mods.fml.relauncher.SideOnly;
public class PartToggleBus extends PartBasicState
{
AENetworkProxy outerProxy = new AENetworkProxy( this, "outer", null, true );
final AENetworkProxy outerProxy = new AENetworkProxy( this, "outer", null, true );
IGridConnection connection;
protected final int REDSTONE_FLAG = 4;
@@ -46,7 +46,7 @@ import cpw.mods.fml.relauncher.SideOnly;
public class PartCable extends AEBasePart implements IPartCable
{
int channelsOnSide[] = new int[] { 0, 0, 0, 0, 0, 0 };
final int[] channelsOnSide = new int[] { 0, 0, 0, 0, 0, 0 };
EnumSet<ForgeDirection> connections = EnumSet.noneOf( ForgeDirection.class );
boolean powered = false;
@@ -31,7 +31,7 @@ import cpw.mods.fml.relauncher.SideOnly;
public class PartQuartzFiber extends AEBasePart implements IEnergyGridProvider
{
AENetworkProxy outerProxy = new AENetworkProxy( this, "outer", proxy.getMachineRepresentation(), true );
final AENetworkProxy outerProxy = new AENetworkProxy( this, "outer", proxy.getMachineRepresentation(), true );
public PartQuartzFiber(ItemStack is) {
super( PartQuartzFiber.class, is );
@@ -57,7 +57,7 @@ public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements IPipeCo
boolean requested;
IInventory cachedInv;
LinkedList<IInventory> which = new LinkedList<IInventory>();
final LinkedList<IInventory> which = new LinkedList<IInventory>();
IInventory getOutputInv()
{
@@ -37,7 +37,7 @@ public class PartP2PTunnel<T extends PartP2PTunnel> extends PartBasicState
public boolean output;
public long freq;
TunnelCollection type = new TunnelCollection<T>( null, getClass() );
final TunnelCollection type = new TunnelCollection<T>( null, getClass() );
public PartP2PTunnel(ItemStack is) {
super( PartP2PTunnel.class, is );
@@ -36,8 +36,8 @@ public class PartP2PTunnelME extends PartP2PTunnel<PartP2PTunnelME> implements I
return TunnelType.ME;
}
AENetworkProxy outerProxy = new AENetworkProxy( this, "outer", null, true );
public Connections connection = new Connections( this );
final AENetworkProxy outerProxy = new AENetworkProxy( this, "outer", null, true );
public final Connections connection = new Connections( this );
public PartP2PTunnelME(ItemStack is) {
super( is );
@@ -15,7 +15,7 @@ import appeng.tile.inventory.InvOperation;
public class PartCraftingTerminal extends PartTerminal implements IAEAppEngInventory
{
AppEngInternalInventory craftingGrid = new AppEngInternalInventory( this, 9 );
final AppEngInternalInventory craftingGrid = new AppEngInternalInventory( this, 9 );
@Override
public void writeToNBT(NBTTagCompound data)
@@ -18,9 +18,9 @@ import appeng.tile.inventory.InvOperation;
public class PartPatternTerminal extends PartTerminal implements IAEAppEngInventory
{
AppEngInternalInventory crafting = new AppEngInternalInventory( this, 9 );
AppEngInternalInventory output = new AppEngInternalInventory( this, 3 );
AppEngInternalInventory pattern = new AppEngInternalInventory( this, 2 );
final AppEngInternalInventory crafting = new AppEngInternalInventory( this, 9 );
final AppEngInternalInventory output = new AppEngInternalInventory( this, 3 );
final AppEngInternalInventory pattern = new AppEngInternalInventory( this, 2 );
private boolean craftingMode = true;
@@ -28,8 +28,8 @@ import appeng.util.Platform;
public class PartTerminal extends PartMonitor implements ITerminalHost, IConfigManagerHost, IViewCellStorage, IAEAppEngInventory
{
IConfigManager cm = new ConfigManager( this );
AppEngInternalInventory viewCell = new AppEngInternalInventory( this, 5 );
final IConfigManager cm = new ConfigManager( this );
final AppEngInternalInventory viewCell = new AppEngInternalInventory( this, 5 );
public PartTerminal(Class clz, ItemStack is) {
super( clz, is, true );