Skip to content

Commit af2ae8e

Browse files
committed
Merge branch '2.11'
2 parents 4555a7e + f3da1aa commit af2ae8e

File tree

3 files changed

+23
-10
lines changed

3 files changed

+23
-10
lines changed

release-notes/CREDITS-2.x

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,6 +1003,10 @@ Mark Schäfer (mark--@github)
10031003
* Reported #2520: Sub-optimal exception message when failing to deserialize non-static inner classes
10041004
(2.10.1)
10051005
1006+
Fabian Lange (CodingFabian@github)
1007+
* Reported #2556: Contention in `TypeNameIdResolver.idFromClass()`
1008+
(2.10.2)
1009+
10061010
Ville Koskela (vjkoskela@github)
10071011
* Contributed #2487: BeanDeserializerBuilder Protected Factory Method for Extension
10081012
(2.11.0)

release-notes/VERSION-2.x

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ Project: jackson-databind
3131
(reported by Jon A)
3232
#2553: JsonDeserialize(contentAs=...) broken with raw collections
3333
(reported by cpopp@github)
34+
#2556: Contention in `TypeNameIdResolver.idFromClass()`
35+
(reported by Fabian L)
3436
3537
2.10.1 (09-Nov-2019)
3638

src/main/java/com/fasterxml/jackson/databind/jsontype/impl/TypeNameIdResolver.java

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -91,24 +91,31 @@ protected String idFromClass(DatabindContext ctxt, Class<?> cls)
9191
// `JavaType` being resolved, not underlying class. Hence commented out in
9292
// 3.x. There should be better way to support whatever the use case is.
9393

94+
// 29-Nov-2019, tatu: Looking at 2.x, test in `TestTypeModifierNameResolution` suggested
95+
// that use of `TypeModifier` was used for demoting some types (from impl class to
96+
// interface. For what that's worth. Still not supported for 3.x until proven necessary
97+
9498
// cls = _typeFactory.constructType(cls).getRawClass();
9599

96100
final String key = cls.getName();
97101
String name;
98102

99103
synchronized (_typeToId) {
100104
name = _typeToId.get(key);
105+
}
106+
107+
if (name == null) {
108+
// 24-Feb-2011, tatu: As per [JACKSON-498], may need to dynamically look up name
109+
// can either throw an exception, or use default name...
110+
if (ctxt.isAnnotationProcessingEnabled()) {
111+
name = ctxt.getAnnotationIntrospector().findTypeName(ctxt.getConfig(),
112+
ctxt.introspectClassAnnotations(cls));
113+
}
101114
if (name == null) {
102-
// 24-Feb-2011, tatu: As per [JACKSON-498], may need to dynamically look up name
103-
// can either throw an exception, or use default name...
104-
if (ctxt.isAnnotationProcessingEnabled()) {
105-
name = ctxt.getAnnotationIntrospector().findTypeName(ctxt.getConfig(),
106-
ctxt.introspectClassAnnotations(cls));
107-
}
108-
if (name == null) {
109-
// And if still not found, let's choose default?
110-
name = _defaultTypeId(cls);
111-
}
115+
// And if still not found, let's choose default?
116+
name = _defaultTypeId(cls);
117+
}
118+
synchronized (_typeToId) {
112119
_typeToId.put(key, name);
113120
}
114121
}

0 commit comments

Comments
 (0)