Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Seems like java.nio.file.Path is safe for Android API level 26 #3708

Merged
merged 2 commits into from
Dec 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 9 additions & 13 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -242,26 +242,22 @@
mvn animal-sniffer:check
-->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>animal-sniffer-maven-plugin</artifactId>
<version>1.22</version>
<configuration>
<groupId>org.codehaus.mojo</groupId>
<artifactId>animal-sniffer-maven-plugin</artifactId>
<version>1.22</version>
<configuration>
<signature>
<groupId>com.toasttab.android</groupId>
<artifactId>gummy-bears-api-${version.android.sdk}</artifactId>
<version>${version.android.sdk.signature}</version>
</signature>
<ignores>
<ignores>
<!-- These are only accessed (safely) via "Java7SupportImpl.java" so ignore
-->
<ignore>java.beans.ConstructorProperties</ignore>
<ignore>java.beans.Transient</ignore>
<ignore>java.nio.file.FileSystemNotFoundException</ignore>
<ignore>java.nio.file.Path</ignore>
<ignore>java.nio.file.Paths</ignore>
<ignore>java.nio.file.spi.FileSystemProvider</ignore>
</ignores>
</configuration>
<ignore>java.beans.ConstructorProperties</ignore>
<ignore>java.beans.Transient</ignore>
</ignores>
</configuration>
</plugin>

</plugins>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,19 @@

import com.fasterxml.jackson.databind.JsonDeserializer;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.util.ClassUtil;

/**
* To support Java7-incomplete platforms, we will offer support for JDK 7
* datatype(s) (that is, {@link java.nio.file.Path} through this class, loaded
* dynamically; if loading fails, support will be missing.
* This class is the non-JDK-7-dependent API, and {@link Java7HandlersImpl} is
* JDK7-dependent implementation of functionality.
* Since v2.15, {@link Java7HandlersImpl} is no longer loaded via reflection.
* <p>
* Prior to v2.15, this class supported Java7-incomplete platforms, specifically
* platforms that do not support {@link java.nio.file.Path}.
* </p>
*
* @since 2.10 (cleaved off of {@link Java7Support})
*/
public abstract class Java7Handlers
{
private final static Java7Handlers IMPL;

static {
Java7Handlers impl = null;
try {
Class<?> cls = Class.forName("com.fasterxml.jackson.databind.ext.Java7HandlersImpl");
impl = (Java7Handlers) ClassUtil.createInstance(cls, false);
} catch (Throwable t) {
// 09-Sep-2019, tatu: Could choose not to log this, but since this is less likely
// to miss (than annotations), do it
// 02-Nov-2020, Xakep_SDK: Remove java.logging module dependency
// java.util.logging.Logger.getLogger(Java7Handlers.class.getName())
// .warning("Unable to load JDK7 types (java.nio.file.Path): no Java7 type support added");
}
IMPL = impl;
}
private final static Java7Handlers IMPL = new Java7HandlersImpl();

public static Java7Handlers instance() {
return IMPL;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import com.fasterxml.jackson.databind.JsonSerializer;

/**
* Since v2.15, this is no longer loaded via reflection.
*
* @since 2.10
*/
public class Java7HandlersImpl extends Java7Handlers
Expand Down