Fixed bug 158

This commit is contained in:
Inderjeet Singh 2009-09-23 17:17:03 +00:00
parent c5812bb485
commit 29ab864b2f

View File

@ -441,9 +441,10 @@ public final class Gson {
* @throws JsonParseException if json is not a valid representation for an object of type typeOfT * @throws JsonParseException if json is not a valid representation for an object of type typeOfT
* @since 1.2 * @since 1.2
*/ */
@SuppressWarnings("unchecked")
public <T> T fromJson(Reader json, Type typeOfT) throws JsonParseException { public <T> T fromJson(Reader json, Type typeOfT) throws JsonParseException {
JsonElement root = new JsonParser().parse(json); JsonElement root = new JsonParser().parse(json);
T target = fromJson(root, typeOfT); T target = (T) fromJson(root, typeOfT);
return target; return target;
} }