[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);
private final AlertService alertService;
private KeyRing keyRing;
private User user;
private final KeyRing keyRing;
private final User user;
private final ObjectProperty<Alert> alertMessageProperty = new SimpleObjectProperty<>();
// Pub key for developer global alert message

View File

@ -33,7 +33,7 @@ import javax.inject.Inject;
*/
public class AlertService {
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 {
private static final Logger log = LoggerFactory.getLogger(ArbitratorService.class);
private P2PService p2PService;
private final P2PService p2PService;
interface ArbitratorMapResultHandler {
void handleResult(Map<String, Arbitrator> arbitratorsMap);

View File

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

View File

@ -27,7 +27,7 @@ import java.util.stream.Collectors;
public class CurrencyUtil {
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() {
return allSortedCurrencies;

View File

@ -38,7 +38,7 @@ public class SepaAccountContractData extends PaymentAccountContractData implemen
private String iban;
private String bic;
// 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) {
super(paymentMethod, id, maxTradePeriod);

View File

@ -83,7 +83,7 @@ public class TradeManager {
private final Storage<TradableList<Trade>> tradableListStorage;
private final TradableList<Trade> trades;
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 {
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 final KeyRing keyRing;
private User user;
private P2PService p2PService;
private final User user;
private final P2PService p2PService;
private final WalletService walletService;
private final TradeWalletService tradeWalletService;
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
public static String TRADE_WALLET = "tradeWallet";
public static String SEND_PAYMENT_INFO = "sendPaymentInfo";
public static String PAYMENT_SENT = "paymentSent";
public static String PAYMENT_RECEIVED = "paymentReceived";
public static final String TRADE_WALLET = "tradeWallet";
public static final String SEND_PAYMENT_INFO = "sendPaymentInfo";
public static final String PAYMENT_SENT = "paymentSent";
public static final String PAYMENT_RECEIVED = "paymentReceived";
}

View File

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