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

Apply Nullsafe FIXMEs for xplat/js/react-native-github/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/BundleDownloader.java #50065

Closed
wants to merge 13 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Apply Nullsafe FIXMEs for xplat/js/react-native-github/packages/react…
…-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/StackTraceHelper.java

Summary:
Note this diff is only adding FIXMEs that will be removed in the next diff. This diff exists to make the next diff easily reviewable

Changelog: [Internal]

Differential Revision: D71126384
GijsWeterings authored and facebook-github-bot committed Mar 17, 2025
commit d967c8e71a7b892c6a1f09484742352ded956b28
Original file line number Diff line number Diff line change
@@ -137,23 +137,34 @@ public static StackFrame[] convertJsStackTrace(@Nullable ReadableArray stack) {
int size = stack != null ? stack.size() : 0;
StackFrame[] result = new StackFrame[size];
for (int i = 0; i < size; i++) {
// NULLSAFE_FIXME[Nullable Dereference]
ReadableType type = stack.getType(i);
if (type == ReadableType.Map) {
// NULLSAFE_FIXME[Nullable Dereference]
ReadableMap frame = stack.getMap(i);
// NULLSAFE_FIXME[Nullable Dereference]
String methodName = frame.getString("methodName");
// NULLSAFE_FIXME[Nullable Dereference]
String fileName = frame.getString("file");
boolean collapse =
// NULLSAFE_FIXME[Nullable Dereference]
frame.hasKey("collapse") && !frame.isNull("collapse") && frame.getBoolean("collapse");
int lineNumber = -1;
// NULLSAFE_FIXME[Nullable Dereference]
if (frame.hasKey(LINE_NUMBER_KEY) && !frame.isNull(LINE_NUMBER_KEY)) {
// NULLSAFE_FIXME[Nullable Dereference]
lineNumber = frame.getInt(LINE_NUMBER_KEY);
}
int columnNumber = -1;
// NULLSAFE_FIXME[Nullable Dereference]
if (frame.hasKey(COLUMN_KEY) && !frame.isNull(COLUMN_KEY)) {
// NULLSAFE_FIXME[Nullable Dereference]
columnNumber = frame.getInt(COLUMN_KEY);
}
// NULLSAFE_FIXME[Parameter Not Nullable]
result[i] = new StackFrameImpl(fileName, methodName, lineNumber, columnNumber, collapse);
} else if (type == ReadableType.String) {
// NULLSAFE_FIXME[Parameter Not Nullable, Nullable Dereference]
result[i] = new StackFrameImpl(null, stack.getString(i), -1, -1);
}
}
@@ -203,14 +214,18 @@ public static StackFrame[] convertJsStackTrace(String stack) {
} else if (matcher1.find()) {
matcher = matcher1;
} else {
// NULLSAFE_FIXME[Parameter Not Nullable]
result[i] = new StackFrameImpl(null, stackTrace[i], -1, -1);
continue;
}
result[i] =
new StackFrameImpl(
// NULLSAFE_FIXME[Parameter Not Nullable]
matcher.group(2),
matcher.group(1) == null ? "(unknown)" : matcher.group(1),
// NULLSAFE_FIXME[Parameter Not Nullable]
Integer.parseInt(matcher.group(3)),
// NULLSAFE_FIXME[Parameter Not Nullable]
Integer.parseInt(matcher.group(4)));
}
return result;
@@ -224,6 +239,7 @@ public static StackFrame[] convertJavaStackTrace(Throwable exception) {
result[i] =
new StackFrameImpl(
stackTrace[i].getClassName(),
// NULLSAFE_FIXME[Parameter Not Nullable]
stackTrace[i].getFileName(),
stackTrace[i].getMethodName(),
stackTrace[i].getLineNumber(),