Skip to content

Commit 695df08

Browse files
wenshaoclaude
andcommitted
fix: three bugs in ObjectWriterCreatorASM
1. gwFloat JSONB path used wrong method descriptor "(D)V" instead of "(F)V" for writeFloat 2. Double[] field incorrectly used Float.class as itemClass 3. jitFieldWriterList capacity calculation overwrote instead of accumulating Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 0019471 commit 695df08

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎core/src/main/java/com/alibaba/fastjson2/writer/ObjectWriterCreatorASM.java‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3397,7 +3397,7 @@ private void gwFloat(
33973397
mw.aload(FIELD_VALUE);
33983398
mw.invokevirtual("java/lang/Float", "floatValue", "()F");
33993399

3400-
mw.invokevirtual(TYPE_JSON_WRITER, "writeFloat", "(D)V");
3400+
mw.invokevirtual(TYPE_JSON_WRITER, "writeFloat", "(F)V");
34013401
} else {
34023402
mw.aload(THIS);
34033403
mw.getfield(classNameType, fieldWriter(i), DESC_FIELD_WRITER);
@@ -4523,7 +4523,7 @@ public <T> FieldWriter<T> createFieldWriter(
45234523
}
45244524

45254525
if (fieldClass == Double[].class) {
4526-
return new FieldWriterObjectArray<>(fieldName, Float.class, ordinal, features, format, label, Double[].class, Double[].class, field, null, null);
4526+
return new FieldWriterObjectArray<>(fieldName, Double.class, ordinal, features, format, label, Double[].class, Double[].class, field, null, null);
45274527
}
45284528

45294529
if (isFunction(fieldClass)) {
@@ -4623,7 +4623,7 @@ private FieldWriter jitFieldWriterList(
46234623
if (direct) {
46244624
int capacity = 6;
46254625
for (FieldWriter fieldWriter : fieldWriters) {
4626-
capacity = fieldCapacity(fieldWriter.fieldClass);
4626+
capacity += fieldCapacity(fieldWriter.fieldClass);
46274627
}
46284628

46294629
ClassWriter cw = new ClassWriter(null);

0 commit comments

Comments
 (0)