Declares a serialVersionUID.

Lots of classes here are serializable, but warn due to missing UID. Serializables are supposed to have a UID for version compatability. Fixes a bunch of compiler warnings.

Also adds in "default:" branch to a few switches which were warning due to missing cases.
This commit is contained in:
Meerkov
2018-04-17 16:48:18 -07:00
parent 0aea9ce153
commit 6efd631fd8
36 changed files with 175 additions and 3 deletions

View File

@@ -47,6 +47,10 @@ import forge.util.TextUtil;
* @version $Id$
*/
public class Cost implements Serializable {
/**
* Serializables need a version ID.
*/
private static final long serialVersionUID = 1L;
private boolean isAbility = true;
private final List<CostPart> costParts = Lists.newArrayList();
private boolean isMandatory = false;

View File

@@ -32,6 +32,11 @@ import forge.game.spellability.SpellAbility;
* The Class CostAddMana.
*/
public class CostAddMana extends CostPart {
/**
* Serializables need a version ID.
*/
private static final long serialVersionUID = 1L;
/**
* CostCostAddMana.
* @param amount

View File

@@ -25,6 +25,11 @@ import forge.game.spellability.SpellAbility;
*/
public class CostChooseCreatureType extends CostPart {
/**
* Serializables need a version ID.
*/
private static final long serialVersionUID = 1L;
/**
* Instantiates a new cost mill.
*

View File

@@ -27,6 +27,11 @@ import forge.game.spellability.SpellAbility;
*/
public class CostDamage extends CostPart {
/**
* Serializables need a version ID.
*/
private static final long serialVersionUID = 1L;
public CostDamage(final String amount) {
this.setAmount(amount);
}

View File

@@ -34,6 +34,11 @@ public class CostDiscard extends CostPartWithList {
// Inputs
/**
* Serializables need a version ID.
*/
private static final long serialVersionUID = 1L;
/**
* Instantiates a new cost discard.
*

View File

@@ -28,6 +28,11 @@ import java.util.List;
* The Class CostPayLife.
*/
public class CostDraw extends CostPart {
/**
* Serializables need a version ID.
*/
private static final long serialVersionUID = 1L;
/**
* CostDraw.
* @param amount

View File

@@ -29,6 +29,11 @@ import forge.game.zone.ZoneType;
*/
public class CostExert extends CostPartWithList {
/**
* Serializables need a version ID.
*/
private static final long serialVersionUID = 1L;
/**
* Instantiates a new cost Exert.
*

View File

@@ -38,6 +38,10 @@ public class CostExile extends CostPartWithList {
// ExileFromTop<Num/Type{/TypeDescription}> (of library)
// ExileSameGrave<Num/Type{/TypeDescription}>
/**
* Serializables need a version ID.
*/
private static final long serialVersionUID = 1L;
public final ZoneType from;
public final boolean sameZone;

View File

@@ -33,6 +33,11 @@ public class CostExileFromStack extends CostPart {
// ExileFromStack<Num/Type{/TypeDescription}>
/**
* Serializables need a version ID.
*/
private static final long serialVersionUID = 1L;
/**
* Instantiates a new cost exile.
*

View File

@@ -29,6 +29,11 @@ import forge.game.zone.ZoneType;
* This is for the "ExiledMoveToGrave" Cost.
*/
public class CostExiledMoveToGrave extends CostPartWithList {
/**
* Serializables need a version ID.
*/
private static final long serialVersionUID = 1L;
// ExiledMoveToGrave<Num/Type{/TypeDescription}>
public CostExiledMoveToGrave(final String amount, final String type, final String description) {
super(amount, type, description);

View File

@@ -27,6 +27,11 @@ import forge.game.spellability.SpellAbility;
*/
public class CostFlipCoin extends CostPartWithList {
/**
* Serializables need a version ID.
*/
private static final long serialVersionUID = 1L;
/**
* Instantiates a new cost FlipCoin.
*

View File

@@ -31,6 +31,11 @@ import forge.game.zone.ZoneType;
public class CostGainControl extends CostPartWithList {
// GainControl<Num/Type{/TypeDescription}>
/**
* Serializables need a version ID.
*/
private static final long serialVersionUID = 1L;
/**
* Instantiates a new cost return.
*

View File

@@ -28,6 +28,10 @@ import java.util.List;
* The Class CostGainLife.
*/
public class CostGainLife extends CostPart {
/**
* Serializables need a version ID.
*/
private static final long serialVersionUID = 1L;
private final int cntPlayers; // MAX_VALUE means ALL/EACH PLAYERS
/**

View File

@@ -31,6 +31,11 @@ import forge.game.zone.ZoneType;
*/
public class CostMill extends CostPartWithList {
/**
* Serializables need a version ID.
*/
private static final long serialVersionUID = 1L;
/**
* Instantiates a new cost mill.
*

View File

@@ -31,6 +31,10 @@ import java.io.Serializable;
* The Class CostPart.
*/
public abstract class CostPart implements Comparable<CostPart>, Cloneable, Serializable {
/**
* Serializables need a version ID.
*/
private static final long serialVersionUID = 1L;
private String originalAmount;
private String amount;
private final String originalType, originalTypeDescription;

View File

@@ -26,6 +26,10 @@ import forge.game.spellability.SpellAbility;
* The mana component of any spell or ability cost
*/
public class CostPartMana extends CostPart {
/**
* Serializables need a version ID.
*/
private static final long serialVersionUID = 1L;
// "Leftover"
private final ManaCost cost;
private boolean xCantBe0 = false;

View File

@@ -28,6 +28,10 @@ import forge.game.spellability.SpellAbility;
* The Class CostPartWithList.
*/
public abstract class CostPartWithList extends CostPart {
/**
* Serializables need a version ID.
*/
private static final long serialVersionUID = 1L;
/** The lists: one for LKI, one for the actual cards. */
private final CardCollection lkiList = new CardCollection();
protected final CardCollection cardList = new CardCollection();

View File

@@ -27,6 +27,11 @@ import forge.game.spellability.SpellAbility;
public class CostPayEnergy extends CostPart {
/**
* Serializables need a version ID.
*/
private static final long serialVersionUID = 1L;
int paidAmount = 0;
/**

View File

@@ -26,6 +26,10 @@ import forge.game.spellability.SpellAbility;
* The Class CostPayLife.
*/
public class CostPayLife extends CostPart {
/**
* Serializables need a version ID.
*/
private static final long serialVersionUID = 1L;
int paidAmount = 0;
/**

View File

@@ -36,6 +36,10 @@ public class CostPutCardToLib extends CostPartWithList {
// PutCardToLibFromSameGrave<Num/LibPos/Type{/TypeDescription}>
// PutCardToLibFromGrave<Num/LibPos/Type{/TypeDescription}>
/**
* Serializables need a version ID.
*/
private static final long serialVersionUID = 1L;
public final ZoneType from;
public final boolean sameZone;
private String libPosition = "0";

View File

@@ -32,7 +32,11 @@ import java.util.List;
* The Class CostPutCounter.
*/
public class CostPutCounter extends CostPartWithList {
// Put Counter doesn't really have a "Valid" portion of the cost
/**
* Serializables need a version ID.
*/
private static final long serialVersionUID = 1L;
// Put Counter doesn't really have a "Valid" portion of the cost
private final CounterType counter;
private int lastPaidAmount = 0;

View File

@@ -30,6 +30,10 @@ import java.util.Map;
* The Class CostRemoveAnyCounter.
*/
public class CostRemoveAnyCounter extends CostPartWithList {
/**
* Serializables need a version ID.
*/
private static final long serialVersionUID = 1L;
// RemoveAnyCounter<Num/Type/{TypeDescription}>
// Power Conduit and Chisei, Heart of Oceans
// Both cards have "Remove a counter from a permanent you control"

View File

@@ -40,6 +40,10 @@ public class CostRemoveCounter extends CostPartWithList {
// Quillspike, Rift Elemental, Sage of Fables, Spike Rogue
/**
* Serializables need a version ID.
*/
private static final long serialVersionUID = 1L;
public final CounterType counter;
public final ZoneType zone;
private int cntRemoved;

View File

@@ -30,6 +30,12 @@ import forge.game.zone.ZoneType;
public class CostReturn extends CostPartWithList {
// Return<Num/Type{/TypeDescription}>
/**
* Serializables need a version ID.
*/
private static final long serialVersionUID = 1L;
/**
* Instantiates a new cost return.
*

View File

@@ -33,6 +33,11 @@ import forge.game.zone.ZoneType;
public class CostReveal extends CostPartWithList {
// Reveal<Num/Type/TypeDescription>
/**
* Serializables need a version ID.
*/
private static final long serialVersionUID = 1L;
public CostReveal(final String amount, final String type, final String description) {
super(amount, type, description);
}

View File

@@ -30,6 +30,11 @@ import forge.game.zone.ZoneType;
*/
public class CostSacrifice extends CostPartWithList {
/**
* Serializables need a version ID.
*/
private static final long serialVersionUID = 1L;
/**
* Instantiates a new cost sacrifice.
*

View File

@@ -26,6 +26,11 @@ import forge.game.spellability.SpellAbility;
*/
public class CostTap extends CostPart {
/**
* Serializables need a version ID.
*/
private static final long serialVersionUID = 1L;
/**
* Instantiates a new cost tap.
*/

View File

@@ -32,6 +32,10 @@ import forge.util.TextUtil;
*/
public class CostTapType extends CostPartWithList {
/**
* Serializables need a version ID.
*/
private static final long serialVersionUID = 1L;
public final boolean canTapSource;
/**

View File

@@ -32,6 +32,12 @@ public class CostUnattach extends CostPartWithList {
// Unattach<CARDNAME> if ability is on the Equipment
// Unattach<Card.Attached+namedHeartseeker/Equipped Heartseeker> if equipped creature has the ability
/**
* Serializables need a version ID.
*/
private static final long serialVersionUID = 1L;
/**
* Instantiates a new cost unattach.
*/

View File

@@ -26,6 +26,11 @@ import forge.game.spellability.SpellAbility;
*/
public class CostUntap extends CostPart {
/**
* Serializables need a version ID.
*/
private static final long serialVersionUID = 1L;
/**
* Instantiates a new cost untap.
*/

View File

@@ -29,6 +29,10 @@ import forge.game.zone.ZoneType;
* The Class CostUntapType.
*/
public class CostUntapType extends CostPartWithList {
/**
* Serializables need a version ID.
*/
private static final long serialVersionUID = 1L;
public final boolean canUntapSource;
public CostUntapType(final String amount, final String type, final String description, boolean hasUntapInPrice) {

View File

@@ -5,6 +5,10 @@ import forge.game.cost.Cost;
import java.io.Serializable;
public class OptionalCostValue implements Serializable {
/**
* Serializables need a version ID.
*/
private static final long serialVersionUID = 1L;
private OptionalCost type;
private Cost cost;

View File

@@ -932,7 +932,7 @@ public final class CMatchUI
if (delayedReveal != null) {
reveal(delayedReveal.getMessagePrefix(), delayedReveal.getCards()); //TODO: Merge this into search dialog
}
return (List) order(title,"Selected", 0, optionList.size(), optionList, null, null, false);
return (List<GameEntityView>) order(title,"Selected", 0, optionList.size(), optionList, null, null, false);
}
@Override

View File

@@ -287,6 +287,11 @@ public enum FView {
updateWarningOverlay.add(updateWarningContentPanel, constraints);
btnRemindMeLater.setCommand(new UiCommand() {
/**
*
*/
private static final long serialVersionUID = 1L;
@Override
public void run() {
SOverlayUtils.hideOverlay();
@@ -294,6 +299,11 @@ public enum FView {
});
btnDoNotRemindMe.setCommand(new UiCommand() {
/**
*
*/
private static final long serialVersionUID = 1L;
@Override
public void run() {
if (FOptionPane.showConfirmDialog("Are you sure? You can re-enable this warning in Forge's general preferences.")) {
@@ -305,6 +315,11 @@ public enum FView {
});
btnDownloadLatestJava.setCommand(new UiCommand() {
/**
*
*/
private static final long serialVersionUID = 1L;
@Override
public void run() {
try {

View File

@@ -925,6 +925,9 @@ public class FDeckEditor extends TabPageScreen<FDeckEditor> {
break;
case Brawl:
additionalFilter = DeckFormat.Brawl.isLegalCommanderPredicate();
break;
default:
// Do nothing
}
cardManager.setCaption("Commanders");
}
@@ -937,10 +940,13 @@ public class FDeckEditor extends TabPageScreen<FDeckEditor> {
break;
case Brawl:
additionalFilter = DeckFormat.Brawl.isLegalCardForCommanderOrLegalPartnerPredicate(commanders);
break;
default:
// Do nothing
}
cardManager.setCaption("Cards");
}
//fall through to below
// fall through to below
default:
if (cardManager.getWantUnique()) {
cardManager.setPool(editorType.applyCardFilter(ItemPool.createFrom(FModel.getMagicDb().getCommonCards().getUniqueCards(), PaperCard.class), additionalFilter), true);

View File

@@ -219,12 +219,15 @@ public final class BoosterUtils {
preferredColors.addAll(possibleColors);
}
includeArtifacts = MyRandom.getRandom().nextDouble() < 0.5;
// Fall through
case BALANCED:
populateBalancedFilters(colorFilters, preferredColors, cardPool, includeArtifacts);
break;
case RANDOM:
populateRandomFilters(colorFilters);
break;
default:
// Do nothing
}