@@ -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