Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Revert "Let our examples compile with java 1.6, or almost"
authorMartin Quinson <martin.quinson@loria.fr>
Fri, 17 Feb 2017 21:35:34 +0000 (22:35 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Fri, 17 Feb 2017 21:35:48 +0000 (22:35 +0100)
Sonar is actually right to not like that brain overload. Plus, not all
examples were compiling with prehistorical Java anyway.

This reverts commit 848ff1f03de7a300b6314015e5fb4b28348490c4.

examples/java/app/bittorrent/Peer.java
examples/java/app/bittorrent/Tracker.java
examples/java/app/bittorrent/TrackerTask.java
examples/java/app/centralizedmutex/Coordinator.java
examples/java/cloud/masterworker/Master.java
examples/java/cloud/migration/Test.java
examples/java/dht/kademlia/Bucket.java
examples/java/energy/vm/EnergyVMRunner.java

index 649c3b5..0bdc770 100644 (file)
@@ -33,10 +33,10 @@ public class Peer extends Process {
   protected char[][] bitfieldBlocks = new char[Common.FILE_PIECES][Common.PIECES_BLOCKS];
   protected short[] piecesCount = new short[Common.FILE_PIECES];
   protected int piecesRequested = 0;
   protected char[][] bitfieldBlocks = new char[Common.FILE_PIECES][Common.PIECES_BLOCKS];
   protected short[] piecesCount = new short[Common.FILE_PIECES];
   protected int piecesRequested = 0;
-  protected ArrayList<Integer> currentPieces = new ArrayList<Integer>();
+  protected ArrayList<Integer> currentPieces = new ArrayList<>();
   protected int currentPiece = -1;
   protected int currentPiece = -1;
-  protected HashMap<Integer, Connection> activePeers = new HashMap<Integer, Connection>();
-  protected HashMap<Integer, Connection> peers = new HashMap<Integer, Connection>();
+  protected HashMap<Integer, Connection> activePeers = new HashMap<>();
+  protected HashMap<Integer, Connection> peers = new HashMap<>();
   protected Comm commReceived = null;
 
   public Peer(Host host, String name, String[]args) {
   protected Comm commReceived = null;
 
   public Peer(Host host, String name, String[]args) {
index b8126a8..980d9c6 100644 (file)
@@ -36,7 +36,7 @@ public class Tracker extends Process {
     //Retrieve the end time
     deadline = Double.parseDouble(args[0]);
     //Building peers array
     //Retrieve the end time
     deadline = Double.parseDouble(args[0]);
     //Building peers array
-    peersList = new ArrayList<Integer>();
+    peersList = new ArrayList<>();
 
     Msg.info("Tracker launched.");
     while (Msg.getClock() < deadline) {
 
     Msg.info("Tracker launched.");
     while (Msg.getClock() < deadline) {
index ec4ee36..d27a7d7 100644 (file)
@@ -39,6 +39,6 @@ public class TrackerTask extends Task {
     this.uploaded = uploaded;
     this.downloaded = downloaded;
     this.left = left;
     this.uploaded = uploaded;
     this.downloaded = downloaded;
     this.left = left;
-    this.peers = new ArrayList<Integer>();
+    this.peers = new ArrayList<>();
   }
 }
   }
 }
index d6cd28f..1931293 100644 (file)
@@ -14,7 +14,7 @@ import org.simgrid.msg.Process;
 import org.simgrid.msg.MsgException;
 
 public class Coordinator extends Process {
 import org.simgrid.msg.MsgException;
 
 public class Coordinator extends Process {
-  LinkedList<RequestTask> waitingQueue=new LinkedList<RequestTask>();
+  LinkedList<RequestTask> waitingQueue=new LinkedList<>();
   int csToServe;
 
   public Coordinator(Host host, String name, String[]args) {
   int csToServe;
 
   public Coordinator(Host host, String name, String[]args) {
index f2e23e2..c2b95d9 100644 (file)
@@ -25,7 +25,7 @@ public class Master extends Process {
 
   public void main(String[] args) throws MsgException {
     int workersCount = Main.NHOSTS;
 
   public void main(String[] args) throws MsgException {
     int workersCount = Main.NHOSTS;
-    ArrayList<VM> vms = new ArrayList<VM>();
+    ArrayList<VM> vms = new ArrayList<>();
 
     // Create one VM per host and bind a process inside each one. 
     for (int i = 0; i < workersCount; i++) {
 
     // Create one VM per host and bind a process inside each one. 
     for (int i = 0; i < workersCount; i++) {
index 36f98b3..83c8044 100644 (file)
@@ -42,7 +42,7 @@ public class Test extends Process{
       e.printStackTrace();
     }
 
       e.printStackTrace();
     }
 
-    List<VM> vms = new ArrayList<VM>();
+    List<VM> vms = new ArrayList<>();
 
     /* Create VM1 */
     int dpRate = 70;
 
     /* Create VM1 */
     int dpRate = 70;
index c0eaa92..1abceb1 100644 (file)
@@ -12,7 +12,7 @@ public class Bucket {
   private int id;
 
   public Bucket(int id) {
   private int id;
 
   public Bucket(int id) {
-    this.nodes = new ArrayList<Integer>();
+    this.nodes = new ArrayList<>();
     this.id = id;
   }
 
     this.id = id;
   }
 
index 7fa2702..35ccc6a 100644 (file)
@@ -27,7 +27,7 @@ public class EnergyVMRunner extends Process {
       Task  task = new Task(this.getHost().getName()+"-task", 300E6 , 0);
       try {
         task.execute();
       Task  task = new Task(this.getHost().getName()+"-task", 300E6 , 0);
       try {
         task.execute();
-      } catch (HostFailureException | TaskCancelledException e) { // If your compiler fails on that multicatch, please proceed to Java 1.7 or higher
+      } catch (HostFailureException | TaskCancelledException e) {
         Msg.error(e.getMessage());
         e.printStackTrace();
       } 
         Msg.error(e.getMessage());
         e.printStackTrace();
       }