Skip to content

Commit a4eaa1f

Browse files
committed
https://github.com/json-iterator/java/issues/86#issuecomment-310906679
1 parent 3aa7a88 commit a4eaa1f

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/main/java/com/jsoniter/spi/ClassDescriptor.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -307,11 +307,12 @@ private static List<Binding> getSetters(Map<String, Type> lookup, ClassInfo clas
307307
try {
308308
String fromName = translateSetterName(methodName);
309309
Binding field = allFields.get(fromName);
310+
Binding setter = new Binding(classInfo, lookup, paramTypes[0]);
310311
if (!(field == null) && field.isTransient) {
311-
continue;
312+
setter.fromNames = new String[0];
313+
} else {
314+
setter.fromNames = new String[]{fromName};
312315
}
313-
Binding setter = new Binding(classInfo, lookup, paramTypes[0]);
314-
setter.fromNames = new String[]{fromName};
315316
setter.name = fromName;
316317
setter.method = method;
317318
setter.annotations = method.getAnnotations();
@@ -370,12 +371,13 @@ private static List<Binding> getGetters(Map<String, Type> lookup, ClassInfo clas
370371
char[] fromNameChars = toName.toCharArray();
371372
fromNameChars[0] = Character.toLowerCase(fromNameChars[0]);
372373
toName = new String(fromNameChars);
374+
Binding getter = new Binding(classInfo, lookup, method.getGenericReturnType());
373375
Binding field = allFields.get(toName);
374376
if (!(field == null) && field.isTransient) {
375-
continue;
377+
getter.toNames = new String[0];
378+
} else {
379+
getter.toNames = new String[]{toName};
376380
}
377-
Binding getter = new Binding(classInfo, lookup, method.getGenericReturnType());
378-
getter.toNames = new String[]{toName};
379381
getter.name = toName;
380382
getter.method = method;
381383
getter.annotations = method.getAnnotations();

0 commit comments

Comments
 (0)