Buggy code:
public final class TowerCapability extends Capability { private static final int RANSOM_POINTS = 3 ; private final Set < Position > towers = new HashSet < > ( ) ; private final Map < Player , Integer > towerPieces = new HashMap < > ( ) ; private boolean ransomPaidThisTurn ; private Position lastIncreasedTower ; private final Map < Player , List < Follower > > prisoners = Collections . synchronizedMap ( new HashMap < Player , List < Follower > > ( ) ) ; public TowerCapability ( Game game ) { } @ Override public Object backup ( ) { } @ SuppressWarnings ( "unchecked" ) @ Override public void restore ( Object data ) { } public void registerTower ( Position p ) { } public void unregisterTower ( Position p ) { } public Set < Position > getTowers ( ) { } public boolean isRansomPaidThisTurn ( ) { } public void setRansomPaidThisTurn ( boolean ransomPayedThisTurn ) { } @ Override public void initPlayer ( Player player ) { } public int getTowerPieces ( Player player ) { } public int setTowerPieces ( Player player , int pieces ) { } public void decreaseTowerPieces ( Player player ) { } private boolean hasSmallOrBigFollower ( Player p ) { } @ Override public void prepareActions ( List < PlayerAction < ? > > actions , Set < FeaturePointer > followerOptions ) { } public void prepareTowerFollowerDeploy ( List < MeepleAction > followerActions ) { } public void placeTowerPiece ( Player player , Position pos ) { } protected Set < Position > getOpenTowers ( int minHeight ) { } public Map < Player , List < Follower > > getPrisoners ( ) { } public Position getLastIncreasedTower ( ) { } public void setLastIncreasedTower ( Position lastIncreasedTower ) { } public boolean hasImprisonedFollower ( Player followerOwner ) { } public boolean hasImprisonedFollower ( Player followerOwner , Class < ? extends Follower > followerClass ) { } public void inprison ( Follower m , Player player ) { } public void payRansom ( Integer playerIndexToPay , Class < ? extends Follower > meepleType ) { if ( ransomPaidThisTurn ) { throw new IllegalStateException ( "Ransom<seq2seq4repair_space>alreasy<seq2seq4repair_space>paid<seq2seq4repair_space>this<seq2seq4repair_space>turn" ) ; } Player opponent = game . getAllPlayers ( ) [ playerIndexToPay ] ; Iterator < Follower > i = prisoners . get ( opponent ) . iterator ( ) ; while ( i . hasNext ( ) ) { Follower meeple = i . next ( ) ; <START_BUG> if ( meepleType . isInstance ( meeple ) ) { <END_BUG> i . remove ( ) ; meeple . setInPrison ( false ) ; opponent . addPoints ( TowerCapability . RANSOM_POINTS , TOWER_RANSOM ) ; ransomPaidThisTurn = true ; game . getActivePlayer ( ) . addPoints ( ( - ( TowerCapability . RANSOM_POINTS ) ) , TOWER_RANSOM ) ; game . post ( new com . jcloisterzone . event . MeeplePrisonEvent ( meeple , opponent , null ) ) ; game . getPhase ( ) . notifyRansomPaid ( ) ; return ; } } throw new IllegalStateException ( "Opponent<seq2seq4repair_space>has<seq2seq4repair_space>no<seq2seq4repair_space>figure<seq2seq4repair_space>to<seq2seq4repair_space>exchage" ) ; } @ Override public void turnCleanUp ( ) { } @ Override public void saveToSnapshot ( Document doc , Element node ) { } @ SuppressWarnings ( "unchecked" ) @ Override public void loadFromSnapshot ( Document doc , Element node ) { } }

Fix:
if ( ( meeple . getClass ( ) ) == meepleType ) {