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;
}
@SuppressWarnings("WeakerAccess")
@VisibleForTesting
static void sortOutputs(ArrayList<TransactionOutput> outputs) {
Collections.sort(outputs, new Comparator<TransactionOutput>() {
@ -122,7 +121,6 @@ public class AddressBasedCoinSelector extends DefaultCoinSelector {
}
}
@SuppressWarnings("WeakerAccess")
protected boolean matchesRequiredAddress(TransactionOutput transactionOutput) {
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.
*/
@SuppressWarnings({"SameReturnValue", "UnusedParameters"})
public class BlockChainFacade {
@Inject
public BlockChainFacade() {

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -24,7 +24,6 @@ public class VSpacer extends Pane {
public VSpacer() {
}
@SuppressWarnings("SameParameterValue")
public VSpacer(double 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 {
final double borderWidth = 1;
private final double arrowWidth = 10;

View file

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

View file

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

View file

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

View file

@ -35,7 +35,6 @@ import javafx.scene.control.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@SuppressWarnings("CanBeFinal")
public class ConfidenceDisplay {
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;
@SuppressWarnings("WeakerAccess")
public class Transitions {
private static final Logger log = LoggerFactory.getLogger(Transitions.class);
@ -43,7 +42,6 @@ public class Transitions {
fadeIn(node, UI_ANIMATION_TIME);
}
@SuppressWarnings("SameParameterValue")
public static void fadeIn(Node node, int duration) {
FadeTransition ft = new FadeTransition(Duration.millis(duration), node);
ft.setFromValue(0.0);
@ -63,7 +61,6 @@ public class Transitions {
return ft;
}
@SuppressWarnings("UnusedReturnValue")
public static Animation fadeOutAndRemove(Node node) {
return fadeOutAndRemove(node, UI_ANIMATION_TIME);
}
@ -94,7 +91,6 @@ public class Transitions {
blurOut(node, UI_ANIMATION_TIME);
}
@SuppressWarnings("SameParameterValue")
public static Timeline blurOut(Node node, int duration) {
GaussianBlur blur = new GaussianBlur(0.0);
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",
"SA", "SD", "SE", "SG", "SI", "SK", "SV", "SY", "TH", "TN", "TR", "TW", "UA", "US", "UY", "VE", "VN",
"YE", "ZA"};
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",
"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"},
{"OC", "Oceania"}};
public static List<Region> getAllRegions() {
final List<Region> allRegions = new ArrayList<>();
@ -84,7 +84,6 @@ public class CountryUtil {
selectedRegion != null && country != null && selectedRegion.equals(country.getRegion())));
}
private static List<Country> getAllCountries() {
final List<Country> allCountries = new ArrayList<>();
for (final Locale locale : getAllCountryLocales()) {
@ -96,7 +95,6 @@ public class CountryUtil {
return allCountries;
}
public static Country getDefaultCountry() {
final Locale locale = new Locale("", Locale.getDefault().getCountry());
String regionCode = getRegionCode(locale.getCountry());
@ -104,7 +102,6 @@ public class CountryUtil {
return new Country(locale.getCountry(), locale.getDisplayCountry(), region);
}
private static String getRegionName(final String regionCode) {
for (final String[] regionName : regionCodeToName) {
if (regionName[0].equals(regionCode)) {
@ -114,7 +111,6 @@ public class CountryUtil {
return regionCode;
}
private static List<Locale> getAllCountryLocales() {
List<Locale> allLocales = Arrays.asList(Locale.getAvailableLocales());
Set<Locale> allLocalesAsSet =
@ -127,7 +123,6 @@ public class CountryUtil {
return allLocales;
}
private static String getRegionCode(String countryCode) {
if (!countryCode.isEmpty() && countryCodeList.contains(countryCode)) {
return regionCodeList.get(countryCodeList.indexOf(countryCode));

View file

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

View file

@ -37,12 +37,10 @@ import org.slf4j.LoggerFactory;
public class Localisation {
private static final Logger log = LoggerFactory.getLogger(Localisation.class);
public static ResourceBundle getResourceBundle() {
return ResourceBundle.getBundle("i18n.displayStrings", new UTF8Control());
}
public static String get(String key) {
if (key == null)
return "";
@ -55,12 +53,12 @@ public class Localisation {
}
}
public static String get(String key, String... arguments) {
return MessageFormat.format(Localisation.get(key), arguments);
}
}
// Adds UTF8 support for property files
class UTF8Control extends ResourceBundle.Control {
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.storage.Data;
@SuppressWarnings({"EmptyMethod", "UnusedParameters"})
// Arbitration is not much developed yet
public interface ArbitratorListener {
void onArbitratorAdded(Data offerData, boolean success);

View file

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

View file

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

View file

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

View file

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