Cleaned up warnings

This commit is contained in:
moandji.ezana 2015-02-08 23:28:09 +02:00
parent 7b7906d0ed
commit 4615ed50f7
2 changed files with 3 additions and 5 deletions

View file

@ -18,7 +18,6 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.regex.Pattern;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.JsonElement; import com.google.gson.JsonElement;
@ -43,7 +42,6 @@ import com.google.gson.JsonElement;
public class Toml { public class Toml {
private static final Gson DEFAULT_GSON = new Gson(); private static final Gson DEFAULT_GSON = new Gson();
private static final Pattern ARRAY_INDEX_PATTERN = Pattern.compile("(.*)\\[(\\d+)\\]");
private Map<String, Object> values = new HashMap<String, Object>(); private Map<String, Object> values = new HashMap<String, Object>();
private final Toml defaults; private final Toml defaults;
@ -143,8 +141,8 @@ public class Toml {
return (Long) get(key); return (Long) get(key);
} }
@SuppressWarnings("unchecked")
public <T> List<T> getList(String key) { public <T> List<T> getList(String key) {
@SuppressWarnings("unchecked")
List<T> list = (List<T>) get(key); List<T> list = (List<T>) get(key);
if (list == null) { if (list == null) {

View file

@ -108,8 +108,8 @@ public class RealWorldTest {
assertFalse(toml.getBoolean("Booleans.False")); assertFalse(toml.getBoolean("Booleans.False"));
assertThat(toml.<Long>getList("Array.key1"), contains(1L, 2L, 3L)); assertThat(toml.<Long>getList("Array.key1"), contains(1L, 2L, 3L));
assertThat(toml.<String>getList("Array.key2"), contains("red", "yellow", "green")); assertThat(toml.<String>getList("Array.key2"), contains("red", "yellow", "green"));
assertEquals(asList(asList(1L, 2L), asList(3L, 4L, 5L)), toml.<List>getList("Array.key3")); assertEquals(asList(asList(1L, 2L), asList(3L, 4L, 5L)), toml.<List<Long>>getList("Array.key3"));
assertEquals(asList(asList(1L, 2L), asList("a", "b", "c")), toml.<List>getList("Array.key4")); assertEquals(asList(asList(1L, 2L), asList("a", "b", "c")), toml.<List<Long>>getList("Array.key4"));
assertThat(toml.<Long>getList("Array.key5"), contains(1L, 2L, 3L)); assertThat(toml.<Long>getList("Array.key5"), contains(1L, 2L, 3L));
assertThat(toml.<Long>getList("Array.key6"), contains(1L, 2L)); assertThat(toml.<Long>getList("Array.key6"), contains(1L, 2L));
assertEquals("Hammer", toml.getString("products[0].name")); assertEquals("Hammer", toml.getString("products[0].name"));