|
From: Vest <no...@gi...> - 2026-07-22 09:53:39
|
Branch: refs/heads/master Home: https://github.com/PCGen/pcgen Commit: dac7d2f52c76105d426ccc28e8a9d774730eda20 https://github.com/PCGen/pcgen/commit/dac7d2f52c76105d426ccc28e8a9d774730eda20 Author: Vest <Ve...@us...> Date: 2026-07-22 (Wed, 22 Jul 2026) Changed paths: M code/src/java/pcgen/cdom/choiceset/SpellCasterChoiceSet.java M code/src/java/pcgen/output/actor/DescriptionActor.java A code/src/test/pcgen/cdom/choiceset/SpellCasterChoiceSetEqualsTest.java Log Message: ----------- SpotBugs correctness: SpellCasterChoiceSet symmetry + DescriptionActor null PC (#7671) * SpellCasterChoiceSet: delete asymmetric equals/hashCode, inherit parent Parent ChoiceSet.equals accepts any ChoiceSet<?> (via pattern matching on the parent type) and compares setName + pcs. The subclass override required the other side to be a SpellCasterChoiceSet, so the equality relation was not symmetric: parentChoiceSet.equals(spellCaster) -> true (setName + pcs match) spellCaster.equals(parentChoiceSet) -> false (rejected by instanceof) hashCode was likewise inconsistent: parent hashes setName + pcs, subclass hashed types + primitives. Equal-by-parent objects could end up in different buckets. The subclass's types / primitives fields are not part of identity beyond what the parent already captures via the typePCS passed to super(...), so the right pattern (already used by the sibling ChoiceSet.AbilityChoiceSet in a7cd6c1504 / #7628) is to delete the override and inherit. The class gets @SuppressFBWarnings(EQ_DOESNT_OVERRIDE_EQUALS) with the rationale. Adds SpellCasterChoiceSetEqualsTest pinning the symmetry contract; the test would have failed against the pre-fix override. * DescriptionActor.process: guard against null PC (and null bean) PlayerCharacterTrackingFacet.getPC documents (lines 40-47) that it may return null in unit-test paths where no PC has been associated with the CharID. SpringHelper.getBean also returns null when no bean is registered for the requested type. Both nulls used to flow straight into desc.getDescription(aPC, ...), producing an NPE downstream. SpotBugs flags this as NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE at DescriptionActor.java:71 (charStore loaded, then dereferenced at line 72 without a guard). Returns an empty wrapped string for the no-PC case, matching the existing 'no benefits' early-out a few lines above. To unsubscribe from these emails, change your notification settings at https://github.com/PCGen/pcgen/settings/notifications |