The JsonObject.add() method name and JavaDoc suggest that it is an _additive_
operation, but it isn't.
What steps will reproduce the problem?
JsonObject obj = new JsonObject();
obj.add("languages", new JsonPrimitive("en"));
obj.add("languages", new JsonPrimitive("it"));
System.out.println(obj.get("languages"));
What is the expected output? What do you see instead?
A programmer with no access to the code (just API and Javadoc) would probably
expect ["en","it"] to be printed. The actual result is "it".
Suggested fix:
Deprecate/remove ALL JsonObject.add() methods and call them "set" or "put".
I know this won't happen because nothing can be removed from the API, but I
still had to vent ;-)
Original issue reported on code.google.com by hussdl on 22 Aug 2014 at 10:29
Original issue reported on code.google.com by
hussdl
on 22 Aug 2014 at 10:29