Skip to content

Commit

Permalink
Resolve several Java warnings on Hermes Intl (#1553)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #1553

This clears up all the warnings in Intl coming from Xdeprecated and Xunchecked

Reviewed By: neildhar

Differential Revision: D65135162

fbshipit-source-id: 95796e29b23f1aad680e63c648da7e9b5524b75a
  • Loading branch information
cortinico authored and facebook-github-bot committed Oct 30, 2024
1 parent 5ce6d23 commit 0b92287
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@ public static boolean isBoolean(Object object) {
}

public static Object newBoolean() {
return new Boolean(false);
return Boolean.FALSE;
}

public static Object newBoolean(boolean b) {
return new Boolean(b);
return b;
}

public static Object newBoolean(String str) {
Expand All @@ -81,7 +81,7 @@ public static boolean isNumber(Object object) {
}

public static Object newNumber(double d) {
return new Double(d);
return d;
}

public static double getJavaDouble(Object object) {
Expand All @@ -100,6 +100,7 @@ public static boolean isObject(Object object) {
return object instanceof HashMap;
}

@SuppressWarnings("unchecked")
public static Map<String, Object> getJavaMap(Object object) {
return (HashMap<String, Object>) object;
}
Expand All @@ -108,6 +109,7 @@ public static Object newObject() {
return new HashMap<String, Object>();
}

@SuppressWarnings("unchecked")
public static Object Get(Object options, String property) {
HashMap<String, Object> javaObject = (HashMap<String, Object>) options;
if (javaObject.containsKey(property)) {
Expand All @@ -119,6 +121,7 @@ public static Object Get(Object options, String property) {
}
}

@SuppressWarnings("unchecked")
public static void Put(Object options, String property, Object value) {
HashMap<String, Object> javaObject = (HashMap<String, Object>) options;
javaObject.put(property, value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -872,7 +872,7 @@ static void parseOtherExtensions(
}

ArrayList<String> otherExtensions = new ArrayList<>();
parsedLocaleIdentifier.otherExtensionsMap.put(new Character(singleton), otherExtensions);
parsedLocaleIdentifier.otherExtensionsMap.put(Character.valueOf(singleton), otherExtensions);

while (nextSubtag.isOtherExtension()) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public class PlatformNumberFormatterICU implements IPlatformNumberFormatter {
PlatformNumberFormatterICU() {}

@RequiresApi(api = Build.VERSION_CODES.N)
@SuppressWarnings("deprecation")
private void initialize(
NumberFormat numberFormat,
ILocaleObject<?> localeObject,
Expand Down

0 comments on commit 0b92287

Please sign in to comment.