Skip to content

Commit c8fd50f

Browse files
authored
Seems like java.nio.file.Path is safe for Android API level 26 (#3708)
1 parent 958677f commit c8fd50f

File tree

3 files changed

+17
-35
lines changed

3 files changed

+17
-35
lines changed

pom.xml

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -242,26 +242,22 @@
242242
mvn animal-sniffer:check
243243
-->
244244
<plugin>
245-
<groupId>org.codehaus.mojo</groupId>
246-
<artifactId>animal-sniffer-maven-plugin</artifactId>
247-
<version>1.22</version>
248-
<configuration>
245+
<groupId>org.codehaus.mojo</groupId>
246+
<artifactId>animal-sniffer-maven-plugin</artifactId>
247+
<version>1.22</version>
248+
<configuration>
249249
<signature>
250250
<groupId>com.toasttab.android</groupId>
251251
<artifactId>gummy-bears-api-${version.android.sdk}</artifactId>
252252
<version>${version.android.sdk.signature}</version>
253253
</signature>
254-
<ignores>
254+
<ignores>
255255
<!-- These are only accessed (safely) via "Java7SupportImpl.java" so ignore
256256
-->
257-
<ignore>java.beans.ConstructorProperties</ignore>
258-
<ignore>java.beans.Transient</ignore>
259-
<ignore>java.nio.file.FileSystemNotFoundException</ignore>
260-
<ignore>java.nio.file.Path</ignore>
261-
<ignore>java.nio.file.Paths</ignore>
262-
<ignore>java.nio.file.spi.FileSystemProvider</ignore>
263-
</ignores>
264-
</configuration>
257+
<ignore>java.beans.ConstructorProperties</ignore>
258+
<ignore>java.beans.Transient</ignore>
259+
</ignores>
260+
</configuration>
265261
</plugin>
266262

267263
</plugins>

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

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,19 @@
22

33
import com.fasterxml.jackson.databind.JsonDeserializer;
44
import com.fasterxml.jackson.databind.JsonSerializer;
5-
import com.fasterxml.jackson.databind.util.ClassUtil;
65

76
/**
8-
* To support Java7-incomplete platforms, we will offer support for JDK 7
9-
* datatype(s) (that is, {@link java.nio.file.Path} through this class, loaded
10-
* dynamically; if loading fails, support will be missing.
11-
* This class is the non-JDK-7-dependent API, and {@link Java7HandlersImpl} is
12-
* JDK7-dependent implementation of functionality.
7+
* Since v2.15, {@link Java7HandlersImpl} is no longer loaded via reflection.
8+
* <p>
9+
* Prior to v2.15, this class supported Java7-incomplete platforms, specifically
10+
* platforms that do not support {@link java.nio.file.Path}.
11+
* </p>
1312
*
1413
* @since 2.10 (cleaved off of {@link Java7Support})
1514
*/
1615
public abstract class Java7Handlers
1716
{
18-
private final static Java7Handlers IMPL;
19-
20-
static {
21-
Java7Handlers impl = null;
22-
try {
23-
Class<?> cls = Class.forName("com.fasterxml.jackson.databind.ext.Java7HandlersImpl");
24-
impl = (Java7Handlers) ClassUtil.createInstance(cls, false);
25-
} catch (Throwable t) {
26-
// 09-Sep-2019, tatu: Could choose not to log this, but since this is less likely
27-
// to miss (than annotations), do it
28-
// 02-Nov-2020, Xakep_SDK: Remove java.logging module dependency
29-
// java.util.logging.Logger.getLogger(Java7Handlers.class.getName())
30-
// .warning("Unable to load JDK7 types (java.nio.file.Path): no Java7 type support added");
31-
}
32-
IMPL = impl;
33-
}
17+
private final static Java7Handlers IMPL = new Java7HandlersImpl();
3418

3519
public static Java7Handlers instance() {
3620
return IMPL;

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
import com.fasterxml.jackson.databind.JsonSerializer;
77

88
/**
9+
* Since v2.15, this is no longer loaded via reflection.
10+
*
911
* @since 2.10
1012
*/
1113
public class Java7HandlersImpl extends Java7Handlers

0 commit comments

Comments
 (0)