Skip to content

Commit b387940

Browse files
committed
Fix #2466
1 parent b2dde16 commit b387940

File tree

4 files changed

+23
-5
lines changed

4 files changed

+23
-5
lines changed

release-notes/CREDITS-2.x

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -956,6 +956,10 @@ Hesham Massoud (heshamMassoud@github)
956956
(2.10.0)
957957

958958
David Connelly (dconnelly@github)
959-
* Reported#2446: Java 11: Unable to load JDK7 types (annotations, java.nio.file.Path):
959+
* Reported #2446: Java 11: Unable to load JDK7 types (annotations, java.nio.file.Path):
960960
no Java7 support added
961961
(2.10.0)
962+
963+
Wahey (KevynBct@github)
964+
* Reported #2466: Didn't find class "java.nio.file.Path" below Android api 26
965+
(2.10.0)

release-notes/VERSION-2.x

Lines changed: 5 additions & 0 deletions
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+
#2466: Didn't find class "java.nio.file.Path" below Android api 26
10+
(reported by KevynBct@github)
11+
712
2.10.0.pr3 (17-Sep-2019)
813
914
#1093: Default typing does not work with `writerFor(Object.class)`

src/main/java/com/fasterxml/jackson/databind/ext/Java7HandlersImpl.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,30 @@
1010
*/
1111
public class Java7HandlersImpl extends Java7Handlers
1212
{
13+
private final Class<?> _pathClass;
14+
15+
public Java7HandlersImpl() {
16+
// 19-Sep-2019, tatu: Important to do this here, because otherwise
17+
// we get [databind#2466]
18+
_pathClass = Path.class;
19+
}
20+
1321
@Override
1422
public Class<?> getClassJavaNioFilePath() {
15-
return Path.class;
23+
return _pathClass;
1624
}
1725

1826
@Override
1927
public JsonDeserializer<?> getDeserializerForJavaNioFilePath(Class<?> rawType) {
20-
if (rawType == Path.class) {
28+
if (rawType == _pathClass) {
2129
return new NioPathDeserializer();
2230
}
2331
return null;
2432
}
2533

2634
@Override
2735
public JsonSerializer<?> getSerializerForJavaNioFilePath(Class<?> rawType) {
28-
if (Path.class.isAssignableFrom(rawType)) {
36+
if (_pathClass.isAssignableFrom(rawType)) {
2937
return new NioPathSerializer();
3038
}
3139
return null;

src/main/java/com/fasterxml/jackson/databind/ext/Java7SupportImpl.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ public class Java7SupportImpl extends Java7Support
1717
private final Class<?> _bogus;
1818

1919
public Java7SupportImpl() {
20-
// Trigger loading of annotations that only JDK 7 has...
20+
// Trigger loading of annotations that only JDK 7 has, to trigger
21+
// early fail (see [databind#2466])
2122
Class<?> cls = Transient.class;
2223
cls = ConstructorProperties.class;
2324
_bogus = cls;

0 commit comments

Comments
 (0)