Skip to content

Commit

Permalink
Deprecate and mark for removal com.facebook.react.common.StandardChar…
Browse files Browse the repository at this point in the history
…sets (facebook#36779)

Summary:
Pull Request resolved: facebook#36779

Deprecate and mark for removal com.facebook.react.common.StandardCharsets, this class was originally created because java.nio.charset.StandardCharsets only exists in Android API level 19+

As part of this diff I also migrate all internal usages of  com.facebook.react.common.StandardCharsets

Changelog:
[Android][Deprecated] - Deprecate and mark for removal com.facebook.react.common.StandardCharsets, please use java.nio.charset.StandardCharsets instead

Reviewed By: rshest

Differential Revision: D44592721

fbshipit-source-id: 08b55c05374db51d50e8faf20c736851674b423d
  • Loading branch information
mdvacca committed Apr 4, 2023
1 parent 7023daa commit 69821aa
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@

import java.util.Arrays;
import java.util.List;
import javax.annotation.Nullable;

public class ArrayUtils {

public static float[] copyArray(float[] array) {
public static float[] copyArray(@Nullable float[] array) {
return array == null ? null : Arrays.copyOf(array, array.length);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@
* Not all versions of Android SDK have this class in nio package. This is the reason to have it
* around.
*/
public class StandardCharsets {
@Deprecated(
since = "Deprecated class since v0.73.0, please use java.nio.charset.StandardCharsets instead.",
forRemoval = true)
public final class StandardCharsets {

private StandardCharsets() {}

/** Eight-bit UCS Transformation Format */
public static final Charset UTF_8 = Charset.forName("UTF-8");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.bridge.WritableMap;
import com.facebook.react.common.StandardCharsets;
import com.facebook.react.common.network.OkHttpCallUtil;
import com.facebook.react.module.annotations.ReactModule;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
import com.facebook.react.bridge.ReactContext;
import com.facebook.react.bridge.WritableArray;
import com.facebook.react.bridge.WritableMap;
import com.facebook.react.common.StandardCharsets;
import com.facebook.react.common.network.OkHttpCallUtil;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.List;
import okhttp3.Call;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

package com.facebook.react.modules.network;

import com.facebook.react.common.StandardCharsets;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
Expand Down

0 comments on commit 69821aa

Please sign in to comment.