summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2012-03-14 19:29:11 +0000
committerRichard W.M. Jones <rjones@redhat.com>2012-03-14 19:29:11 +0000
commitd042e56f2a21553795c108a5b76a9d5eec219b1b (patch)
tree94af49a84fbe7a89af8d44e2d833f69b6204c45a
parent6b233bd39e8cff7be303a5a82eb0cbb06c0573bc (diff)
downloadlibguestfs-d042e56f2a21553795c108a5b76a9d5eec219b1b.tar.gz
libguestfs-d042e56f2a21553795c108a5b76a9d5eec219b1b.tar.xz
libguestfs-d042e56f2a21553795c108a5b76a9d5eec219b1b.zip
java: Enable -Xlint:all and fix all warnings.
-rw-r--r--configure.ac10
-rw-r--r--generator/generator_bindtests.ml1
-rw-r--r--generator/generator_java.ml2
3 files changed, 12 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index 88ce0fee..e04d4a5c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -961,6 +961,16 @@ if test "x$with_java_home" != "xno"; then
esac
AC_MSG_RESULT([$JAVAC_FLAGS])
+ dnl Extra lint flags?
+ AC_MSG_CHECKING([extra javac lint flags])
+ if $JAVAC -X >/dev/null 2>&1 && \
+ $JAVAC -X 2>&1 | grep -q -- '-Xlint:.*all'; then
+ AC_MSG_RESULT([-Xlint:all])
+ JAVAC_FLAGS="$JAVAC_FLAGS -Xlint:all"
+ else
+ AC_MSG_RESULT([no])
+ fi
+
dnl Where to install jarfiles, jnifiles
if test -z $JAR_INSTALL_DIR; then
JAR_INSTALL_DIR=\${prefix}/share/java
diff --git a/generator/generator_bindtests.ml b/generator/generator_bindtests.ml
index cf4210a8..76e5f384 100644
--- a/generator/generator_bindtests.ml
+++ b/generator/generator_bindtests.ml
@@ -427,6 +427,7 @@ import java.util.Map;
import java.util.HashMap;
import com.redhat.et.libguestfs.*;
+@SuppressWarnings(\"serial\")
public class Bindtests {
public static void main (String[] argv)
{
diff --git a/generator/generator_java.ml b/generator/generator_java.ml
index d95bd597..b31e3553 100644
--- a/generator/generator_java.ml
+++ b/generator/generator_java.ml
@@ -173,7 +173,7 @@ public class GuestFS {
generate_java_call_args ~handle:"g" style;
pr ";\n";
pr "\n";
- pr " HashMap rhash = new HashMap ();\n";
+ pr " HashMap<String, String> rhash = new HashMap<String, String> ();\n";
pr " for (int i = 0; i < r.length; i += 2)\n";
pr " rhash.put (r[i], r[i+1]);\n";
pr " return rhash;\n"