Skip to content

Commit

Permalink
Fixed type safety warnings for json plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
ascl committed Dec 21, 2008
1 parent c4fe51b commit 19062fa
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion plugins/json/src/org/json/CookieList.java
Expand Up @@ -51,7 +51,7 @@ public static JSONObject toJSONObject(String string)
*/
public static String toString(JSONObject o) {
boolean b = false;
Iterator keys = o.keys();
Iterator<String> keys = o.keys();
String s;
StringBuffer sb = new StringBuffer();
while (keys.hasNext()) {
Expand Down
2 changes: 1 addition & 1 deletion plugins/json/src/org/json/HTTP.java
Expand Up @@ -107,7 +107,7 @@ public static JSONObject toJSONObject(String string) throws ParseException {
* information.
*/
public static String toString(JSONObject o) throws NoSuchElementException {
Iterator keys = o.keys();
Iterator<String> keys = o.keys();
String s;
StringBuffer sb = new StringBuffer();
if (o.has("Status-Code") && o.has("Reason-Phrase")) {
Expand Down
10 changes: 5 additions & 5 deletions plugins/json/src/org/json/JSONArray.java
Expand Up @@ -47,14 +47,14 @@ public class JSONArray {
/**
* The getArrayList where the JSONArray's properties are kept.
*/
private ArrayList myArrayList;
private ArrayList<Object> myArrayList;


/**
* Construct an empty JSONArray.
*/
public JSONArray() {
myArrayList = new ArrayList();
myArrayList = new ArrayList<Object>();
}


Expand Down Expand Up @@ -113,8 +113,8 @@ public JSONArray(String string) throws ParseException {
* Construct a JSONArray from a Collection.
* @param collection A Collection.
*/
public JSONArray(Collection collection) {
myArrayList = new ArrayList(collection);
public JSONArray(Collection<Object> collection) {
myArrayList = new ArrayList<Object>(collection);
}


Expand All @@ -139,7 +139,7 @@ public Object get(int index) throws NoSuchElementException {
* Get the ArrayList which is holding the elements of the JSONArray.
* @return The ArrayList.
*/
ArrayList getArrayList() {
ArrayList<Object> getArrayList() {
return myArrayList;
}

Expand Down
18 changes: 9 additions & 9 deletions plugins/json/src/org/json/JSONObject.java
Expand Up @@ -92,7 +92,7 @@ public String toString() {
/**
* The hash map where the JSONObject's properties are kept.
*/
private HashMap myHashMap;
private HashMap<String, Object> myHashMap;

/**
* It is sometimes more convenient and less ambiguous to have a NULL
Expand All @@ -106,7 +106,7 @@ public String toString() {
* Construct an empty JSONObject.
*/
public JSONObject() {
myHashMap = new HashMap();
myHashMap = new HashMap<String, Object>();
}


Expand Down Expand Up @@ -175,8 +175,8 @@ public JSONObject(String string) throws ParseException {
* @param map A map object that can be used to initialize the contents of
* the JSONObject.
*/
public JSONObject(Map map) {
myHashMap = new HashMap(map);
public JSONObject(Map<String, Object> map) {
myHashMap = new HashMap<String, Object>(map);
}


Expand Down Expand Up @@ -278,7 +278,7 @@ public double getDouble(String key)
* Get the HashMap the holds that contents of the JSONObject.
* @return The getHashMap.
*/
HashMap getHashMap() {
HashMap<String, Object> getHashMap() {
return myHashMap;
}

Expand Down Expand Up @@ -373,7 +373,7 @@ public boolean isNull(String key) {
*
* @return An iterator of the keys.
*/
public Iterator keys() {
public Iterator<String> keys() {
return myHashMap.keySet().iterator();
}

Expand All @@ -396,7 +396,7 @@ public int length() {
*/
public JSONArray names() {
JSONArray ja = new JSONArray();
Iterator keys = keys();
Iterator<String> keys = keys();
while (keys.hasNext()) {
ja.put(keys.next());
}
Expand Down Expand Up @@ -805,7 +805,7 @@ public JSONArray toJSONArray(JSONArray names) {
* with <code>}</code>&nbsp;<small>(right brace)</small>.
*/
public String toString() {
Iterator keys = keys();
Iterator<String> keys = keys();
Object o = null;
String s;
StringBuffer sb = new StringBuffer();
Expand Down Expand Up @@ -864,7 +864,7 @@ public String toString(int indentFactor) {
*/
String toString(int indentFactor, int indent) {
int i;
Iterator keys = keys();
Iterator<String> keys = keys();
String pad = "";
StringBuffer sb = new StringBuffer();
indent += indentFactor;
Expand Down
2 changes: 1 addition & 1 deletion plugins/json/src/org/json/XML.java
Expand Up @@ -266,7 +266,7 @@ public static String toString(Object o, String tagName) {
JSONArray ja;
JSONObject jo;
String k;
Iterator keys;
Iterator<String> keys;
int len;
String s;
Object v;
Expand Down
4 changes: 2 additions & 2 deletions plugins/json/src/org/json/XMLTokener.java
Expand Up @@ -16,10 +16,10 @@ public class XMLTokener extends JSONTokener
/** The table of entity values. It initially contains Character values for
* amp, apos, gt, lt, quot.
*/
private static final HashMap entity;
private static final HashMap<String, Character> entity;

static {
entity = new HashMap(8);
entity = new HashMap<String, Character>(8);
entity.put("amp", XML.AMP);
entity.put("apos", XML.APOS);
entity.put("gt", XML.GT);
Expand Down

0 comments on commit 19062fa

Please sign in to comment.