Skip to content

Commit

Permalink
bug fix for issue #2851 on jdk8
Browse files Browse the repository at this point in the history
  • Loading branch information
wenshao committed Aug 8, 2024
1 parent 05edc92 commit 70fa094
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ public static ObjectReader of(Type type, Class listClass, long features) {
instanceClass = TreeSet.class;
builder = (Function<NavigableSet, NavigableSet>) Collections::synchronizedNavigableSet;
break;
case "java.util.RandomAccessSubList":
case "java.util.AbstractList$RandomAccessSubList":
instanceClass = ArrayList.class;
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@
public class Issue2851 {
@Test
public void test() {

List<String> list = Arrays.asList("").subList(0, 1);
byte[] bytes = JSONB.toBytes(list, JSONWriter.Feature.WriteClassName);
JSONReader.AutoTypeBeforeHandler autoTypeFilter = JSONReader.autoTypeFilter("java.util.AbstractList");
JSONReader.AutoTypeBeforeHandler autoTypeFilter = JSONReader.autoTypeFilter("java.util.");
JSONReader.Context context = JSONFactory.createReadContext();
context.config(autoTypeFilter);
List<String> parsed = (List<String>) JSONB.parse(bytes, context);
Expand Down

0 comments on commit 70fa094

Please sign in to comment.