diff --git a/src/main/java/org/to2mbn/authlibinjector/internal/org/json/simple/JSONArray.java b/src/main/java/org/to2mbn/authlibinjector/internal/org/json/simple/JSONArray.java index 8270704..b0efd77 100644 --- a/src/main/java/org/to2mbn/authlibinjector/internal/org/json/simple/JSONArray.java +++ b/src/main/java/org/to2mbn/authlibinjector/internal/org/json/simple/JSONArray.java @@ -16,7 +16,7 @@ import java.util.Iterator; * * @author FangYidong */ -public class JSONArray extends ArrayList implements JSONAware, JSONStreamAware { +public class JSONArray extends ArrayList implements JSONAware, JSONStreamAware { private static final long serialVersionUID = 3957988303675231981L; /** @@ -33,27 +33,27 @@ public class JSONArray extends ArrayList implements JSONAware, JSONStreamAware { * @param c * the collection whose elements are to be placed into this JSONArray */ - public JSONArray(Collection c) { + public JSONArray(Collection c) { super(c); } /** * Encode a list into JSON text and write it to out. * If this list is also a JSONStreamAware or a JSONAware, JSONStreamAware and JSONAware specific behaviours will be ignored at this top level. - * + * * @see org.to2mbn.authlibinjector.internal.org.json.simple.JSONValue#writeJSONString(Object, Writer) - * + * * @param collection * @param out */ - public static void writeJSONString(Collection collection, Writer out) throws IOException { + public static void writeJSONString(Collection collection, Writer out) throws IOException { if (collection == null) { out.write("null"); return; } boolean first = true; - Iterator iter = collection.iterator(); + Iterator iter = collection.iterator(); out.write('['); while (iter.hasNext()) { @@ -87,7 +87,7 @@ public class JSONArray extends ArrayList implements JSONAware, JSONStreamAware { * @param collection * @return JSON text, or "null" if list is null. */ - public static String toJSONString(Collection collection) { + public static String toJSONString(Collection collection) { final StringWriter writer = new StringWriter(); try { diff --git a/src/main/java/org/to2mbn/authlibinjector/internal/org/json/simple/JSONObject.java b/src/main/java/org/to2mbn/authlibinjector/internal/org/json/simple/JSONObject.java index 26d1556..12b2df3 100644 --- a/src/main/java/org/to2mbn/authlibinjector/internal/org/json/simple/JSONObject.java +++ b/src/main/java/org/to2mbn/authlibinjector/internal/org/json/simple/JSONObject.java @@ -16,7 +16,7 @@ import java.util.Map; * * @author FangYidong */ -public class JSONObject extends HashMap implements Map, JSONAware, JSONStreamAware { +public class JSONObject extends HashMap implements JSONAware, JSONStreamAware { private static final long serialVersionUID = -503443796854799292L; @@ -30,27 +30,27 @@ public class JSONObject extends HashMap implements Map, JSONAware, JSONStreamAwa * * @param map */ - public JSONObject(Map map) { + public JSONObject(Map map) { super(map); } /** * Encode a map into JSON text and write it to out. * If this map is also a JSONAware or JSONStreamAware, JSONAware or JSONStreamAware specific behaviours will be ignored at this top level. - * + * * @see org.to2mbn.authlibinjector.internal.org.json.simple.JSONValue#writeJSONString(Object, Writer) - * + * * @param map * @param out */ - public static void writeJSONString(Map map, Writer out) throws IOException { + public static void writeJSONString(Map map, Writer out) throws IOException { if (map == null) { out.write("null"); return; } boolean first = true; - Iterator iter = map.entrySet().iterator(); + Iterator> iter = map.entrySet().iterator(); out.write('{'); while (iter.hasNext()) { @@ -58,7 +58,7 @@ public class JSONObject extends HashMap implements Map, JSONAware, JSONStreamAwa first = false; else out.write(','); - Map.Entry entry = (Map.Entry) iter.next(); + Map.Entry entry = iter.next(); out.write('\"'); out.write(escape(String.valueOf(entry.getKey()))); out.write('\"'); @@ -82,7 +82,7 @@ public class JSONObject extends HashMap implements Map, JSONAware, JSONStreamAwa * @param map * @return JSON text, or "null" if map is null. */ - public static String toJSONString(Map map) { + public static String toJSONString(Map map) { final StringWriter writer = new StringWriter(); try { diff --git a/src/main/java/org/to2mbn/authlibinjector/internal/org/json/simple/JSONValue.java b/src/main/java/org/to2mbn/authlibinjector/internal/org/json/simple/JSONValue.java index 35e8493..49aa8df 100644 --- a/src/main/java/org/to2mbn/authlibinjector/internal/org/json/simple/JSONValue.java +++ b/src/main/java/org/to2mbn/authlibinjector/internal/org/json/simple/JSONValue.java @@ -109,10 +109,10 @@ public class JSONValue { *

* DO NOT call this method from writeJSONString(Writer) of a class that implements both JSONStreamAware and (Map or List) with * "this" as the first parameter, use JSONObject.writeJSONString(Map, Writer) or JSONArray.writeJSONString(List, Writer) instead. - * + * * @see org.to2mbn.authlibinjector.internal.org.json.simple.JSONObject#writeJSONString(Map, Writer) * @see org.to2mbn.authlibinjector.internal.org.json.simple.JSONArray#writeJSONString(List, Writer) - * + * * @param value * @param writer */ @@ -166,12 +166,12 @@ public class JSONValue { } if (value instanceof Map) { - JSONObject.writeJSONString((Map) value, out); + JSONObject.writeJSONString((Map) value, out); return; } if (value instanceof Collection) { - JSONArray.writeJSONString((Collection) value, out); + JSONArray.writeJSONString((Collection) value, out); return; } @@ -251,7 +251,7 @@ public class JSONValue { /** * Escape quotes, \, /, \r, \n, \b, \f, \t and other control characters (U+0000 through U+001F). - * + * * @param s * @return */ diff --git a/src/main/java/org/to2mbn/authlibinjector/internal/org/json/simple/parser/ContainerFactory.java b/src/main/java/org/to2mbn/authlibinjector/internal/org/json/simple/parser/ContainerFactory.java index aa59b9e..daaf519 100644 --- a/src/main/java/org/to2mbn/authlibinjector/internal/org/json/simple/parser/ContainerFactory.java +++ b/src/main/java/org/to2mbn/authlibinjector/internal/org/json/simple/parser/ContainerFactory.java @@ -14,10 +14,10 @@ public interface ContainerFactory { /** * @return A Map instance to store JSON object, or null if you want to use org.json.simple.JSONObject. */ - Map createObjectContainer(); + Map createObjectContainer(); /** * @return A List instance to store JSON array, or null if you want to use org.json.simple.JSONArray. */ - List creatArrayContainer(); + List creatArrayContainer(); } diff --git a/src/main/java/org/to2mbn/authlibinjector/internal/org/json/simple/parser/JSONParser.java b/src/main/java/org/to2mbn/authlibinjector/internal/org/json/simple/parser/JSONParser.java index 3fe48c6..dd1dfd3 100644 --- a/src/main/java/org/to2mbn/authlibinjector/internal/org/json/simple/parser/JSONParser.java +++ b/src/main/java/org/to2mbn/authlibinjector/internal/org/json/simple/parser/JSONParser.java @@ -28,15 +28,15 @@ public class JSONParser { public static final int S_END = 6; public static final int S_IN_ERROR = -1; - private LinkedList handlerStatusStack; + private LinkedList handlerStatusStack; private Yylex lexer = new Yylex((Reader) null); private Yytoken token = null; private int status = S_INIT; - private int peekStatus(LinkedList statusStack) { + private int peekStatus(LinkedList statusStack) { if (statusStack.size() == 0) return -1; - Integer status = (Integer) statusStack.getFirst(); + Integer status = statusStack.getFirst(); return status.intValue(); } @@ -52,7 +52,7 @@ public class JSONParser { /** * Reset the parser to the initial state with a new character reader. - * + * * @param in * - The new character reader. * @throws IOException @@ -92,7 +92,7 @@ public class JSONParser { /** * Parse JSON text into java object from the input source. - * + * * @param in * @param containerFactory * - Use this factory to createyour own JSON object and JSON array containers. @@ -109,8 +109,8 @@ public class JSONParser { */ public Object parse(Reader in, ContainerFactory containerFactory) throws IOException, ParseException { reset(in); - LinkedList statusStack = new LinkedList(); - LinkedList valueStack = new LinkedList(); + LinkedList statusStack = new LinkedList<>(); + LinkedList valueStack = new LinkedList<>(); try { do { @@ -180,15 +180,15 @@ public class JSONParser { case Yytoken.TYPE_VALUE: statusStack.removeFirst(); String key = (String) valueStack.removeFirst(); - Map parent = (Map) valueStack.getFirst(); + Map parent = (Map) valueStack.getFirst(); parent.put(key, token.value); status = peekStatus(statusStack); break; case Yytoken.TYPE_LEFT_SQUARE: statusStack.removeFirst(); key = (String) valueStack.removeFirst(); - parent = (Map) valueStack.getFirst(); - List newArray = createArrayContainer(containerFactory); + parent = (Map) valueStack.getFirst(); + List newArray = createArrayContainer(containerFactory); parent.put(key, newArray); status = S_IN_ARRAY; statusStack.addFirst(new Integer(status)); @@ -197,8 +197,8 @@ public class JSONParser { case Yytoken.TYPE_LEFT_BRACE: statusStack.removeFirst(); key = (String) valueStack.removeFirst(); - parent = (Map) valueStack.getFirst(); - Map newObject = createObjectContainer(containerFactory); + parent = (Map) valueStack.getFirst(); + Map newObject = createObjectContainer(containerFactory); parent.put(key, newObject); status = S_IN_OBJECT; statusStack.addFirst(new Integer(status)); @@ -214,7 +214,7 @@ public class JSONParser { case Yytoken.TYPE_COMMA: break; case Yytoken.TYPE_VALUE: - List val = (List) valueStack.getFirst(); + List val = (List) valueStack.getFirst(); val.add(token.value); break; case Yytoken.TYPE_RIGHT_SQUARE: @@ -227,16 +227,16 @@ public class JSONParser { } break; case Yytoken.TYPE_LEFT_BRACE: - val = (List) valueStack.getFirst(); - Map newObject = createObjectContainer(containerFactory); + val = (List) valueStack.getFirst(); + Map newObject = createObjectContainer(containerFactory); val.add(newObject); status = S_IN_OBJECT; statusStack.addFirst(new Integer(status)); valueStack.addFirst(newObject); break; case Yytoken.TYPE_LEFT_SQUARE: - val = (List) valueStack.getFirst(); - List newArray = createArrayContainer(containerFactory); + val = (List) valueStack.getFirst(); + List newArray = createArrayContainer(containerFactory); val.add(newArray); status = S_IN_ARRAY; statusStack.addFirst(new Integer(status)); @@ -266,20 +266,20 @@ public class JSONParser { token = new Yytoken(Yytoken.TYPE_EOF, null); } - private Map createObjectContainer(ContainerFactory containerFactory) { + private Map createObjectContainer(ContainerFactory containerFactory) { if (containerFactory == null) return new JSONObject(); - Map m = containerFactory.createObjectContainer(); + Map m = containerFactory.createObjectContainer(); if (m == null) return new JSONObject(); return m; } - private List createArrayContainer(ContainerFactory containerFactory) { + private List createArrayContainer(ContainerFactory containerFactory) { if (containerFactory == null) return new JSONArray(); - List l = containerFactory.creatArrayContainer(); + List l = containerFactory.creatArrayContainer(); if (l == null) return new JSONArray(); @@ -324,16 +324,16 @@ public class JSONParser { public void parse(Reader in, ContentHandler contentHandler, boolean isResume) throws IOException, ParseException { if (!isResume) { reset(in); - handlerStatusStack = new LinkedList(); + handlerStatusStack = new LinkedList<>(); } else { if (handlerStatusStack == null) { isResume = false; reset(in); - handlerStatusStack = new LinkedList(); + handlerStatusStack = new LinkedList<>(); } } - LinkedList statusStack = handlerStatusStack; + LinkedList statusStack = handlerStatusStack; try { do {