Removed compiler warnings.

This commit is contained in:
Inderjeet Singh 2010-11-03 23:14:42 +00:00
parent 10db917e93
commit 7b99419aea
5 changed files with 13 additions and 7 deletions

View File

@ -36,7 +36,7 @@ public final class JsonSyntaxException extends JsonParseException {
/** /**
* Creates exception with the specified cause. Consider using * Creates exception with the specified cause. Consider using
* {@link #JsonIOException(String, Throwable)} instead if you can describe what happened. * {@link #JsonSyntaxException(String, Throwable)} instead if you can describe what happened.
* *
* @param cause root exception that caused this exception to be thrown. * @param cause root exception that caused this exception to be thrown.
*/ */

View File

@ -41,6 +41,7 @@ final class LruCache<K, V> extends LinkedHashMap<K, V> implements Cache<K, V> {
put(key, value); put(key, value);
} }
@Override
public void clear() { public void clear() {
super.clear(); super.clear();
} }
@ -53,6 +54,7 @@ final class LruCache<K, V> extends LinkedHashMap<K, V> implements Cache<K, V> {
return remove(key); return remove(key);
} }
@Override
public int size() { public int size() {
return super.size(); return super.size();
} }

View File

@ -154,8 +154,8 @@ final class Streams {
appendable.append((char) i); appendable.append((char) i);
} }
@Override public void flush() throws IOException {} @Override public void flush() {}
@Override public void close() throws IOException {} @Override public void close() {}
/** /**
* A mutable char sequence pointing at a single char[]. * A mutable char sequence pointing at a single char[].

View File

@ -564,7 +564,7 @@ public final class JsonReader implements Closeable {
} catch (NumberFormatException ignored) { } catch (NumberFormatException ignored) {
double asDouble = Double.parseDouble(value); // don't catch this NumberFormatException double asDouble = Double.parseDouble(value); // don't catch this NumberFormatException
result = (long) asDouble; result = (long) asDouble;
if ((double) result != asDouble) { if (result != asDouble) {
throw new NumberFormatException(value); throw new NumberFormatException(value);
} }
} }
@ -599,7 +599,7 @@ public final class JsonReader implements Closeable {
} catch (NumberFormatException ignored) { } catch (NumberFormatException ignored) {
double asDouble = Double.parseDouble(value); // don't catch this NumberFormatException double asDouble = Double.parseDouble(value); // don't catch this NumberFormatException
result = (int) asDouble; result = (int) asDouble;
if ((double) result != asDouble) { if (result != asDouble) {
throw new NumberFormatException(value); throw new NumberFormatException(value);
} }
} }
@ -665,6 +665,7 @@ public final class JsonReader implements Closeable {
stack.set(stack.size() - 1, newTop); stack.set(stack.size() - 1, newTop);
} }
@SuppressWarnings("fallthrough")
private JsonToken nextInArray(boolean firstElement) throws IOException { private JsonToken nextInArray(boolean firstElement) throws IOException {
if (firstElement) { if (firstElement) {
replaceTop(JsonScope.NONEMPTY_ARRAY); replaceTop(JsonScope.NONEMPTY_ARRAY);
@ -706,6 +707,7 @@ public final class JsonReader implements Closeable {
} }
} }
@SuppressWarnings("fallthrough")
private JsonToken nextInObject(boolean firstElement) throws IOException { private JsonToken nextInObject(boolean firstElement) throws IOException {
/* /*
* Read delimiters. Either a comma/semicolon separating this and the * Read delimiters. Either a comma/semicolon separating this and the
@ -780,6 +782,7 @@ public final class JsonReader implements Closeable {
return nextValue(); return nextValue();
} }
@SuppressWarnings("fallthrough")
private JsonToken nextValue() throws IOException { private JsonToken nextValue() throws IOException {
int c = nextNonWhitespace(); int c = nextNonWhitespace();
switch (c) { switch (c) {
@ -968,6 +971,7 @@ public final class JsonReader implements Closeable {
* Returns the string up to but not including any delimiter characters. This * Returns the string up to but not including any delimiter characters. This
* does not consume the delimiter character. * does not consume the delimiter character.
*/ */
@SuppressWarnings("fallthrough")
private String nextLiteral() throws IOException { private String nextLiteral() throws IOException {
StringBuilder builder = null; StringBuilder builder = null;
do { do {

View File

@ -97,7 +97,7 @@ public final class JsonReaderTest extends TestCase {
} }
} }
public void testEmptyString() throws IOException { public void testEmptyString() {
try { try {
new JsonReader(new StringReader("")).beginArray(); new JsonReader(new StringReader("")).beginArray();
} catch (IOException expected) { } catch (IOException expected) {
@ -108,7 +108,7 @@ public final class JsonReaderTest extends TestCase {
} }
} }
public void testNoTopLevelObject() throws IOException { public void testNoTopLevelObject() {
try { try {
new JsonReader(new StringReader("true")).nextBoolean(); new JsonReader(new StringReader("true")).nextBoolean();
} catch (IOException expected) { } catch (IOException expected) {