File tree Expand file tree Collapse file tree 2 files changed +11
-4
lines changed
main/java/com/jsoniter/spi Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -418,9 +418,11 @@ private void updateBindings(ClassDescriptor desc) {
418418 desc .onExtraProperties = binding ;
419419 }
420420 if (annotated && binding .field != null ) {
421- for (Binding setter : desc .setters ) {
422- if (binding .name .equals (setter .name )) {
423- throw new JsonException ("annotation should be marked on getter/setter for field: " + binding .name );
421+ if (desc .setters != null ) {
422+ for (Binding setter : desc .setters ) {
423+ if (binding .name .equals (setter .name )) {
424+ throw new JsonException ("annotation should be marked on getter/setter for field: " + binding .name );
425+ }
424426 }
425427 }
426428 }
Original file line number Diff line number Diff line change 55import com .jsoniter .annotation .JsonProperty ;
66import com .jsoniter .fuzzy .StringIntDecoder ;
77import com .jsoniter .output .JsonStream ;
8+ import com .jsoniter .spi .DecodingMode ;
89import com .jsoniter .spi .JsonException ;
910import junit .framework .TestCase ;
1011
@@ -145,12 +146,16 @@ public void test_getter_and_setter() throws IOException {
145146 }
146147
147148 public static class TestObject10 {
148- public int field ;
149+ private int field ;
149150
150151 @ JsonCreator
151152 public TestObject10 (@ JsonProperty ("hello" ) int field ) {
152153 this .field = field ;
153154 }
155+
156+ public int getField () {
157+ return field ;
158+ }
154159 }
155160
156161 public void test_creator_with_json_property () {
You can’t perform that action at this time.
0 commit comments