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

Fix a bug when calling JSONArray.addAll() with Collection as Object #907

Merged
merged 2 commits into from
Nov 13, 2024
Merged
Changes from 1 commit
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
Next Next commit
test(#901): call JsonArray.putAll with a casted list as object
hexetia authored Oct 5, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 0d71dcf71319c9bc230f268e3e50314bb7bb9e5e
5 changes: 5 additions & 0 deletions src/test/java/org/json/junit/JSONArrayTest.java
Original file line number Diff line number Diff line change
@@ -259,6 +259,11 @@ public void verifyPutAll() {
jsonArray.length(),
len);

// collection as object
@SuppressWarnings("RedundantCast")
Object myListAsObject = (Object) myList;
jsonArray.putAll(myListAsObject);

for (int i = 0; i < myList.size(); i++) {
assertEquals("collection elements should be equal",
myList.get(i),