Hi guys,
It is a long time since I participated on the project but I would like
to jump in again. :)
I'm pretty used to Eclipse IDE but when I tried to get git.1756c04
working, IDE complained about type safety on some things in
ChooseFoundingFatherMessage.java.
I fixed this by adding necessary generics to static method calls and
tweaked few other lines a bit and IDE build now works which could be,
in turn, more pleasant for other developers.
Quick check and two played games did not show any errors, so I made it
to a patch.
Would you mind to take a look at it?
Thanks in advance,
Fiisch
From 4d1e14d2d4058ef34945b9fd79ed4b55f2424760 Mon Sep 17 00:00:00 2001
From: Petr Fiser <pries...@gmail.com>
Date: Sun, 1 May 2016 16:11:39 +0200
Subject: [PATCH] added type safety to ChooseFoundingFathers construstor, minor
cleanup
---
.../freecol/common/networking/ChooseFoundingFatherMessage.java | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/src/net/sf/freecol/common/networking/ChooseFoundingFatherMessage.java b/src/net/sf/freecol/common/networking/ChooseFoundingFatherMessage.java
index ec38ee1..e5832bd 100644
--- a/src/net/sf/freecol/common/networking/ChooseFoundingFatherMessage.java
+++ b/src/net/sf/freecol/common/networking/ChooseFoundingFatherMessage.java
@@ -28,7 +28,7 @@ import net.sf.freecol.common.model.FoundingFather.FoundingFatherType;
import net.sf.freecol.common.model.Game;
import net.sf.freecol.common.model.Player;
import net.sf.freecol.common.model.Specification;
-import static net.sf.freecol.common.util.CollectionUtils.*;
+import net.sf.freecol.common.util.CollectionUtils;
import net.sf.freecol.server.FreeColServer;
import net.sf.freecol.server.model.ServerPlayer;
@@ -77,8 +77,10 @@ public class ChooseFoundingFatherMessage extends DOMMessage {
super(getTagName());
final Specification spec = game.getSpecification();
- this.fathers = transform(map(FoundingFatherType.values(),
- ft -> element.getAttribute(ft.toString())),
+ this.fathers = CollectionUtils.<String,FoundingFather,List<FoundingFather>>transform(
+ CollectionUtils.<FoundingFatherType,String>map(FoundingFatherType.values(),
+ ft -> element.getAttribute(ft.toString())
+ ),
id -> id != null && !id.isEmpty(),
id -> spec.getFoundingFather(id),
Collectors.toList());
@@ -163,7 +165,7 @@ public class ChooseFoundingFatherMessage extends DOMMessage {
public Element toXMLElement() {
return new DOMMessage(getTagName(),
FOUNDING_FATHER_TAG, this.foundingFatherId)
- .setAttributes(toMap(getFathers(),
+ .setAttributes(CollectionUtils.toMap(getFathers(),
f -> f.getType().toString(), f -> f.getId()))
.toXMLElement();
}
--
2.6.6
------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
Freecol-developers mailing list
Freecol-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freecol-developers