@@ -58,7 +58,7 @@ public class PropertyNamingStrategy // NOTE: was abstract until 2.7
58
58
* for reasons for deprecation.
59
59
*/
60
60
@ Deprecated // since 2.12
61
- public static final PropertyNamingStrategy UPPER_CAMEL_CASE = new UpperCamelCaseStrategy ();
61
+ public static final PropertyNamingStrategy UPPER_CAMEL_CASE = new UpperCamelCaseStrategy (false );
62
62
63
63
/**
64
64
* @deprecated Since 2.12 deprecated. Use {@link PropertyNamingStrategies#SNAKE_CASE} instead.
@@ -67,7 +67,7 @@ public class PropertyNamingStrategy // NOTE: was abstract until 2.7
67
67
* for reasons for deprecation.
68
68
*/
69
69
@ Deprecated // since 2.12
70
- public static final PropertyNamingStrategy SNAKE_CASE = new SnakeCaseStrategy ();
70
+ public static final PropertyNamingStrategy SNAKE_CASE = new SnakeCaseStrategy (false );
71
71
72
72
/**
73
73
* @deprecated Since 2.12 deprecated. Use {@link PropertyNamingStrategies#LOWER_CASE} instead.
@@ -76,7 +76,7 @@ public class PropertyNamingStrategy // NOTE: was abstract until 2.7
76
76
* for reasons for deprecation.
77
77
*/
78
78
@ Deprecated // since 2.12
79
- public static final PropertyNamingStrategy LOWER_CASE = new LowerCaseStrategy ();
79
+ public static final PropertyNamingStrategy LOWER_CASE = new LowerCaseStrategy (false );
80
80
81
81
/**
82
82
* @deprecated Since 2.12 deprecated. Use {@link PropertyNamingStrategies#KEBAB_CASE} instead.
@@ -85,7 +85,7 @@ public class PropertyNamingStrategy // NOTE: was abstract until 2.7
85
85
* for reasons for deprecation.
86
86
*/
87
87
@ Deprecated // since 2.12
88
- public static final PropertyNamingStrategy KEBAB_CASE = new KebabCaseStrategy ();
88
+ public static final PropertyNamingStrategy KEBAB_CASE = new KebabCaseStrategy (false );
89
89
90
90
/**
91
91
* @deprecated Since 2.12 deprecated. Use {@link PropertyNamingStrategies#LOWER_DOT_CASE} instead.
@@ -94,7 +94,7 @@ public class PropertyNamingStrategy // NOTE: was abstract until 2.7
94
94
* for reasons for deprecation.
95
95
*/
96
96
@ Deprecated // since 2.12
97
- public static final PropertyNamingStrategy LOWER_DOT_CASE = new LowerDotCaseStrategy ();
97
+ public static final PropertyNamingStrategy LOWER_DOT_CASE = new LowerDotCaseStrategy (false );
98
98
99
99
/*
100
100
/**********************************************************
@@ -194,6 +194,23 @@ public String nameForConstructorParameter(MapperConfig<?> config, AnnotatedParam
194
194
@ Deprecated
195
195
public static abstract class PropertyNamingStrategyBase extends PropertyNamingStrategy
196
196
{
197
+ // For use via annotations: WARN
198
+ protected PropertyNamingStrategyBase () {
199
+ super ();
200
+ final String simple = getClass ().getSimpleName ();
201
+ Logger .getLogger (getClass ().getName ())
202
+ .warning (
203
+ "PropertyNamingStrategy." +simple +" is used but it has been deprecated due to " +
204
+ "risk of deadlock. Consider using PropertyNamingStrategies." +simple +" instead. " +
205
+ "See https://github.com/FasterXML/jackson-databind/issues/2715 for more details." );
206
+
207
+ }
208
+
209
+ // For use by static instances: no warning
210
+ protected PropertyNamingStrategyBase (boolean bogus ) {
211
+ super ();
212
+ }
213
+
197
214
@ Override
198
215
public String nameForField (MapperConfig <?> config , AnnotatedField field , String defaultName )
199
216
{
@@ -276,6 +293,9 @@ protected static String translateLowerCaseWithSeparator(final String input, fina
276
293
@ Deprecated // since 2.12
277
294
public static class SnakeCaseStrategy extends PropertyNamingStrategyBase
278
295
{
296
+ public SnakeCaseStrategy () { }
297
+ protected SnakeCaseStrategy (boolean bogus ) { super (bogus ); }
298
+
279
299
@ Override
280
300
public String translate (String input )
281
301
{
@@ -320,19 +340,13 @@ public String translate(String input)
320
340
@ Deprecated // since 2.12
321
341
public static class UpperCamelCaseStrategy extends PropertyNamingStrategyBase
322
342
{
323
- public UpperCamelCaseStrategy () {
324
- Logger .getLogger (UpperCamelCaseStrategy .class .getName ())
325
- .warning (
326
- "PropertyNamingStrategy.UpperCamelCaseStrategy is used but it has been deprecated due to " +
327
- "risk of deadlock. Consider using PropertyNamingStrategies.UpperCamelCaseStrategy instead. " +
328
- "See https://github.com/FasterXML/jackson-databind/issues/2715 for more details." );
329
- }
343
+ public UpperCamelCaseStrategy () { }
344
+ protected UpperCamelCaseStrategy (boolean bogus ) { super (bogus ); }
330
345
331
346
/**
332
347
* Converts camelCase to PascalCase
333
348
*
334
- * For example, "userName" would be converted to
335
- * "UserName".
349
+ * For example, "userName" would be converted to "UserName".
336
350
*
337
351
* @param input formatted as camelCase string
338
352
* @return input converted to PascalCase format
@@ -363,13 +377,8 @@ public String translate(String input) {
363
377
@ Deprecated // since 2.12
364
378
public static class LowerCaseStrategy extends PropertyNamingStrategyBase
365
379
{
366
- public LowerCaseStrategy () {
367
- Logger .getLogger (LowerCaseStrategy .class .getName ())
368
- .warning (
369
- "PropertyNamingStrategy.LowerCaseStrategy is used but it has been deprecated " +
370
- "due to risk of deadlock. Consider using PropertyNamingStrategies.LowerCaseStrategy instead. " +
371
- "See https://github.com/FasterXML/jackson-databind/issues/2715 for more details." );
372
- }
380
+ public LowerCaseStrategy () { }
381
+ protected LowerCaseStrategy (boolean bogus ) { super (bogus ); }
373
382
374
383
@ Override
375
384
public String translate (String input ) {
@@ -386,13 +395,8 @@ public String translate(String input) {
386
395
@ Deprecated // since 2.12
387
396
public static class KebabCaseStrategy extends PropertyNamingStrategyBase
388
397
{
389
- public KebabCaseStrategy () {
390
- Logger .getLogger (KebabCaseStrategy .class .getName ())
391
- .warning (
392
- "PropertyNamingStrategy.KebabCaseStrategy is used but it has been deprecated" +
393
- "due to risk of deadlock. Consider using PropertyNamingStrategies.KebabCaseStrategy instead. " +
394
- "See https://github.com/FasterXML/jackson-databind/issues/2715 for more details." );
395
- }
398
+ public KebabCaseStrategy () { }
399
+ protected KebabCaseStrategy (boolean bogus ) { super (bogus ); }
396
400
397
401
@ Override
398
402
public String translate (String input ) {
@@ -409,13 +413,8 @@ public String translate(String input) {
409
413
@ Deprecated // since 2.12
410
414
public static class LowerDotCaseStrategy extends PropertyNamingStrategyBase
411
415
{
412
- public LowerDotCaseStrategy () {
413
- Logger .getLogger (LowerDotCaseStrategy .class .getName ())
414
- .warning (
415
- "PropertyNamingStrategy.LowerDotCaseStrategy is used but it has been deprecated" +
416
- "due to risk of deadlock. Consider using PropertyNamingStrategies.LowerDotCaseStrategy instead. " +
417
- "See https://github.com/FasterXML/jackson-databind/issues/2715 for more details." );
418
- }
416
+ public LowerDotCaseStrategy () { }
417
+ protected LowerDotCaseStrategy (boolean bogus ) { super (bogus ); }
419
418
420
419
@ Override
421
420
public String translate (String input ){
0 commit comments