Skip to content

Commit fff39bd

Browse files
committed
test - failing test for unsupported Record (#3)
1 parent fc8c4d8 commit fff39bd

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

src/main/java/com/jsoniter/ReflectionDecoderFactory.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ public static Decoder create(ClassInfo classAndArgs) {
2323
if (clazz.isEnum()) {
2424
return new ReflectionEnumDecoder(clazz);
2525
}
26+
if (clazz.isRecord()) {
27+
return new ReflectionRecordDecoder(clazz, typeArgs);
28+
}
2629
return new ReflectionObjectDecoder(classAndArgs).create();
2730
}
2831
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package com.jsoniter;
2+
3+
import junit.framework.TestCase;
4+
5+
import java.io.IOException;
6+
7+
public class TestRecord extends TestCase {
8+
9+
record TestRecord1(long field1) {
10+
11+
}
12+
13+
public void test_record_error() throws IOException {
14+
15+
JsonIterator iter = JsonIterator.parse("{ 'field1' : 1".replace('\'', '"'));
16+
iter.read(TestRecord1.class);
17+
}
18+
}

0 commit comments

Comments
 (0)