content: package com.alibaba.fastjson2.autoType;
  
  import com.alibaba.fastjson2.JSONB;
  import com.alibaba.fastjson2.JSONReader;
  import com.alibaba.fastjson2.JSONWriter;
  import org.junit.jupiter.api.Test;
  
  import java.util.ArrayList;
  import java.util.List;
  
  import static org.junit.jupiter.api.Assertions.assertEquals;
  
  public class AutoTypeTest45_ListNullItem {
      @Test
      public void test_hashmap_keySet() {
          Bean bean = new Bean();
          bean.items = new ArrayList<>();
          bean.items.add(null);
          bean.items.add(new Item());
  
          byte[] bytes = JSONB.toBytes(bean,
                  JSONWriter.Feature.WriteClassName,
                  JSONWriter.Feature.FieldBased,
                  JSONWriter.Feature.ReferenceDetection,
                  JSONWriter.Feature.WriteNulls,
                  JSONWriter.Feature.NotWriteDefaultValue,
                  JSONWriter.Feature.NotWriteHashMapArrayListClassName
          );
  
          JSONB.dump(bytes);
  
          Bean bean2 = (Bean) JSONB.parseObject(
                  bytes,
                  Object.class,
                  JSONReader.Feature.SupportAutoType,
                  JSONReader.Feature.FieldBased,
                  JSONReader.Feature.UseNativeObject
          );
  
          assertEquals(bean.items.size(), bean2.items.size());
      }
  
      public static class Bean {
          List<Item> items;
      }
  
      public static class Item {
      }
  }
  