This removes findbugs annotations usage. Main reason: No Fedora package for
that.
Proper solution: Make a spotbugs-annotations for Fedora, then adjust freecol
to use it, instead of the bundled one.
diff -uNr freecol-1.1.0.orig/build.xml freecol-1.1.0/build.xml
--- freecol-1.1.0.orig/build.xml 2023-05-07 12:51:32.000000000 +0200
+++ freecol-1.1.0/build.xml 2023-10-01 14:09:45.745000000 +0200
@@ -46,8 +46,6 @@
<!-- JOgg/JOrbis libraries -->
<pathelement location="${basedir}/jars/jogg-0.0.17.jar"/>
<pathelement location="${basedir}/jars/jorbis-0.0.17.jar"/>
- <!-- findbugs annotations -->
- <pathelement location="${basedir}/jars/findbugs-annotations.jar"/>
</path>
<path id="junit.classpath">
<pathelement location="${basedir}/test/lib/junit.jar" />
diff -uNr freecol-1.1.0.orig/src/MANIFEST.MF freecol-1.1.0/src/MANIFEST.MF
--- freecol-1.1.0.orig/src/MANIFEST.MF 2023-05-07 12:51:32.000000000 +0200
+++ freecol-1.1.0/src/MANIFEST.MF 2023-10-01 14:10:37.047000000 +0200
@@ -8,5 +8,5 @@
Package-Vendor: FreeCol Team
Class-Path: jars/miglayout-swing-5.0.jar jars/miglayout-core-5.0.jar j
ars/commons-cli-1.4.jar jars/cortado-0.6.0.jar jars/jogg-0.0.17.jar j
- ars/jorbis-0.0.17.jar jars/findbugs-annotations.jar
+ ars/jorbis-0.0.17.jar
diff -uNr freecol-1.1.0.orig/src/net/sf/freecol/client/gui/mapviewer/MapViewer.java freecol-1.1.0/src/net/sf/freecol/client/gui/mapviewer/MapViewer.java
--- freecol-1.1.0.orig/src/net/sf/freecol/client/gui/mapviewer/MapViewer.java 2023-05-07 12:51:32.000000000 +0200
+++ freecol-1.1.0/src/net/sf/freecol/client/gui/mapviewer/MapViewer.java 2023-10-01 14:10:59.684000000 +0200
@@ -49,7 +49,6 @@
import java.util.logging.Level;
import java.util.logging.Logger;
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import net.sf.freecol.client.ClientOptions;
import net.sf.freecol.client.FreeColClient;
import net.sf.freecol.client.control.FreeColClientHolder;
@@ -225,8 +224,6 @@
* @param size The size of the map.
* @return {@code true} if the entire map has been repainted.
*/
- @SuppressFBWarnings(value="NP_LOAD_OF_KNOWN_NULL_VALUE",
- justification="lazy load of extra tiles")
public boolean displayMap(Graphics2D g2d, Dimension size) {
final long startMs = now();
final Rectangle clipBounds = g2d.getClipBounds();
diff -uNr freecol-1.1.0.orig/src/net/sf/freecol/client/gui/ModifierFormat.java freecol-1.1.0/src/net/sf/freecol/client/gui/ModifierFormat.java
--- freecol-1.1.0.orig/src/net/sf/freecol/client/gui/ModifierFormat.java 2023-05-07 12:51:32.000000000 +0200
+++ freecol-1.1.0/src/net/sf/freecol/client/gui/ModifierFormat.java 2023-10-01 14:11:20.786000000 +0200
@@ -37,8 +37,6 @@
import net.sf.freecol.common.model.Turn;
import static net.sf.freecol.common.util.CollectionUtils.*;
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
-
public class ModifierFormat {
@@ -83,7 +81,6 @@
return result;
}
- @SuppressFBWarnings(value="NP_LOAD_OF_KNOWN_NULL_VALUE")
private static String getSourceName(FreeColObject source) {
if (source == null) return getUnknownValue();
diff -uNr freecol-1.1.0.orig/src/net/sf/freecol/common/model/Specification.java freecol-1.1.0/src/net/sf/freecol/common/model/Specification.java
--- freecol-1.1.0.orig/src/net/sf/freecol/common/model/Specification.java 2023-05-07 12:51:32.000000000 +0200
+++ freecol-1.1.0/src/net/sf/freecol/common/model/Specification.java 2023-10-01 14:11:50.499000000 +0200
@@ -51,7 +51,6 @@
import javax.xml.stream.XMLStreamException;
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import net.sf.freecol.common.io.FreeColDirectories;
import net.sf.freecol.common.io.FreeColModFile;
import net.sf.freecol.common.io.FreeColRules;
@@ -200,8 +199,6 @@
/**
* {@inheritDoc}
*/
- @SuppressFBWarnings(value="DLC_DUBIOUS_LIST_COLLECTION",
- justification="List required externally")
@Override
public void readChildren(FreeColXMLReader xr)
throws XMLStreamException {
diff -uNr freecol-1.1.0.orig/src/net/sf/freecol/common/model/Stance.java freecol-1.1.0/src/net/sf/freecol/common/model/Stance.java
--- freecol-1.1.0.orig/src/net/sf/freecol/common/model/Stance.java 2023-05-07 12:51:32.000000000 +0200
+++ freecol-1.1.0/src/net/sf/freecol/common/model/Stance.java 2023-10-01 14:11:46.345000000 +0200
@@ -22,8 +22,6 @@
import net.sf.freecol.common.i18n.Messages;
import static net.sf.freecol.common.util.StringUtils.*;
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
-
/**
* The stance one player has towards another player.
@@ -96,7 +94,6 @@
* @param newStance The new {@code Stance}.
* @return A modifier to the current tension.
*/
- @SuppressFBWarnings(value="SF_SWITCH_FALLTHROUGH")
public int getTensionModifier(Stance newStance) {
switch (newStance) {
case UNCONTACTED: badTransition(newStance);
diff -uNr freecol-1.1.0.orig/src/net/sf/freecol/common/option/AudioMixerOption.java freecol-1.1.0/src/net/sf/freecol/common/option/AudioMixerOption.java
--- freecol-1.1.0.orig/src/net/sf/freecol/common/option/AudioMixerOption.java 2023-05-07 12:51:32.000000000 +0200
+++ freecol-1.1.0/src/net/sf/freecol/common/option/AudioMixerOption.java 2023-10-01 14:11:32.215000000 +0200
@@ -33,8 +33,6 @@
import net.sf.freecol.common.model.Specification;
import static net.sf.freecol.common.util.CollectionUtils.*;
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
-
/**
* Option for selecting an audio mixer.
@@ -218,7 +216,6 @@
/**
* {@inheritDoc}
*/
- @SuppressFBWarnings(value="NP_LOAD_OF_KNOWN_NULL_VALUE")
@Override
protected void setValue(String valueString, String defaultValueString) {
MixerWrapper mw = null;
diff -uNr freecol-1.1.0.orig/src/net/sf/freecol/common/option/LanguageOption.java freecol-1.1.0/src/net/sf/freecol/common/option/LanguageOption.java
--- freecol-1.1.0.orig/src/net/sf/freecol/common/option/LanguageOption.java 2023-05-07 12:51:32.000000000 +0200
+++ freecol-1.1.0/src/net/sf/freecol/common/option/LanguageOption.java 2023-10-01 14:11:27.015000000 +0200
@@ -37,8 +37,6 @@
import static net.sf.freecol.common.util.StringUtils.*;
import net.sf.freecol.common.util.Utils;
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
-
/**
* Option for selecting a language. The possible choices are determined
@@ -268,7 +266,6 @@
/**
* {@inheritDoc}
*/
- @SuppressFBWarnings(value="NP_LOAD_OF_KNOWN_NULL_VALUE")
@Override
protected void setValue(String valueString, String defaultValueString) {
Language l = null;
diff -uNr freecol-1.1.0.orig/src/net/sf/freecol/common/util/CachingFunction.java freecol-1.1.0/src/net/sf/freecol/common/util/CachingFunction.java
--- freecol-1.1.0.orig/src/net/sf/freecol/common/util/CachingFunction.java 2023-05-07 12:51:32.000000000 +0200
+++ freecol-1.1.0/src/net/sf/freecol/common/util/CachingFunction.java 2023-10-01 14:11:36.845000000 +0200
@@ -23,8 +23,6 @@
import java.util.Map;
import java.util.function.Function;
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
-
/**
* Wrapper for a Function that caches its results.
@@ -51,8 +49,6 @@
/**
* {@inheritDoc}
*/
- @SuppressFBWarnings(value="MUI_CONTAINSKEY_BEFORE_GET",
- justification="Deliberate to all null values")
public R apply(T t) {
R result;
// Normally we would just use get(), but this is a general routine
diff -uNr freecol-1.1.0.orig/src/net/sf/freecol/common/util/Utils.java freecol-1.1.0/src/net/sf/freecol/common/util/Utils.java
--- freecol-1.1.0.orig/src/net/sf/freecol/common/util/Utils.java 2023-05-07 12:51:32.000000000 +0200
+++ freecol-1.1.0/src/net/sf/freecol/common/util/Utils.java 2023-10-01 14:11:41.129000000 +0200
@@ -56,8 +56,6 @@
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
-
/**
* Collection of small static helper methods.
@@ -357,7 +355,6 @@
*
* Route all gc calls here, so we can disable the findbugs warning.
*/
- @SuppressFBWarnings(value="DM_GC", justification="Deliberate")
public static void garbageCollect() {
System.gc();
}
diff -uNr freecol-1.1.0.orig/src/net/sf/freecol/FreeCol.java freecol-1.1.0/src/net/sf/freecol/FreeCol.java
--- freecol-1.1.0.orig/src/net/sf/freecol/FreeCol.java 2023-05-07 12:51:32.000000000 +0200
+++ freecol-1.1.0/src/net/sf/freecol/FreeCol.java 2023-10-01 14:10:55.711000000 +0200
@@ -62,7 +62,6 @@
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import net.sf.freecol.client.ClientOptions;
import net.sf.freecol.client.FreeColClient;
import net.sf.freecol.client.gui.SplashScreen;
@@ -526,7 +525,6 @@
*
* @param status Exit status.
*/
- @SuppressFBWarnings(value="DM_EXIT", justification="Deliberate")
public static void quit(int status) {
System.exit(status);
}
@@ -1257,8 +1255,6 @@
* default locale.
* @return True if the {@code Locale} changed.
*/
- @SuppressFBWarnings(value="MDM_SETDEFAULTLOCALE",
- justification="Locale can be reset by user")
public static boolean setLocale(String localeArg) {
Locale newLocale = null;
if (localeArg == null) {
diff -uNr freecol-1.1.0.orig/src/net/sf/freecol/server/ai/mission/TransportMission.java freecol-1.1.0/src/net/sf/freecol/server/ai/mission/TransportMission.java
--- freecol-1.1.0.orig/src/net/sf/freecol/server/ai/mission/TransportMission.java 2023-05-07 12:51:32.000000000 +0200
+++ freecol-1.1.0/src/net/sf/freecol/server/ai/mission/TransportMission.java 2023-10-01 14:12:04.038000000 +0200
@@ -34,7 +34,6 @@
import javax.xml.stream.XMLStreamException;
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import net.sf.freecol.common.FreeColException;
import net.sf.freecol.common.io.FreeColXMLReader;
import net.sf.freecol.common.io.FreeColXMLWriter;
@@ -838,7 +837,6 @@
* TNEXT if it has progressed to the next stage,
* TRETRY if a blockage has occurred and it should be retried,
*/
- @SuppressFBWarnings(value="SF_SWITCH_FALLTHROUGH")
private CargoResult tryCargo(Cargo cargo, LogBuilder lb) {
final Unit carrier = getUnit();
final Location here = carrier.getLocation();
diff -uNr freecol-1.1.0.orig/src/net/sf/freecol/server/control/InGameController.java freecol-1.1.0/src/net/sf/freecol/server/control/InGameController.java
--- freecol-1.1.0.orig/src/net/sf/freecol/server/control/InGameController.java 2023-05-07 12:51:32.000000000 +0200
+++ freecol-1.1.0/src/net/sf/freecol/server/control/InGameController.java 2023-10-01 14:12:09.269000000 +0200
@@ -141,8 +141,6 @@
import net.sf.freecol.server.model.ServerUnit;
import net.sf.freecol.server.model.Session;
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
-
/**
* The main server controller.
@@ -3036,7 +3034,6 @@
* @param nt The {@code NativeTrade} underway.
* @return A {@code ChangeSet} encapsulating this action.
*/
- @SuppressFBWarnings(value="SF_SWITCH_FALLTHROUGH")
public ChangeSet nativeTrade(ServerPlayer serverPlayer,
NativeTradeAction action, NativeTrade nt) {
final ServerUnit unit = (ServerUnit)nt.getUnit();
@@ -3341,7 +3338,6 @@
* @param arrangements A list of {@code Arrangement}s to apply.
* @return A {@code ChangeSet} encapsulating this action.
*/
- @SuppressFBWarnings(value="SF_SWITCH_FALLTHROUGH")
public ChangeSet rearrangeColony(ServerPlayer serverPlayer, Colony colony,
List<Arrangement> arrangements) {
final Role defaultRole = getGame().getSpecification().getDefaultRole();
diff -uNr freecol-1.1.0.orig/src/net/sf/freecol/server/model/ServerPlayer.java freecol-1.1.0/src/net/sf/freecol/server/model/ServerPlayer.java
--- freecol-1.1.0.orig/src/net/sf/freecol/server/model/ServerPlayer.java 2023-05-07 12:51:32.000000000 +0200
+++ freecol-1.1.0/src/net/sf/freecol/server/model/ServerPlayer.java 2023-10-01 14:12:13.160000000 +0200
@@ -61,7 +61,6 @@
import javax.xml.stream.XMLStreamException;
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import net.sf.freecol.FreeCol;
import net.sf.freecol.client.ClientOptions;
import net.sf.freecol.common.FreeColException;
@@ -2195,7 +2194,6 @@
* @param random A pseudo-random number source.
* @param cs A {@code ChangeSet} to update.
*/
- @SuppressFBWarnings(value="SF_SWITCH_FALLTHROUGH")
public void csEmigrate(int slot, MigrationType type, Random random,
ChangeSet cs) {
// Create the recruit, move it to the docks.