From 2954541fdd6bd419c43e861c187f4f384996b54d Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Thu, 13 Feb 2014 13:16:39 +0000 Subject: [PATCH] java: Avoid warnings in the tests and examples. Avoid warnings about missing serial version, and fix a warning about raw types. --- java/examples/CreateDisk.java | 3 ++- java/examples/InspectVM.java | 5 +++-- java/t/GuestFS070OptArgs.java | 18 +++++++++++------- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/java/examples/CreateDisk.java b/java/examples/CreateDisk.java index 83e0ff621..f89bf3b49 100644 --- a/java/examples/CreateDisk.java +++ b/java/examples/CreateDisk.java @@ -23,7 +23,8 @@ public class CreateDisk g.set_trace (true); // Attach the disk image to libguestfs. - Map optargs = new HashMap() { + @SuppressWarnings("serial") Map optargs = + new HashMap() { { put ("format", "raw"); put ("readonly", Boolean.FALSE); diff --git a/java/examples/InspectVM.java b/java/examples/InspectVM.java index d92aa70f6..e11e59ae8 100644 --- a/java/examples/InspectVM.java +++ b/java/examples/InspectVM.java @@ -28,7 +28,8 @@ public class InspectVM GuestFS g = new GuestFS (); // Attach the disk image read-only to libguestfs. - Map optargs = new HashMap() { + @SuppressWarnings("serial") Map optargs = + new HashMap() { { //put ("format", "raw"); put ("readonly", Boolean.TRUE); @@ -65,7 +66,7 @@ public class InspectVM // Sort keys by length, shortest first, so that we end up // mounting the filesystems in the correct order. Map mps = g.inspect_get_mountpoints (root); - List mps_keys = new ArrayList (mps.keySet ()); + List mps_keys = new ArrayList (mps.keySet ()); Collections.sort (mps_keys, COMPARE_KEYS_LEN); for (String mp : mps_keys) { diff --git a/java/t/GuestFS070OptArgs.java b/java/t/GuestFS070OptArgs.java index a1af95f7b..f83e6fef4 100644 --- a/java/t/GuestFS070OptArgs.java +++ b/java/t/GuestFS070OptArgs.java @@ -29,31 +29,35 @@ public class GuestFS070OptArgs g.add_drive ("/dev/null"); - HashMap optargs; - - optargs = new HashMap() { + @SuppressWarnings("serial") + HashMap optargs = + new HashMap() { { put ("readonly", Boolean.TRUE); } }; g.add_drive ("/dev/null", optargs); - optargs = new HashMap() { + @SuppressWarnings("serial") + HashMap optargs2 = + new HashMap() { { put ("readonly", Boolean.TRUE); put ("format", "raw"); } }; - g.add_drive ("/dev/null", optargs); + g.add_drive ("/dev/null", optargs2); - optargs = new HashMap() { + @SuppressWarnings("serial") + HashMap optargs3 = + new HashMap() { { put ("readonly", Boolean.TRUE); put ("format", "raw"); put ("iface", "virtio"); } }; - g.add_drive ("/dev/null", optargs); + g.add_drive ("/dev/null", optargs3); } catch (Exception exn) { System.err.println (exn);