Skip to content

Commit

Permalink
Update StaticLayoutHelper params that received null value to Nullable
Browse files Browse the repository at this point in the history
Summary:
Runtime plugin showed null ellipsize, leftIndents, and rightIndents passed into make.

## Context
We are in the process of making the entire codebase Nullsafe. This diff relies on a runtime codemod to track when null is passed into a parameter that is not marked as Nullable in java. Based on runtime data, we can be 100% certain that this parameter needs to be Nullable

Reviewed By: jocelynluizzi13

Differential Revision: D60586639

fbshipit-source-id: e2321e611ab96d1a9c4e77b9087fa6865b3794b2
  • Loading branch information
Philip Corriveau authored and facebook-github-bot committed Aug 1, 2024
1 parent b94c5bc commit 327d742
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import android.text.StaticLayout;
import android.text.TextPaint;
import android.text.TextUtils;
import androidx.annotation.Nullable;
import androidx.core.text.TextDirectionHeuristicCompat;
import com.facebook.fbui.textlayoutbuilder.proxy.StaticLayoutProxy;
import java.lang.reflect.Field;
Expand Down Expand Up @@ -59,7 +60,7 @@ private static StaticLayout getStaticLayoutMaybeMaxLines(
float spacingMult,
float spacingAdd,
boolean includePadding,
TextUtils.TruncateAt ellipsize,
@Nullable TextUtils.TruncateAt ellipsize,
int ellipsisWidth,
int maxLines,
TextDirectionHeuristicCompat textDirection) {
Expand Down Expand Up @@ -122,7 +123,7 @@ private static StaticLayout getStaticLayoutNoMaxLines(
float spacingMult,
float spacingAdd,
boolean includePadding,
TextUtils.TruncateAt ellipsize,
@Nullable TextUtils.TruncateAt ellipsize,
int ellipsisWidth) {

return new StaticLayout(
Expand Down Expand Up @@ -172,15 +173,15 @@ public static StaticLayout make(
float spacingMult,
float spacingAdd,
boolean includePadding,
TextUtils.TruncateAt ellipsize,
@Nullable TextUtils.TruncateAt ellipsize,
int ellipsisWidth,
int maxLines,
TextDirectionHeuristicCompat textDirection,
int breakStrategy,
int hyphenationFrequency,
int justificationMode,
int[] leftIndents,
int[] rightIndents,
@Nullable int[] leftIndents,
@Nullable int[] rightIndents,
boolean useLineSpacingFromFallbacks) {

if (Build.VERSION.SDK_INT >= 23) {
Expand Down

0 comments on commit 327d742

Please sign in to comment.