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$ * @version $Id$
*/ */
public class Cost implements Serializable { public class Cost implements Serializable {
/**
* Serializables need a version ID.
*/
private static final long serialVersionUID = 1L;
private boolean isAbility = true; private boolean isAbility = true;
private final List<CostPart> costParts = Lists.newArrayList(); private final List<CostPart> costParts = Lists.newArrayList();
private boolean isMandatory = false; private boolean isMandatory = false;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -28,6 +28,10 @@ import java.util.List;
* The Class CostGainLife. * The Class CostGainLife.
*/ */
public class CostGainLife extends CostPart { 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 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 { public class CostMill extends CostPartWithList {
/**
* Serializables need a version ID.
*/
private static final long serialVersionUID = 1L;
/** /**
* Instantiates a new cost mill. * Instantiates a new cost mill.
* *

View File

@@ -31,6 +31,10 @@ import java.io.Serializable;
* The Class CostPart. * The Class CostPart.
*/ */
public abstract class CostPart implements Comparable<CostPart>, Cloneable, Serializable { 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 originalAmount;
private String amount; private String amount;
private final String originalType, originalTypeDescription; 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 * The mana component of any spell or ability cost
*/ */
public class CostPartMana extends CostPart { public class CostPartMana extends CostPart {
/**
* Serializables need a version ID.
*/
private static final long serialVersionUID = 1L;
// "Leftover" // "Leftover"
private final ManaCost cost; private final ManaCost cost;
private boolean xCantBe0 = false; private boolean xCantBe0 = false;

View File

@@ -28,6 +28,10 @@ import forge.game.spellability.SpellAbility;
* The Class CostPartWithList. * The Class CostPartWithList.
*/ */
public abstract class CostPartWithList extends CostPart { 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. */ /** The lists: one for LKI, one for the actual cards. */
private final CardCollection lkiList = new CardCollection(); private final CardCollection lkiList = new CardCollection();
protected final CardCollection cardList = new CardCollection(); protected final CardCollection cardList = new CardCollection();

View File

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

View File

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

View File

@@ -36,6 +36,10 @@ public class CostPutCardToLib extends CostPartWithList {
// PutCardToLibFromSameGrave<Num/LibPos/Type{/TypeDescription}> // PutCardToLibFromSameGrave<Num/LibPos/Type{/TypeDescription}>
// PutCardToLibFromGrave<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 ZoneType from;
public final boolean sameZone; public final boolean sameZone;
private String libPosition = "0"; private String libPosition = "0";

View File

@@ -32,7 +32,11 @@ import java.util.List;
* The Class CostPutCounter. * The Class CostPutCounter.
*/ */
public class CostPutCounter extends CostPartWithList { 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 final CounterType counter;
private int lastPaidAmount = 0; private int lastPaidAmount = 0;

View File

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

View File

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

View File

@@ -33,6 +33,11 @@ import forge.game.zone.ZoneType;
public class CostReveal extends CostPartWithList { public class CostReveal extends CostPartWithList {
// Reveal<Num/Type/TypeDescription> // 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) { public CostReveal(final String amount, final String type, final String description) {
super(amount, type, description); super(amount, type, description);
} }

View File

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

View File

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

View File

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

View File

@@ -32,6 +32,12 @@ public class CostUnattach extends CostPartWithList {
// Unattach<CARDNAME> if ability is on the Equipment // Unattach<CARDNAME> if ability is on the Equipment
// Unattach<Card.Attached+namedHeartseeker/Equipped Heartseeker> if equipped creature has the ability // 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. * Instantiates a new cost unattach.
*/ */

View File

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

View File

@@ -29,6 +29,10 @@ import forge.game.zone.ZoneType;
* The Class CostUntapType. * The Class CostUntapType.
*/ */
public class CostUntapType extends CostPartWithList { public class CostUntapType extends CostPartWithList {
/**
* Serializables need a version ID.
*/
private static final long serialVersionUID = 1L;
public final boolean canUntapSource; public final boolean canUntapSource;
public CostUntapType(final String amount, final String type, final String description, boolean hasUntapInPrice) { 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; import java.io.Serializable;
public class OptionalCostValue implements Serializable { public class OptionalCostValue implements Serializable {
/**
* Serializables need a version ID.
*/
private static final long serialVersionUID = 1L;
private OptionalCost type; private OptionalCost type;
private Cost cost; private Cost cost;

View File

@@ -932,7 +932,7 @@ public final class CMatchUI
if (delayedReveal != null) { if (delayedReveal != null) {
reveal(delayedReveal.getMessagePrefix(), delayedReveal.getCards()); //TODO: Merge this into search dialog 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 @Override

View File

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

View File

@@ -925,6 +925,9 @@ public class FDeckEditor extends TabPageScreen<FDeckEditor> {
break; break;
case Brawl: case Brawl:
additionalFilter = DeckFormat.Brawl.isLegalCommanderPredicate(); additionalFilter = DeckFormat.Brawl.isLegalCommanderPredicate();
break;
default:
// Do nothing
} }
cardManager.setCaption("Commanders"); cardManager.setCaption("Commanders");
} }
@@ -937,10 +940,13 @@ public class FDeckEditor extends TabPageScreen<FDeckEditor> {
break; break;
case Brawl: case Brawl:
additionalFilter = DeckFormat.Brawl.isLegalCardForCommanderOrLegalPartnerPredicate(commanders); additionalFilter = DeckFormat.Brawl.isLegalCardForCommanderOrLegalPartnerPredicate(commanders);
break;
default:
// Do nothing
} }
cardManager.setCaption("Cards"); cardManager.setCaption("Cards");
} }
//fall through to below // fall through to below
default: default:
if (cardManager.getWantUnique()) { if (cardManager.getWantUnique()) {
cardManager.setPool(editorType.applyCardFilter(ItemPool.createFrom(FModel.getMagicDb().getCommonCards().getUniqueCards(), PaperCard.class), additionalFilter), true); 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); preferredColors.addAll(possibleColors);
} }
includeArtifacts = MyRandom.getRandom().nextDouble() < 0.5; includeArtifacts = MyRandom.getRandom().nextDouble() < 0.5;
// Fall through
case BALANCED: case BALANCED:
populateBalancedFilters(colorFilters, preferredColors, cardPool, includeArtifacts); populateBalancedFilters(colorFilters, preferredColors, cardPool, includeArtifacts);
break; break;
case RANDOM: case RANDOM:
populateRandomFilters(colorFilters); populateRandomFilters(colorFilters);
break; break;
default:
// Do nothing
} }