From 1b64cd11de45b9fa2e8a3fbabb0cb05023ca2b0b Mon Sep 17 00:00:00 2001
From: Georg Seibt <seibt@fim.uni-passau.de>
Date: Mon, 7 Nov 2016 16:45:48 +0100
Subject: [PATCH] fix compiler warnings, add Xlint:all to compiler flags

---
 build.gradle                                  |  4 ++++
 .../gitwrapper/process/ProcessExecutor.java   | 22 -------------------
 .../process/ToolNotWorkingException.java      |  2 ++
 .../fim/seibt/gitwrapper/repo/GitWrapper.java |  4 ++--
 4 files changed, 8 insertions(+), 24 deletions(-)

diff --git a/build.gradle b/build.gradle
index a23f452..454342e 100644
--- a/build.gradle
+++ b/build.gradle
@@ -28,4 +28,8 @@ idea {
         downloadJavadoc = true
         downloadSources = true
     }
+}
+
+compileJava {
+    options.compilerArgs << "-Xlint:all"
 }
\ No newline at end of file
diff --git a/src/de/uni_passau/fim/seibt/gitwrapper/process/ProcessExecutor.java b/src/de/uni_passau/fim/seibt/gitwrapper/process/ProcessExecutor.java
index 380b919..36e2bef 100644
--- a/src/de/uni_passau/fim/seibt/gitwrapper/process/ProcessExecutor.java
+++ b/src/de/uni_passau/fim/seibt/gitwrapper/process/ProcessExecutor.java
@@ -242,26 +242,4 @@ public class ProcessExecutor {
             return Optional.empty();
         }
     }
-
-    /**
-     * Returns a modifiable {@link LinkedList} containing the given elements.
-     *
-     * @param ts
-     *         the elements to return in a {@link LinkedList}
-     * @param <T>
-     *         the type of the elements
-     * @return a {@link LinkedList} containing the elements
-     */
-    @SafeVarargs
-    public static <T> LinkedList<T> asList(T... ts) {
-        LinkedList<T> l = new LinkedList<>(); // we expect things to be inserted in front and back
-
-        if (ts == null) {
-            return l;
-        }
-
-        Collections.addAll(l, ts);
-
-        return l;
-    }
 }
diff --git a/src/de/uni_passau/fim/seibt/gitwrapper/process/ToolNotWorkingException.java b/src/de/uni_passau/fim/seibt/gitwrapper/process/ToolNotWorkingException.java
index 1150130..efd5f2e 100644
--- a/src/de/uni_passau/fim/seibt/gitwrapper/process/ToolNotWorkingException.java
+++ b/src/de/uni_passau/fim/seibt/gitwrapper/process/ToolNotWorkingException.java
@@ -5,6 +5,8 @@ package de.uni_passau.fim.seibt.gitwrapper.process;
  */
 public class ToolNotWorkingException extends Exception {
 
+    private static final long serialVersionUID = 1L;
+
     public ToolNotWorkingException() {}
 
     public ToolNotWorkingException(String message) {
diff --git a/src/de/uni_passau/fim/seibt/gitwrapper/repo/GitWrapper.java b/src/de/uni_passau/fim/seibt/gitwrapper/repo/GitWrapper.java
index d9bf376..5f6304a 100644
--- a/src/de/uni_passau/fim/seibt/gitwrapper/repo/GitWrapper.java
+++ b/src/de/uni_passau/fim/seibt/gitwrapper/repo/GitWrapper.java
@@ -25,7 +25,7 @@ import de.uni_passau.fim.seibt.gitwrapper.process.ProcessExecutor.ExecRes;
 import de.uni_passau.fim.seibt.gitwrapper.process.ToolNotWorkingException;
 import de.uni_passau.fim.seibt.gitwrapper.process.ToolWrapper;
 
-import static de.uni_passau.fim.seibt.gitwrapper.process.ProcessExecutor.asList;
+import static java.util.Collections.singletonList;
 
 /**
  * A wrapper for executing git commands.
@@ -77,7 +77,7 @@ public class GitWrapper extends ToolWrapper {
     @Override
     protected boolean isWorking() {
         Function<ExecRes, Boolean> checkPrefix = execRes -> execRes.getStdOutTrimmed().startsWith(GIT_VERSION_PREFIX);
-        return exec(new File("."), true, asList(GIT_VERSION_C)).map(checkPrefix).orElse(false);
+        return exec(new File("."), true, singletonList(GIT_VERSION_C)).map(checkPrefix).orElse(false);
     }
 
     /**
-- 
GitLab