Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace deprecated constructors #147

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 18 additions & 18 deletions src/main/java/org/json/simple/parser/JSONParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -121,17 +121,17 @@ public Object parse(Reader in, ContainerFactory containerFactory) throws IOExcep
switch(token.type){
case Yytoken.TYPE_VALUE:
status=S_IN_FINISHED_VALUE;
statusStack.addFirst(new Integer(status));
statusStack.addFirst(Integer.valueOf(status));
valueStack.addFirst(token.value);
break;
case Yytoken.TYPE_LEFT_BRACE:
status=S_IN_OBJECT;
statusStack.addFirst(new Integer(status));
statusStack.addFirst(Integer.valueOf(status));
valueStack.addFirst(createObjectContainer(containerFactory));
break;
case Yytoken.TYPE_LEFT_SQUARE:
status=S_IN_ARRAY;
statusStack.addFirst(new Integer(status));
statusStack.addFirst(Integer.valueOf(status));
valueStack.addFirst(createArrayContainer(containerFactory));
break;
default:
Expand All @@ -154,7 +154,7 @@ public Object parse(Reader in, ContainerFactory containerFactory) throws IOExcep
String key=(String)token.value;
valueStack.addFirst(key);
status=S_PASSED_PAIR_KEY;
statusStack.addFirst(new Integer(status));
statusStack.addFirst(Integer.valueOf(status));
}
else{
status=S_IN_ERROR;
Expand Down Expand Up @@ -194,7 +194,7 @@ public Object parse(Reader in, ContainerFactory containerFactory) throws IOExcep
List newArray=createArrayContainer(containerFactory);
parent.put(key,newArray);
status=S_IN_ARRAY;
statusStack.addFirst(new Integer(status));
statusStack.addFirst(Integer.valueOf(status));
valueStack.addFirst(newArray);
break;
case Yytoken.TYPE_LEFT_BRACE:
Expand All @@ -204,7 +204,7 @@ public Object parse(Reader in, ContainerFactory containerFactory) throws IOExcep
Map newObject=createObjectContainer(containerFactory);
parent.put(key,newObject);
status=S_IN_OBJECT;
statusStack.addFirst(new Integer(status));
statusStack.addFirst(Integer.valueOf(status));
valueStack.addFirst(newObject);
break;
default:
Expand Down Expand Up @@ -235,15 +235,15 @@ public Object parse(Reader in, ContainerFactory containerFactory) throws IOExcep
Map newObject=createObjectContainer(containerFactory);
val.add(newObject);
status=S_IN_OBJECT;
statusStack.addFirst(new Integer(status));
statusStack.addFirst(Integer.valueOf(status));
valueStack.addFirst(newObject);
break;
case Yytoken.TYPE_LEFT_SQUARE:
val=(List)valueStack.getFirst();
List newArray=createArrayContainer(containerFactory);
val.add(newArray);
status=S_IN_ARRAY;
statusStack.addFirst(new Integer(status));
statusStack.addFirst(Integer.valueOf(status));
valueStack.addFirst(newArray);
break;
default:
Expand Down Expand Up @@ -350,19 +350,19 @@ public void parse(Reader in, ContentHandler contentHandler, boolean isResume) th
switch(token.type){
case Yytoken.TYPE_VALUE:
status=S_IN_FINISHED_VALUE;
statusStack.addFirst(new Integer(status));
statusStack.addFirst(Integer.valueOf(status));
if(!contentHandler.primitive(token.value))
return;
break;
case Yytoken.TYPE_LEFT_BRACE:
status=S_IN_OBJECT;
statusStack.addFirst(new Integer(status));
statusStack.addFirst(Integer.valueOf(status));
if(!contentHandler.startObject())
return;
break;
case Yytoken.TYPE_LEFT_SQUARE:
status=S_IN_ARRAY;
statusStack.addFirst(new Integer(status));
statusStack.addFirst(Integer.valueOf(status));
if(!contentHandler.startArray())
return;
break;
Expand Down Expand Up @@ -392,7 +392,7 @@ public void parse(Reader in, ContentHandler contentHandler, boolean isResume) th
if(token.value instanceof String){
String key=(String)token.value;
status=S_PASSED_PAIR_KEY;
statusStack.addFirst(new Integer(status));
statusStack.addFirst(Integer.valueOf(status));
if(!contentHandler.startObjectEntry(key))
return;
}
Expand Down Expand Up @@ -432,17 +432,17 @@ public void parse(Reader in, ContentHandler contentHandler, boolean isResume) th
break;
case Yytoken.TYPE_LEFT_SQUARE:
statusStack.removeFirst();
statusStack.addFirst(new Integer(S_IN_PAIR_VALUE));
statusStack.addFirst(Integer.valueOf(S_IN_PAIR_VALUE));
status=S_IN_ARRAY;
statusStack.addFirst(new Integer(status));
statusStack.addFirst(Integer.valueOf(status));
if(!contentHandler.startArray())
return;
break;
case Yytoken.TYPE_LEFT_BRACE:
statusStack.removeFirst();
statusStack.addFirst(new Integer(S_IN_PAIR_VALUE));
statusStack.addFirst(Integer.valueOf(S_IN_PAIR_VALUE));
status=S_IN_OBJECT;
statusStack.addFirst(new Integer(status));
statusStack.addFirst(Integer.valueOf(status));
if(!contentHandler.startObject())
return;
break;
Expand Down Expand Up @@ -484,13 +484,13 @@ public void parse(Reader in, ContentHandler contentHandler, boolean isResume) th
break;
case Yytoken.TYPE_LEFT_BRACE:
status=S_IN_OBJECT;
statusStack.addFirst(new Integer(status));
statusStack.addFirst(Integer.valueOf(status));
if(!contentHandler.startObject())
return;
break;
case Yytoken.TYPE_LEFT_SQUARE:
status=S_IN_ARRAY;
statusStack.addFirst(new Integer(status));
statusStack.addFirst(Integer.valueOf(status));
if(!contentHandler.startArray())
return;
break;
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/org/json/simple/JSONArrayTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ public void testObjectArrayToString() throws IOException {
assertEquals("null", JSONArray.toJSONString((Object[])null));
assertEquals("[]", JSONArray.toJSONString(new Object[0]));
assertEquals("[\"Hello\"]", JSONArray.toJSONString(new Object[] { "Hello" }));
assertEquals("[\"Hello\",12,[1,2,3]]", JSONArray.toJSONString(new Object[] { "Hello", new Integer(12), new int[] { 1, 2, 3 } }));
assertEquals("[\"Hello\",12,[1,2,3]]", JSONArray.toJSONString(new Object[] { "Hello", Integer.valueOf(12), new int[] { 1, 2, 3 } }));

StringWriter writer;

Expand All @@ -282,7 +282,7 @@ public void testObjectArrayToString() throws IOException {
assertEquals("[\"Hello\"]", writer.toString());

writer = new StringWriter();
JSONArray.writeJSONString(new Object[] { "Hello", new Integer(12), new int[] { 1, 2, 3} }, writer);
JSONArray.writeJSONString(new Object[] { "Hello", Integer.valueOf(12), new int[] { 1, 2, 3} }, writer);
assertEquals("[\"Hello\",12,[1,2,3]]", writer.toString());
}
}
4 changes: 2 additions & 2 deletions src/test/java/org/json/simple/JSONValueTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ public void testObjectArrayToString() throws IOException {
assertEquals("null", JSONValue.toJSONString((Object[])null));
assertEquals("[]", JSONValue.toJSONString(new Object[0]));
assertEquals("[\"Hello\"]", JSONValue.toJSONString(new Object[] { "Hello" }));
assertEquals("[\"Hello\",12,[1,2,3]]", JSONValue.toJSONString(new Object[] { "Hello", new Integer(12), new int[] { 1, 2, 3 } }));
assertEquals("[\"Hello\",12,[1,2,3]]", JSONValue.toJSONString(new Object[] { "Hello", Integer.valueOf(12), new int[] { 1, 2, 3 } }));

StringWriter writer;

Expand All @@ -227,7 +227,7 @@ public void testObjectArrayToString() throws IOException {
assertEquals("[\"Hello\"]", writer.toString());

writer = new StringWriter();
JSONValue.writeJSONString(new Object[] { "Hello", new Integer(12), new int[] { 1, 2, 3} }, writer);
JSONValue.writeJSONString(new Object[] { "Hello", Integer.valueOf(12), new int[] { 1, 2, 3} }, writer);
assertEquals("[\"Hello\",12,[1,2,3]]", writer.toString());
}

Expand Down
18 changes: 9 additions & 9 deletions src/test/java/org/json/simple/Test.java
Original file line number Diff line number Diff line change
Expand Up @@ -300,9 +300,9 @@ public void testEncode() throws Exception{

JSONArray array1=new JSONArray();
array1.add("abc\u0010a/");
array1.add(new Integer(123));
array1.add(new Double(222.123));
array1.add(new Boolean(true));
array1.add(Integer.valueOf(123));
array1.add(Double.valueOf(222.123));
array1.add(Boolean.valueOf(true));
System.out.println("======array1==========");
System.out.println(array1);
System.out.println();
Expand All @@ -324,9 +324,9 @@ public void testEncode() throws Exception{

List list = new ArrayList();
list.add("abc\u0010a/");
list.add(new Integer(123));
list.add(new Double(222.123));
list.add(new Boolean(true));
list.add(Integer.valueOf(123));
list.add(Double.valueOf(222.123));
list.add(Boolean.valueOf(true));
list.add(null);
System.out.println("======list==========");
System.out.println(JSONArray.toJSONString(list));
Expand Down Expand Up @@ -365,12 +365,12 @@ public void testEncode() throws Exception{
List l2 = new LinkedList();
Map m3 = new LinkedHashMap();
m3.put("k31", "v3");
m3.put("k32", new Double(123.45));
m3.put("k33", new Boolean(false));
m3.put("k32", Double.valueOf(123.45));
m3.put("k33", Boolean.valueOf(false));
m3.put("k34", null);
l2.add("vvv");
l2.add("1.23456789123456789");
l2.add(new Boolean(true));
l2.add(Boolean.valueOf(true));
l2.add(null);
m3.put("k35", l2);
m1.put("k14", m3);
Expand Down