More non-functional code (findbugs).

This commit is contained in:
Mike Pope 2019-03-13 09:48:14 +10:30
parent e6a30e548b
commit 9e8b6fe92b
5 changed files with 9 additions and 25 deletions

View File

@ -137,7 +137,6 @@ public final class ReportCompactColonyPanel extends ReportPanel {
*/
public GoodsProduction accumulate(GoodsProduction other) {
this.amount += other.amount;
this.status =
this.status = (this.status == ProductionStatus.NONE
&& other.status == ProductionStatus.NONE)
? ProductionStatus.NONE
@ -769,7 +768,7 @@ public final class ReportCompactColonyPanel extends ReportPanel {
.addAmount("%turns%", turns);
b = newButton(qac, bname + " " + Integer.toString(turns), null,
cGood, t);
} else if (turns < 0) {
} else { // turns < 0
turns = -(turns + 1);
t = stpld("report.colony.making.blocking")
.addName("%colony%", s.colony.getName())

View File

@ -156,7 +156,7 @@ public class RebelToolTip extends JToolTip {
} else if (grow >= 0) {
add(Utility.localizedLabel("rebelToolTip.changeMore"));
add(new JLabel(String.valueOf(grow)), "skip");
} else if (grow < 0) {
} else { // grow < 0
add(Utility.localizedLabel("rebelToolTip.changeLess"));
add(new JLabel(String.valueOf(-grow)), "skip");
}

View File

@ -832,8 +832,7 @@ public class SimpleCombatModel extends CombatModel {
crs.add((winner.canCaptureEquipment(loserRole) != null)
? CombatResult.CAPTURE_EQUIP
: CombatResult.LOSE_EQUIP);
if (loserMustDie
|| loser.losingEquipmentKillsUnit()) {
if (loser.losingEquipmentKillsUnit()) {
crs.add(CombatResult.SLAUGHTER_UNIT);
} else if (loser.losingEquipmentDemotesUnit()) {
crs.add(CombatResult.DEMOTE_UNIT);

View File

@ -143,16 +143,12 @@ public final class MessageMerge {
break;
}
char c = (char) data;
if ( '\r' == c )
{
if ( '\r' == c ) {
// do nothing
}
if ( '\n' == c )
{
} else if ( '\n' == c ) {
lineList.add( line.toString() );
line.setLength( 0 );
}
else {
} else {
line.append( c );
}
}

View File

@ -21,8 +21,9 @@ package net.sf.freecol.server.generator;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import java.util.Vector;
import javax.xml.stream.XMLStreamException;
@ -112,16 +113,6 @@ public class MapGeneratorTest extends FreeColTestCase {
// Apply the difficulty level
//spec().applyDifficultyLevel("model.difficulty.medium");
Vector<Player> players = new Vector<Player>();
for (Nation n : spec().getNations()) {
if (n.isUnknownEnemy()) continue;
Player p = new ServerPlayer(g, false, n);
p.setAI(!n.getType().isEuropean() || n.getType().isREF());
g.addPlayer(p);
players.add(p);
}
MapGenerator gen = new SimpleMapGenerator(new Random(1));
gen.generateMap(g, null, new LogBuilder(-1));
assertNotNull("New map", g.getMap());
@ -158,8 +149,7 @@ public class MapGeneratorTest extends FreeColTestCase {
MapGenerator gen = new SimpleMapGenerator(new Random(1));
Vector<Player> players = new Vector<Player>();
List<Player> players = new ArrayList<>();
for (Nation n : spec().getNations()) {
if (n.isUnknownEnemy()) continue;
Player p = new ServerPlayer(g, false, n);