File tree 2 files changed +11
-4
lines changed
main/java/com/jsoniter/spi
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) {
418
418
desc .onExtraProperties = binding ;
419
419
}
420
420
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
+ }
424
426
}
425
427
}
426
428
}
Original file line number Diff line number Diff line change 5
5
import com .jsoniter .annotation .JsonProperty ;
6
6
import com .jsoniter .fuzzy .StringIntDecoder ;
7
7
import com .jsoniter .output .JsonStream ;
8
+ import com .jsoniter .spi .DecodingMode ;
8
9
import com .jsoniter .spi .JsonException ;
9
10
import junit .framework .TestCase ;
10
11
@@ -145,12 +146,16 @@ public void test_getter_and_setter() throws IOException {
145
146
}
146
147
147
148
public static class TestObject10 {
148
- public int field ;
149
+ private int field ;
149
150
150
151
@ JsonCreator
151
152
public TestObject10 (@ JsonProperty ("hello" ) int field ) {
152
153
this .field = field ;
153
154
}
155
+
156
+ public int getField () {
157
+ return field ;
158
+ }
154
159
}
155
160
156
161
public void test_creator_with_json_property () {
You can’t perform that action at this time.
0 commit comments