Commit c4ab04d
committed
refactor: use Context configuration for PrettyFormatInlineArrays instead of Feature bit
Address review feedback about limited bits in 64-bit Feature bitmask.
Move inline arrays configuration from JSONWriter.Feature enum to
JSONWriter.Context, following the pattern used by other non-Feature
configuration like dateFormat, zoneId, and maxLevel.
API changes:
- Remove PrettyFormatInlineArrays from JSONWriter.Feature enum
- Add Context.setPrettyFormatInlineArrays(boolean) for per-call config
- Add JSONFactory.setDefaultWriterPrettyFormatInlineArrays(boolean) for global default
The implementation uses a levelArray bitmask to track array vs object
context at each nesting level, enabling proper indentation behavior
where objects remain pretty-printed while arrays stay inline.1 parent 150f8e4 commit c4ab04d
5 files changed
Lines changed: 195 additions & 59 deletions
File tree
- core/src
- main/java/com/alibaba/fastjson2
- test/java/com/alibaba/fastjson2/features
- docs
Lines changed: 21 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
| 82 | + | |
82 | 83 | | |
83 | 84 | | |
84 | 85 | | |
| |||
743 | 744 | | |
744 | 745 | | |
745 | 746 | | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
746 | 767 | | |
747 | 768 | | |
748 | 769 | | |
| |||
Lines changed: 27 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
129 | 129 | | |
130 | 130 | | |
131 | 131 | | |
132 | | - | |
| 132 | + | |
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
| |||
3256 | 3256 | | |
3257 | 3257 | | |
3258 | 3258 | | |
| 3259 | + | |
3259 | 3260 | | |
3260 | 3261 | | |
3261 | 3262 | | |
| |||
3272 | 3273 | | |
3273 | 3274 | | |
3274 | 3275 | | |
| 3276 | + | |
3275 | 3277 | | |
3276 | 3278 | | |
3277 | 3279 | | |
| |||
3289 | 3291 | | |
3290 | 3292 | | |
3291 | 3293 | | |
| 3294 | + | |
3292 | 3295 | | |
3293 | 3296 | | |
3294 | 3297 | | |
| |||
3311 | 3314 | | |
3312 | 3315 | | |
3313 | 3316 | | |
| 3317 | + | |
3314 | 3318 | | |
3315 | 3319 | | |
3316 | 3320 | | |
| |||
3340 | 3344 | | |
3341 | 3345 | | |
3342 | 3346 | | |
| 3347 | + | |
3343 | 3348 | | |
3344 | 3349 | | |
3345 | 3350 | | |
| |||
3883 | 3888 | | |
3884 | 3889 | | |
3885 | 3890 | | |
| 3891 | + | |
| 3892 | + | |
| 3893 | + | |
| 3894 | + | |
| 3895 | + | |
| 3896 | + | |
| 3897 | + | |
| 3898 | + | |
| 3899 | + | |
| 3900 | + | |
| 3901 | + | |
| 3902 | + | |
| 3903 | + | |
| 3904 | + | |
| 3905 | + | |
| 3906 | + | |
| 3907 | + | |
| 3908 | + | |
| 3909 | + | |
| 3910 | + | |
3886 | 3911 | | |
3887 | 3912 | | |
3888 | 3913 | | |
| |||
4441 | 4466 | | |
4442 | 4467 | | |
4443 | 4468 | | |
4444 | | - | |
4445 | | - | |
4446 | | - | |
4447 | | - | |
4448 | | - | |
4449 | | - | |
4450 | | - | |
4451 | | - | |
4452 | | - | |
4453 | | - | |
4454 | | - | |
4455 | | - | |
| 4469 | + | |
4456 | 4470 | | |
4457 | 4471 | | |
4458 | 4472 | | |
| |||
0 commit comments