Skip to content

Commit

Permalink
fix compile error for issue #1440
Browse files Browse the repository at this point in the history
  • Loading branch information
wenshao committed May 7, 2023
1 parent 48231de commit 76c9fa5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,12 @@ public void write(JSONWriter jsonWriter, Object object, Object fieldName, Type f
i++;
continue;
}

Class<?> itemClass = item.getClass();
ObjectWriter itemObjectWriter;
if (itemClass == previousClass) {
itemObjectWriter = previousObjectWriter;
} else {
Class<?> itemClass = item.getClass();
ObjectWriter itemObjectWriter;
if (itemClass == previousClass) {
itemObjectWriter = previousObjectWriter;
} else {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
package com.alibaba.fastjson2.writer;

import static org.junit.jupiter.api.Assertions.assertEquals;
import com.alibaba.fastjson2.JSON;
import org.junit.jupiter.api.Test;

import java.util.HashSet;
import java.util.Set;

import org.junit.jupiter.api.Test;

import com.alibaba.fastjson2.JSON;
import static org.junit.jupiter.api.Assertions.assertEquals;

public class ObjectWriterSetTest {

@Test
public void testJsonbSet() {
Set<Integer> set = new HashSet<Integer>();
set.add(1);
set.add(null);
String str = JSON.toJSONString(set);

assertEquals(str, "[null,1]");
}
}

0 comments on commit 76c9fa5

Please sign in to comment.