Skip to content

Commit f3f77d9

Browse files
committed
Fix #2059
1 parent 48921f9 commit f3f77d9

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

release-notes/CREDITS-2.x

+4
Original file line numberDiff line numberDiff line change
@@ -802,3 +802,7 @@ Petar Tahchiev (ptahchiev@github)
802802
* Reported #2060: `UnwrappingBeanPropertyWriter` incorrectly assumes the found
803803
serializer is of type `UnwrappingBeanSerializer`
804804
(2.9.6)
805+
806+
Thibaut Robert (trobert@github)
807+
* Requested #2059: Remove `final` modifier for `TypeFactory`
808+
(2.10.0)

release-notes/VERSION-2.x

+5
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ Project: jackson-databind
44
=== Releases ===
55
------------------------------------------------------------------------
66

7+
2.10.0 (not yet released)
8+
9+
#2059: Remove `final` modifier for `TypeFactory`
10+
(requested by Thibaut R)
11+
712
2.9.7 (not yet released)
813

914
#2060: `UnwrappingBeanPropertyWriter` incorrectly assumes the found serializer is

src/main/java/com/fasterxml/jackson/databind/type/TypeFactory.java

+11-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
*</pre>
3232
*/
3333
@SuppressWarnings({"rawtypes" })
34-
public final class TypeFactory
34+
public class TypeFactory // note: was final in 2.9, removed from 2.10
3535
implements java.io.Serializable
3636
{
3737
private static final long serialVersionUID = 1L;
@@ -171,6 +171,11 @@ protected TypeFactory(LRUMap<Object,JavaType> typeCache, TypeParser p,
171171
_classLoader = classLoader;
172172
}
173173

174+
/**
175+
* "Mutant factory" method which will construct a new instance with specified
176+
* {@link TypeModifier} added as the first modifier to call (in case there
177+
* are multiple registered).
178+
*/
174179
public TypeFactory withModifier(TypeModifier mod)
175180
{
176181
LRUMap<Object,JavaType> typeCache = _typeCache;
@@ -188,6 +193,10 @@ public TypeFactory withModifier(TypeModifier mod)
188193
return new TypeFactory(typeCache, _parser, mods, _classLoader);
189194
}
190195

196+
/**
197+
* "Mutant factory" method which will construct a new instance with specified
198+
* {@link ClassLoader} to use by {@link #findClass}.
199+
*/
191200
public TypeFactory withClassLoader(ClassLoader classLoader) {
192201
return new TypeFactory(_typeCache, _parser, _modifiers, classLoader);
193202
}
@@ -281,7 +290,7 @@ public Class<?> findClass(String className) throws ClassNotFoundException
281290
Throwable prob = null;
282291
ClassLoader loader = this.getClassLoader();
283292
if (loader == null) {
284-
loader = Thread.currentThread().getContextClassLoader();
293+
loader = Thread.currentThread().getContextClassLoader();
285294
}
286295
if (loader != null) {
287296
try {

0 commit comments

Comments
 (0)