@@ -58,7 +58,7 @@ public enum Feature {
58
58
* Feature is enabled by default.
59
59
*/
60
60
AUTO_CLOSE_SOURCE (true ),
61
-
61
+
62
62
// // // Support for non-standard data format constructs
63
63
64
64
/**
@@ -169,6 +169,49 @@ public enum Feature {
169
169
*/
170
170
ALLOW_NON_NUMERIC_NUMBERS (false ),
171
171
172
+ /**
173
+ * Feature allows the support for "missing" values in a JSON array: missing
174
+ * value meaning sequence of two commas, without value in-between but only
175
+ * optional white space.
176
+ * Enabling this feature will expose "missing" values as {@link JsonToken#VALUE_NULL}
177
+ * tokens, which typically become Java nulls in arrays and {@link java.util.Collection}
178
+ * in data-binding.
179
+ * <p>
180
+ * For example, enabling this feature will represent a JSON array <code>["value1",,"value3",]</code>
181
+ * as <code>["value1", null, "value3", null]</code>
182
+ * <p>
183
+ * Since the JSON specification does not allow missing values this is a non-compliant JSON
184
+ * feature and is disabled by default.
185
+ *
186
+ * @since 2.8
187
+ */
188
+ ALLOW_MISSING_VALUES (false ),
189
+
190
+ /**
191
+ * Feature that determines whether {@link JsonParser} will allow for a single trailing
192
+ * comma following the final value (in an Array) or member (in an Object). These commas
193
+ * will simply be ignored.
194
+ * <p>
195
+ * For example, when this feature is enabled, <code>[true,true,]</code> is equivalent to
196
+ * <code>[true, true]</code> and <code>{"a": true,}</code> is equivalent to
197
+ * <code>{"a": true}</code>.
198
+ * <p>
199
+ * When combined with <code>ALLOW_MISSING_VALUES</code>, this feature takes priority, and
200
+ * the final trailing comma in an array declaration does not imply a missing
201
+ * (<code>null</code>) value. For example, when both <code>ALLOW_MISSING_VALUES</code>
202
+ * and <code>ALLOW_TRAILING_COMMA</code> are enabled, <code>[true,true,]</code> is
203
+ * equivalent to <code>[true, true]</code>, and <code>[true,true,,]</code> is equivalent to
204
+ * <code>[true, true, null]</code>.
205
+ * <p>
206
+ * Since the JSON specification does not permit trailing commas, this is a non-standard
207
+ * feature, and as such disabled by default.
208
+ *
209
+ * @since 2.9
210
+ */
211
+ ALLOW_TRAILING_COMMA (false ),
212
+
213
+ // // // Validity checks
214
+
172
215
/**
173
216
* Feature that determines whether {@link JsonParser} will explicitly
174
217
* check that no duplicate JSON Object field names are encountered.
@@ -211,46 +254,29 @@ public enum Feature {
211
254
*/
212
255
IGNORE_UNDEFINED (false ),
213
256
214
- /**
215
- * Feature allows the support for "missing" values in a JSON array: missing
216
- * value meaning sequence of two commas, without value in-between but only
217
- * optional white space.
218
- * Enabling this feature will expose "missing" values as {@link JsonToken#VALUE_NULL}
219
- * tokens, which typically become Java nulls in arrays and {@link java.util.Collection}
220
- * in data-binding.
221
- * <p>
222
- * For example, enabling this feature will represent a JSON array <code>["value1",,"value3",]</code>
223
- * as <code>["value1", null, "value3", null]</code>
224
- * <p>
225
- * Since the JSON specification does not allow missing values this is a non-compliant JSON
226
- * feature and is disabled by default.
227
- *
228
- * @since 2.8
229
- */
230
- ALLOW_MISSING_VALUES (false ),
257
+ // // // Other
231
258
232
259
/**
233
- * Feature that determines whether {@link JsonParser} will allow for a single trailing
234
- * comma following the final value (in an Array) or member (in an Object). These commas
235
- * will simply be ignored.
236
- * <p>
237
- * For example, when this feature is enabled, <code>[true,true,]</code> is equivalent to
238
- * <code>[true, true]</code> and <code>{"a": true,}</code> is equivalent to
239
- * <code>{"a": true}</code>.
240
- * <p>
241
- * When combined with <code>ALLOW_MISSING_VALUES</code>, this feature takes priority, and
242
- * the final trailing comma in an array declaration does not imply a missing
243
- * (<code>null</code>) value. For example, when both <code>ALLOW_MISSING_VALUES</code>
244
- * and <code>ALLOW_TRAILING_COMMA</code> are enabled, <code>[true,true,]</code> is
245
- * equivalent to <code>[true, true]</code>, and <code>[true,true,,]</code> is equivalent to
246
- * <code>[true, true, null]</code>.
247
- * <p>
248
- * Since the JSON specification does not permit trailing commas, this is a non-standard
249
- * feature, and as such disabled by default.
260
+ * Feature that determines whether {@link JsonLocation} instances should be constructed
261
+ * with reference to source or not. If source reference is included, its type and contents
262
+ * are included when `toString()` method is called (most notably when printing out parse
263
+ * exception with that location information). If feature is disabled, no source reference
264
+ * is passed and source is only indicated as "UNKNOWN".
265
+ *<p>
266
+ * Most common reason for disabling this feature is to avoid leaking information about
267
+ * internal information; this may be done for security reasons.
268
+ * Note that even if source reference is included, only parts of contents are usually
269
+ * printed, and not the whole contents. Further, many source reference types can not
270
+ * necessarily access contents (like streams), so only type is indicated, not contents.
271
+ *<p>
272
+ * Feature is enabled by default, meaning that "source reference" information is passed
273
+ * and some or all of the source content may be included in {@link JsonLocation} information
274
+ * constructed either when requested explicitly, or when needed for an exception.
250
275
*
251
276
* @since 2.9
252
277
*/
253
- ALLOW_TRAILING_COMMA (false )
278
+ INCLUDE_SOURCE_IN_LOCATION (true ),
279
+
254
280
;
255
281
256
282
/**
0 commit comments