@@ -115,8 +115,8 @@ public class SimpleModule
115
115
public SimpleModule () {
116
116
// can't chain when making reference to 'this'
117
117
// note: generate different name for direct instantiation, sub-classing
118
- _name = (getClass () == SimpleModule .class ) ?
119
- "SimpleModule-" +System .identityHashCode (this )
118
+ _name = (getClass () == SimpleModule .class )
119
+ ? "SimpleModule-" +System .identityHashCode (this )
120
120
: getClass ().getName ();
121
121
_version = Version .unknownVersion ();
122
122
// 07-Jun-2021, tatu: [databind#3110] Not passed explicitly so...
@@ -198,14 +198,22 @@ public SimpleModule(String name, Version version,
198
198
@ Override
199
199
public Object getTypeId ()
200
200
{
201
- // 07-Jun-2021, tatu: [databind#3110] Only return Type Id if name
202
- // was explicitly given
201
+ // 07-Jun-2021, tatu: [databind#3110] Return Type Id if name was
202
+ // explicitly given
203
203
if (_hasExplicitName ) {
204
204
return _name ;
205
205
}
206
- // ...otherwise give no type id, even for sub-classes (sub-classes are
207
- // welcome to override this method of course)
208
- return null ;
206
+ // Otherwise behavior same as with 2.12: no registration id for "throw-away"
207
+ // instances (to avoid bogus conflicts if user just instantiates SimpleModule)
208
+
209
+ // Note: actually... always returning `supet.getTypeId()` should be fine since
210
+ // that would return generated id? Let's do that actually.
211
+ if (getClass () == SimpleModule .class ) {
212
+ return _name ;
213
+ }
214
+ // And for what it is worth, this should usually do the same and we could
215
+ // in fact always just return `_name`. But leaving as-is for now.
216
+ return super .getTypeId ();
209
217
}
210
218
211
219
/*
0 commit comments