Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions code/src/java/pcgen/cdom/base/CDOMObject.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@
import pcgen.core.analysis.BonusActivation;
import pcgen.core.bonus.BonusObj;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

public abstract class CDOMObject extends ConcretePrereqObject
implements Cloneable, BonusContainer, Loadable, Reducible, PCGenScoped, VarHolder,
VarContainer
Expand Down Expand Up @@ -1032,6 +1034,10 @@ public final void overlayCDOMObject(CDOMObject cdo)
}
}

@SuppressFBWarnings(value = "MC_OVERRIDABLE_METHOD_CALL_IN_CLONE",
justification = "ownBonuses is intentionally overridable: PCClass overrides it to "
+ "recursively re-own bonuses on its PCClassLevel children. The override only "
+ "reads the clone's BONUS list, which super.clone() already populated.")
@Override
public CDOMObject clone() throws CloneNotSupportedException
{
Expand Down
5 changes: 5 additions & 0 deletions code/src/java/pcgen/cdom/content/factset/FactSetParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
import pcgen.rules.context.LoadContext;
import pcgen.rules.persistence.token.AbstractTokenWithSeparator;
import pcgen.rules.persistence.token.CDOMSecondaryToken;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import pcgen.rules.persistence.token.ParseResult;

/**
Expand Down Expand Up @@ -120,6 +122,9 @@ public String getParentToken()
return "FACTSET";
}

@SuppressFBWarnings(value = "PZLA_PREFER_ZERO_LENGTH_ARRAYS",
justification = "null signals 'unparse errored'; empty array signals 'no output'. "
+ "Same convention as TemplateFeatToken.unparse.")
@Override
public String[] unparse(LoadContext context, T obj)
{
Expand Down
15 changes: 9 additions & 6 deletions code/src/java/pcgen/cdom/enumeration/Region.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,6 @@
*/
public final class Region implements TypeSafeConstant, Comparable<Region>
{
/**
* A "None" region for universal use.
*/
public static final Region NONE = new Region(Constants.NONE);

/**
* This Map contains the mappings from Strings to the Type Safe Constant
*/
Expand All @@ -48,7 +43,15 @@ public final class Region implements TypeSafeConstant, Comparable<Region>
/**
* This is used to provide a unique ordinal to each constant in this class
*/
private static int ordinalCount = 0;
private static int ordinalCount;

/**
* A "None" region for universal use.
*
* Declared after the mutable counters above so the constructor sees a
* defined `ordinalCount` — silences SpotBugs SI_INSTANCE_BEFORE_FINALS_ASSIGNED.
*/
public static final Region NONE = new Region(Constants.NONE);

/**
* The name of this Constant
Expand Down
7 changes: 6 additions & 1 deletion code/src/java/pcgen/cdom/facet/HitPointFacet.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import pcgen.core.PCTemplate;
import pcgen.core.PlayerCharacter;
import pcgen.core.SettingsHandler;
import pcgen.util.Logging;

/**
* HitPointFacet stores information about hit points for a Player Character.
Expand Down Expand Up @@ -92,7 +93,11 @@ private static int rollHP(final int min, final int max, final int totalLevel)
case Constants.HP_PERCENTAGE -> roll = (min - 1) + (int) ((SettingsHandler.getHPPercent() * ((max - min) + 1)) / 100.0);
case Constants.HP_AVERAGE_ROUNDED_UP -> roll = (int) Math.ceil((min + max) / 2.0);
case Constants.HP_STANDARD -> roll = Math.abs(RandomUtil.getRandomInt((max - min) + 1)) + min;
default -> roll = Math.abs(RandomUtil.getRandomInt((max - min) + 1)) + min;
default -> {
Logging.errorPrint("Unknown HP roll method "
+ SettingsHandler.getHPRollMethod() + "; falling back to HP_STANDARD");
roll = Math.abs(RandomUtil.getRandomInt((max - min) + 1)) + min;
}
}

return roll;
Expand Down
Loading