removed most SuppressWarning annotations, added comments

This commit is contained in:
Manfred Karrer 2014-08-26 18:31:35 +02:00
parent 627b49c7c1
commit fd62cbe9ef
23 changed files with 12 additions and 44 deletions

View file

@ -61,7 +61,6 @@ public class AddressBasedCoinSelector extends DefaultCoinSelector {
this.includePending = includePending; this.includePending = includePending;
} }
@SuppressWarnings("WeakerAccess")
@VisibleForTesting @VisibleForTesting
static void sortOutputs(ArrayList<TransactionOutput> outputs) { static void sortOutputs(ArrayList<TransactionOutput> outputs) {
Collections.sort(outputs, new Comparator<TransactionOutput>() { Collections.sort(outputs, new Comparator<TransactionOutput>() {
@ -122,7 +121,6 @@ public class AddressBasedCoinSelector extends DefaultCoinSelector {
} }
} }
@SuppressWarnings("WeakerAccess")
protected boolean matchesRequiredAddress(TransactionOutput transactionOutput) { protected boolean matchesRequiredAddress(TransactionOutput transactionOutput) {
if (transactionOutput.getScriptPubKey().isSentToAddress() || transactionOutput.getScriptPubKey().isSentToP2SH if (transactionOutput.getScriptPubKey().isSentToAddress() || transactionOutput.getScriptPubKey().isSentToP2SH
()) { ()) {

View file

@ -24,7 +24,6 @@ import javax.inject.Inject;
/** /**
* A facade delivers blockchain functionality from the BitcoinJ library. * A facade delivers blockchain functionality from the BitcoinJ library.
*/ */
@SuppressWarnings({"SameReturnValue", "UnusedParameters"})
public class BlockChainFacade { public class BlockChainFacade {
@Inject @Inject
public BlockChainFacade() { public BlockChainFacade() {

View file

@ -257,7 +257,6 @@ public class WalletFacade {
// Listener // Listener
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
@SuppressWarnings("UnusedReturnValue")
public DownloadListener addDownloadListener(DownloadListener listener) { public DownloadListener addDownloadListener(DownloadListener listener) {
downloadListeners.add(listener); downloadListeners.add(listener);
return listener; return listener;
@ -574,7 +573,6 @@ public class WalletFacade {
// Withdrawal // Withdrawal
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
@SuppressWarnings("UnusedReturnValue")
public String sendFunds(String withdrawFromAddress, public String sendFunds(String withdrawFromAddress,
String withdrawToAddress, String withdrawToAddress,
String changeAddress, String changeAddress,

View file

@ -53,8 +53,9 @@ import net.tomp2p.storage.Data;
* TODO remove tomp2p dependencies * TODO remove tomp2p dependencies
* import net.tomp2p.peers.Number160; * import net.tomp2p.peers.Number160;
* import net.tomp2p.storage.Data; * import net.tomp2p.storage.Data;
*
* Arbitration is not much developed yet
*/ */
@SuppressWarnings({"ALL", "UnusedParameters"})
public class ArbitratorOverviewController extends CachedViewController implements ArbitratorListener { public class ArbitratorOverviewController extends CachedViewController implements ArbitratorListener {
private final Settings settings; private final Settings settings;
private final Persistence persistence; private final Persistence persistence;

View file

@ -34,6 +34,7 @@ import javax.inject.Inject;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.scene.control.*; import javafx.scene.control.*;
// Arbitration is not much developed yet
public class ArbitratorProfileController extends CachedViewController { public class ArbitratorProfileController extends CachedViewController {
private final Settings settings; private final Settings settings;

View file

@ -65,7 +65,7 @@ import de.jensd.fx.fontawesome.AwesomeIcon;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@SuppressWarnings({"ALL", "EmptyMethod", "UnusedParameters"}) // Arbitration is not much developed yet
public class ArbitratorRegistrationController extends CachedViewController { public class ArbitratorRegistrationController extends CachedViewController {
private static final Logger log = LoggerFactory.getLogger(ArbitratorRegistrationController.class); private static final Logger log = LoggerFactory.getLogger(ArbitratorRegistrationController.class);
@ -233,7 +233,7 @@ public class ArbitratorRegistrationController extends CachedViewController {
// Public Methods // Public Methods
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
public void setEditMode(@SuppressWarnings("SameParameterValue") boolean isEditMode) { public void setEditMode(boolean isEditMode) {
this.isEditMode = isEditMode; this.isEditMode = isEditMode;
if (isEditMode) { if (isEditMode) {

View file

@ -20,12 +20,11 @@ package io.bitsquare.gui.components;
import javafx.scene.layout.*; import javafx.scene.layout.*;
@SuppressWarnings("WeakerAccess")
public class HSpacer extends Pane { public class HSpacer extends Pane {
public HSpacer() { public HSpacer() {
} }
public HSpacer(@SuppressWarnings("SameParameterValue") double width) { public HSpacer(double width) {
setPrefWidth(width); setPrefWidth(width);
} }

View file

@ -32,7 +32,6 @@ import org.controlsfx.control.action.Action;
import org.controlsfx.dialog.Dialog; import org.controlsfx.dialog.Dialog;
import org.controlsfx.dialog.Dialogs; import org.controlsfx.dialog.Dialogs;
@SuppressWarnings({"SameParameterValue", "WeakerAccess"})
public class Popups { public class Popups {
// Information // Information
@ -126,7 +125,6 @@ public class Popups {
} }
// Support handling of uncaught exception from any thread (also non gui thread) // Support handling of uncaught exception from any thread (also non gui thread)
@SuppressWarnings("ThrowableResultOfMethodCallIgnored")
public static void handleUncaughtExceptions(Throwable throwable) { public static void handleUncaughtExceptions(Throwable throwable) {
// while dev // while dev
throwable.printStackTrace(); throwable.printStackTrace();

View file

@ -24,7 +24,6 @@ public class VSpacer extends Pane {
public VSpacer() { public VSpacer() {
} }
@SuppressWarnings("SameParameterValue")
public VSpacer(double height) { public VSpacer(double height) {
setPrefHeight(height); setPrefHeight(height);
} }

View file

@ -107,7 +107,6 @@ class ProcessStepBarSkin<T> extends BehaviorSkinBase<ProcessStepBar<T>, Behavior
} }
@SuppressWarnings("EmptyMethod")
public static class LabelWithBorder extends Label { public static class LabelWithBorder extends Label {
final double borderWidth = 1; final double borderWidth = 1;
private final double arrowWidth = 10; private final double arrowWidth = 10;

View file

@ -34,8 +34,7 @@ public class ProcessStepItem {
this(label, color, false); this(label, color, false);
} }
private ProcessStepItem(String label, Paint color, private ProcessStepItem(String label, Paint color, boolean hasProgressIndicator) {
@SuppressWarnings("SameParameterValue") boolean hasProgressIndicator) {
this.label = label; this.label = label;
this.color = color; this.color = color;
this.progressIndicator = hasProgressIndicator; this.progressIndicator = hasProgressIndicator;

View file

@ -43,7 +43,6 @@ import javafx.util.Callback;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@SuppressWarnings("EmptyMethod")
public class OfferController extends CachedViewController { public class OfferController extends CachedViewController {
private static final Logger log = LoggerFactory.getLogger(OfferController.class); private static final Logger log = LoggerFactory.getLogger(OfferController.class);
private final TradeManager tradeManager; private final TradeManager tradeManager;

View file

@ -115,7 +115,6 @@ public class BitSquareValidator {
} }
//TODO //TODO
@SuppressWarnings("UnusedParameters")
public static void textFieldBankAccountPrimaryIDIsValid(TextField textField, BankAccountType bankAccountType) public static void textFieldBankAccountPrimaryIDIsValid(TextField textField, BankAccountType bankAccountType)
throws ValidationException { throws ValidationException {
if (!validateStringNotEmpty(textField.getText())) { if (!validateStringNotEmpty(textField.getText())) {
@ -126,7 +125,6 @@ public class BitSquareValidator {
} }
//TODO //TODO
@SuppressWarnings("UnusedParameters")
public static void textFieldBankAccountSecondaryIDIsValid(TextField textField, public static void textFieldBankAccountSecondaryIDIsValid(TextField textField,
BankAccountType bankAccountType) throws BankAccountType bankAccountType) throws
ValidationException { ValidationException {

View file

@ -35,7 +35,6 @@ import javafx.scene.control.*;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@SuppressWarnings("CanBeFinal")
public class ConfidenceDisplay { public class ConfidenceDisplay {
private static final Logger log = LoggerFactory.getLogger(ConfidenceDisplay.class); private static final Logger log = LoggerFactory.getLogger(ConfidenceDisplay.class);

View file

@ -33,7 +33,6 @@ import org.slf4j.LoggerFactory;
import static com.google.common.base.Preconditions.checkState; import static com.google.common.base.Preconditions.checkState;
@SuppressWarnings("WeakerAccess")
public class Transitions { public class Transitions {
private static final Logger log = LoggerFactory.getLogger(Transitions.class); private static final Logger log = LoggerFactory.getLogger(Transitions.class);
@ -43,7 +42,6 @@ public class Transitions {
fadeIn(node, UI_ANIMATION_TIME); fadeIn(node, UI_ANIMATION_TIME);
} }
@SuppressWarnings("SameParameterValue")
public static void fadeIn(Node node, int duration) { public static void fadeIn(Node node, int duration) {
FadeTransition ft = new FadeTransition(Duration.millis(duration), node); FadeTransition ft = new FadeTransition(Duration.millis(duration), node);
ft.setFromValue(0.0); ft.setFromValue(0.0);
@ -63,7 +61,6 @@ public class Transitions {
return ft; return ft;
} }
@SuppressWarnings("UnusedReturnValue")
public static Animation fadeOutAndRemove(Node node) { public static Animation fadeOutAndRemove(Node node) {
return fadeOutAndRemove(node, UI_ANIMATION_TIME); return fadeOutAndRemove(node, UI_ANIMATION_TIME);
} }
@ -94,7 +91,6 @@ public class Transitions {
blurOut(node, UI_ANIMATION_TIME); blurOut(node, UI_ANIMATION_TIME);
} }
@SuppressWarnings("SameParameterValue")
public static Timeline blurOut(Node node, int duration) { public static Timeline blurOut(Node node, int duration) {
GaussianBlur blur = new GaussianBlur(0.0); GaussianBlur blur = new GaussianBlur(0.0);
node.setEffect(blur); node.setEffect(blur);

View file

@ -35,6 +35,7 @@ public class CountryUtil {
"MY", "NI", "NL", "NO", "NZ", "OM", "PA", "PE", "PH", "PL", "PR", "PT", "PY", "QA", "RO", "RS", "RU", "MY", "NI", "NL", "NO", "NZ", "OM", "PA", "PE", "PH", "PL", "PR", "PT", "PY", "QA", "RO", "RS", "RU",
"SA", "SD", "SE", "SG", "SI", "SK", "SV", "SY", "TH", "TN", "TR", "TW", "UA", "US", "UY", "VE", "VN", "SA", "SD", "SE", "SG", "SI", "SK", "SV", "SY", "TH", "TN", "TR", "TW", "UA", "US", "UY", "VE", "VN",
"YE", "ZA"}; "YE", "ZA"};
private static final List<String> countryCodeList = Arrays.asList(countryCodes); private static final List<String> countryCodeList = Arrays.asList(countryCodes);
private static final String[] regionCodes = new String[]{"AS", "EU", "SA", "EU", "OC", "EU", "EU", "EU", "AS", private static final String[] regionCodes = new String[]{"AS", "EU", "SA", "EU", "OC", "EU", "EU", "EU", "AS",
"SA", "SA", "EU", "NA", "EU", "SA", "AS", "SA", "NA", "EU", "NA", "AS", "EU", "EU", "EU", "NA", "AF", "SA", "SA", "EU", "NA", "EU", "SA", "AS", "SA", "NA", "EU", "NA", "AS", "EU", "EU", "EU", "NA", "AF",
@ -48,7 +49,6 @@ public class CountryUtil {
{"NA", "North America"}, {"SA", "South America"}, {"AF", "Africa"}, {"EU", "Europe"}, {"AS", "Asia"}, {"NA", "North America"}, {"SA", "South America"}, {"AF", "Africa"}, {"EU", "Europe"}, {"AS", "Asia"},
{"OC", "Oceania"}}; {"OC", "Oceania"}};
public static List<Region> getAllRegions() { public static List<Region> getAllRegions() {
final List<Region> allRegions = new ArrayList<>(); final List<Region> allRegions = new ArrayList<>();
@ -84,7 +84,6 @@ public class CountryUtil {
selectedRegion != null && country != null && selectedRegion.equals(country.getRegion()))); selectedRegion != null && country != null && selectedRegion.equals(country.getRegion())));
} }
private static List<Country> getAllCountries() { private static List<Country> getAllCountries() {
final List<Country> allCountries = new ArrayList<>(); final List<Country> allCountries = new ArrayList<>();
for (final Locale locale : getAllCountryLocales()) { for (final Locale locale : getAllCountryLocales()) {
@ -96,7 +95,6 @@ public class CountryUtil {
return allCountries; return allCountries;
} }
public static Country getDefaultCountry() { public static Country getDefaultCountry() {
final Locale locale = new Locale("", Locale.getDefault().getCountry()); final Locale locale = new Locale("", Locale.getDefault().getCountry());
String regionCode = getRegionCode(locale.getCountry()); String regionCode = getRegionCode(locale.getCountry());
@ -104,7 +102,6 @@ public class CountryUtil {
return new Country(locale.getCountry(), locale.getDisplayCountry(), region); return new Country(locale.getCountry(), locale.getDisplayCountry(), region);
} }
private static String getRegionName(final String regionCode) { private static String getRegionName(final String regionCode) {
for (final String[] regionName : regionCodeToName) { for (final String[] regionName : regionCodeToName) {
if (regionName[0].equals(regionCode)) { if (regionName[0].equals(regionCode)) {
@ -114,7 +111,6 @@ public class CountryUtil {
return regionCode; return regionCode;
} }
private static List<Locale> getAllCountryLocales() { private static List<Locale> getAllCountryLocales() {
List<Locale> allLocales = Arrays.asList(Locale.getAvailableLocales()); List<Locale> allLocales = Arrays.asList(Locale.getAvailableLocales());
Set<Locale> allLocalesAsSet = Set<Locale> allLocalesAsSet =
@ -127,7 +123,6 @@ public class CountryUtil {
return allLocales; return allLocales;
} }
private static String getRegionCode(String countryCode) { private static String getRegionCode(String countryCode) {
if (!countryCode.isEmpty() && countryCodeList.contains(countryCode)) { if (!countryCode.isEmpty() && countryCodeList.contains(countryCode)) {
return regionCodeList.get(countryCodeList.indexOf(countryCode)); return regionCodeList.get(countryCodeList.indexOf(countryCode));

View file

@ -56,7 +56,6 @@ public class CurrencyUtil {
return resultList; return resultList;
} }
public static Currency getDefaultCurrency() { public static Currency getDefaultCurrency() {
return NumberFormat.getNumberInstance(Locale.getDefault()).getCurrency(); return NumberFormat.getNumberInstance(Locale.getDefault()).getCurrency();
} }

View file

@ -37,12 +37,10 @@ import org.slf4j.LoggerFactory;
public class Localisation { public class Localisation {
private static final Logger log = LoggerFactory.getLogger(Localisation.class); private static final Logger log = LoggerFactory.getLogger(Localisation.class);
public static ResourceBundle getResourceBundle() { public static ResourceBundle getResourceBundle() {
return ResourceBundle.getBundle("i18n.displayStrings", new UTF8Control()); return ResourceBundle.getBundle("i18n.displayStrings", new UTF8Control());
} }
public static String get(String key) { public static String get(String key) {
if (key == null) if (key == null)
return ""; return "";
@ -55,12 +53,12 @@ public class Localisation {
} }
} }
public static String get(String key, String... arguments) { public static String get(String key, String... arguments) {
return MessageFormat.format(Localisation.get(key), arguments); return MessageFormat.format(Localisation.get(key), arguments);
} }
} }
// Adds UTF8 support for property files
class UTF8Control extends ResourceBundle.Control { class UTF8Control extends ResourceBundle.Control {
public ResourceBundle newBundle(String baseName, Locale locale, String format, ClassLoader loader, boolean reload) public ResourceBundle newBundle(String baseName, Locale locale, String format, ClassLoader loader, boolean reload)

View file

@ -22,7 +22,7 @@ import java.util.Map;
import net.tomp2p.peers.Number640; import net.tomp2p.peers.Number640;
import net.tomp2p.storage.Data; import net.tomp2p.storage.Data;
@SuppressWarnings({"EmptyMethod", "UnusedParameters"}) // Arbitration is not much developed yet
public interface ArbitratorListener { public interface ArbitratorListener {
void onArbitratorAdded(Data offerData, boolean success); void onArbitratorAdded(Data offerData, boolean success);

View file

@ -23,7 +23,6 @@ import net.tomp2p.peers.Number640;
import net.tomp2p.storage.Data; import net.tomp2p.storage.Data;
public interface OrderBookListener { public interface OrderBookListener {
@SuppressWarnings("UnusedParameters")
void onOfferAdded(Data offerData, boolean success); void onOfferAdded(Data offerData, boolean success);
void onOffersReceived(Map<Number640, Data> dataMap, boolean success); void onOffersReceived(Map<Number640, Data> dataMap, boolean success);

View file

@ -27,7 +27,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
//TODO not used but let it for reference until all use cases are impl. //TODO not used but let it for reference until all use cases are impl.
@SuppressWarnings({"WeakerAccess", "EmptyMethod"})
public class PaymentProcess { public class PaymentProcess {
private static final Logger log = LoggerFactory.getLogger(PaymentProcess.class); private static final Logger log = LoggerFactory.getLogger(PaymentProcess.class);
protected String offererDepositPubKey; protected String offererDepositPubKey;

View file

@ -104,7 +104,7 @@ public class Arbitrator implements Serializable {
id = name; id = name;
} }
@SuppressWarnings("NonFinalFieldReferencedInHashCode") @Override
public int hashCode() { public int hashCode() {
if (id != null) { if (id != null) {
return Objects.hashCode(id); return Objects.hashCode(id);
@ -114,7 +114,7 @@ public class Arbitrator implements Serializable {
} }
} }
@SuppressWarnings("NonFinalFieldReferenceInEquals") @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (!(obj instanceof Arbitrator)) { if (!(obj instanceof Arbitrator)) {
return false; return false;

View file

@ -95,7 +95,6 @@ public class Utilities {
return result; return result;
} }
@SuppressWarnings("SameParameterValue")
private static void printElapsedTime(String msg) { private static void printElapsedTime(String msg) {
if (!msg.isEmpty()) { if (!msg.isEmpty()) {
msg += " / "; msg += " / ";
@ -135,8 +134,6 @@ public class Utilities {
return obj; return obj;
} }
@SuppressWarnings("SameParameterValue")
public static AnimationTimer setTimeout(int delay, Function<AnimationTimer, Void> callback) { public static AnimationTimer setTimeout(int delay, Function<AnimationTimer, Void> callback) {
AnimationTimer animationTimer = new AnimationTimer() { AnimationTimer animationTimer = new AnimationTimer() {
final long lastTimeStamp = System.currentTimeMillis(); final long lastTimeStamp = System.currentTimeMillis();
@ -153,8 +150,6 @@ public class Utilities {
return animationTimer; return animationTimer;
} }
@SuppressWarnings("SameParameterValue")
public static AnimationTimer setInterval(int delay, Function<AnimationTimer, Void> callback) { public static AnimationTimer setInterval(int delay, Function<AnimationTimer, Void> callback) {
AnimationTimer animationTimer = new AnimationTimer() { AnimationTimer animationTimer = new AnimationTimer() {
long lastTimeStamp = System.currentTimeMillis(); long lastTimeStamp = System.currentTimeMillis();