Remove unused parseJSON method
Gerrit stopped using its custom parseJSON helper and started using JSONParser.parseStrict instead in v2.6-rc0~778 (Fix JSON parser in RestApi client, 2012-11-21). Change-Id: I1be4a481951a87bb3a9d255d238aef638d2ab9b5
This commit is contained in:
parent
3da3b8d05d
commit
d2b80ce67d
@ -91,34 +91,6 @@ public class Natives {
|
||||
return arr;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <T extends JavaScriptObject> T parseJSON(String json) {
|
||||
if (json.startsWith("\"")) {
|
||||
return (T) NativeString.wrap(parseString(parser, json));
|
||||
}
|
||||
return Natives.<T> parseObject(parser, json); // javac generics bug
|
||||
}
|
||||
|
||||
private static native <T extends JavaScriptObject>
|
||||
T parseObject(JavaScriptObject p, String s)
|
||||
/*-{ return p(s); }-*/;
|
||||
|
||||
private static native
|
||||
String parseString(JavaScriptObject p, String s)
|
||||
/*-{ return p(s); }-*/;
|
||||
|
||||
private static JavaScriptObject parser;
|
||||
private static native JavaScriptObject bestJsonParser()
|
||||
/*-{
|
||||
if ($wnd.JSON && typeof $wnd.JSON.parse === 'function')
|
||||
return $wnd.JSON.parse;
|
||||
return function(s) { return eval('(' + s + ')'); };
|
||||
}-*/;
|
||||
|
||||
static {
|
||||
parser = bestJsonParser();
|
||||
}
|
||||
|
||||
private Natives() {
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user