@@ -88,23 +88,29 @@ protected String idFromClass(Class<?> clazz)
88
88
if (clazz == null ) {
89
89
return null ;
90
90
}
91
- Class <?> cls = _typeFactory .constructType (clazz ).getRawClass ();
92
- final String key = cls .getName ();
91
+ // NOTE: although we may need to let `TypeModifier` change actual type to use
92
+ // for id, we can use original type as key for more efficient lookup:
93
+ final String key = clazz .getName ();
93
94
String name ;
94
-
95
95
synchronized (_typeToId ) {
96
96
name = _typeToId .get (key );
97
+ }
98
+
99
+ if (name == null ) {
100
+ // 29-Nov-2019, tatu: As per test in `TestTypeModifierNameResolution` somehow
101
+ // we need to do this odd piece here which seems unnecessary but isn't.
102
+ Class <?> cls = _typeFactory .constructType (clazz ).getRawClass ();
103
+ // 24-Feb-2011, tatu: As per [JACKSON-498], may need to dynamically look up name
104
+ // can either throw an exception, or use default name...
105
+ if (_config .isAnnotationProcessingEnabled ()) {
106
+ BeanDescription beanDesc = _config .introspectClassAnnotations (cls );
107
+ name = _config .getAnnotationIntrospector ().findTypeName (beanDesc .getClassInfo ());
108
+ }
97
109
if (name == null ) {
98
- // 24-Feb-2011, tatu: As per [JACKSON-498], may need to dynamically look up name
99
- // can either throw an exception, or use default name...
100
- if (_config .isAnnotationProcessingEnabled ()) {
101
- BeanDescription beanDesc = _config .introspectClassAnnotations (cls );
102
- name = _config .getAnnotationIntrospector ().findTypeName (beanDesc .getClassInfo ());
103
- }
104
- if (name == null ) {
105
- // And if still not found, let's choose default?
106
- name = _defaultTypeId (cls );
107
- }
110
+ // And if still not found, let's choose default?
111
+ name = _defaultTypeId (cls );
112
+ }
113
+ synchronized (_typeToId ) {
108
114
_typeToId .put (key , name );
109
115
}
110
116
}
0 commit comments