[immutability-refactor] All these members are only assigned on constructors/declaration.

Avoid mutability as much as possible, it's the devil.
This commit is contained in:
gubatron 2016-01-14 17:14:51 -05:00
parent df6d93a4a1
commit ea1d75cc45
11 changed files with 17 additions and 17 deletions

View file

@ -40,8 +40,8 @@ public class AlertManager {
transient private static final Logger log = LoggerFactory.getLogger(AlertManager.class); transient private static final Logger log = LoggerFactory.getLogger(AlertManager.class);
private final AlertService alertService; private final AlertService alertService;
private KeyRing keyRing; private final KeyRing keyRing;
private User user; private final User user;
private final ObjectProperty<Alert> alertMessageProperty = new SimpleObjectProperty<>(); private final ObjectProperty<Alert> alertMessageProperty = new SimpleObjectProperty<>();
// Pub key for developer global alert message // Pub key for developer global alert message

View file

@ -33,7 +33,7 @@ import javax.inject.Inject;
*/ */
public class AlertService { public class AlertService {
private static final Logger log = LoggerFactory.getLogger(AlertService.class); private static final Logger log = LoggerFactory.getLogger(AlertService.class);
private P2PService p2PService; private final P2PService p2PService;
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////

View file

@ -37,7 +37,7 @@ import java.util.stream.Collectors;
public class ArbitratorService { public class ArbitratorService {
private static final Logger log = LoggerFactory.getLogger(ArbitratorService.class); private static final Logger log = LoggerFactory.getLogger(ArbitratorService.class);
private P2PService p2PService; private final P2PService p2PService;
interface ArbitratorMapResultHandler { interface ArbitratorMapResultHandler {
void handleResult(Map<String, Arbitrator> arbitratorsMap); void handleResult(Map<String, Arbitrator> arbitratorsMap);

View file

@ -56,7 +56,7 @@ public class AddressEntry implements Serializable {
// Only set if its a TRADE Context // Only set if its a TRADE Context
@Nullable @Nullable
private String offerId; private final String offerId;
private final Context context; private final Context context;
private final byte[] pubKey; private final byte[] pubKey;

View file

@ -27,7 +27,7 @@ import java.util.stream.Collectors;
public class CurrencyUtil { public class CurrencyUtil {
transient private static final Logger log = LoggerFactory.getLogger(CurrencyUtil.class); transient private static final Logger log = LoggerFactory.getLogger(CurrencyUtil.class);
private static List<TradeCurrency> allSortedCurrencies = createAllSortedCurrenciesList(); private static final List<TradeCurrency> allSortedCurrencies = createAllSortedCurrenciesList();
public static List<TradeCurrency> getAllSortedCurrencies() { public static List<TradeCurrency> getAllSortedCurrencies() {
return allSortedCurrencies; return allSortedCurrencies;

View file

@ -38,7 +38,7 @@ public class SepaAccountContractData extends PaymentAccountContractData implemen
private String iban; private String iban;
private String bic; private String bic;
// Dont use a set here as we need a deterministic ordering, otherwise the contract hash does not match // Dont use a set here as we need a deterministic ordering, otherwise the contract hash does not match
private ArrayList<String> acceptedCountryCodes; private final ArrayList<String> acceptedCountryCodes;
public SepaAccountContractData(String paymentMethod, String id, int maxTradePeriod) { public SepaAccountContractData(String paymentMethod, String id, int maxTradePeriod) {
super(paymentMethod, id, maxTradePeriod); super(paymentMethod, id, maxTradePeriod);

View file

@ -83,7 +83,7 @@ public class TradeManager {
private final Storage<TradableList<Trade>> tradableListStorage; private final Storage<TradableList<Trade>> tradableListStorage;
private final TradableList<Trade> trades; private final TradableList<Trade> trades;
private final BooleanProperty pendingTradesInitialized = new SimpleBooleanProperty(); private final BooleanProperty pendingTradesInitialized = new SimpleBooleanProperty();
private FirstPeerAuthenticatedListener firstPeerAuthenticatedListener; private final FirstPeerAuthenticatedListener firstPeerAuthenticatedListener;
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////

View file

@ -35,7 +35,7 @@ import java.util.stream.Collectors;
public class OfferBookService { public class OfferBookService {
private static final Logger log = LoggerFactory.getLogger(OfferBookService.class); private static final Logger log = LoggerFactory.getLogger(OfferBookService.class);
private P2PService p2PService; private final P2PService p2PService;
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////

View file

@ -58,8 +58,8 @@ public class OpenOfferManager {
private static final Logger log = LoggerFactory.getLogger(OpenOfferManager.class); private static final Logger log = LoggerFactory.getLogger(OpenOfferManager.class);
private final KeyRing keyRing; private final KeyRing keyRing;
private User user; private final User user;
private P2PService p2PService; private final P2PService p2PService;
private final WalletService walletService; private final WalletService walletService;
private final TradeWalletService tradeWalletService; private final TradeWalletService tradeWalletService;
private final OfferBookService offerBookService; private final OfferBookService offerBookService;

View file

@ -21,9 +21,9 @@ public class PopupId {
// We don't use an enum because it would break updates if we add a new item in a new version // We don't use an enum because it would break updates if we add a new item in a new version
public static String TRADE_WALLET = "tradeWallet"; public static final String TRADE_WALLET = "tradeWallet";
public static String SEND_PAYMENT_INFO = "sendPaymentInfo"; public static final String SEND_PAYMENT_INFO = "sendPaymentInfo";
public static String PAYMENT_SENT = "paymentSent"; public static final String PAYMENT_SENT = "paymentSent";
public static String PAYMENT_RECEIVED = "paymentReceived"; public static final String PAYMENT_RECEIVED = "paymentReceived";
} }

View file

@ -88,14 +88,14 @@ public class Preferences implements Serializable {
private boolean useAnimations = true; private boolean useAnimations = true;
private boolean useEffects = true; private boolean useEffects = true;
private boolean displaySecurityDepositInfo = true; private boolean displaySecurityDepositInfo = true;
private ArrayList<TradeCurrency> tradeCurrencies; private final ArrayList<TradeCurrency> tradeCurrencies;
private BlockChainExplorer blockChainExplorerMainNet; private BlockChainExplorer blockChainExplorerMainNet;
private BlockChainExplorer blockChainExplorerTestNet; private BlockChainExplorer blockChainExplorerTestNet;
private boolean showPlaceOfferConfirmation; private boolean showPlaceOfferConfirmation;
private boolean showTakeOfferConfirmation; private boolean showTakeOfferConfirmation;
private String backupDirectory; private String backupDirectory;
private boolean autoSelectArbitrators = true; private boolean autoSelectArbitrators = true;
private Map<String, Boolean> showAgainMap; private final Map<String, Boolean> showAgainMap;
private boolean tacAccepted; private boolean tacAccepted;
private Locale preferredLocale; private Locale preferredLocale;
private TradeCurrency preferredTradeCurrency; private TradeCurrency preferredTradeCurrency;