Skip to content

Commit

Permalink
[J2KT] Update NotNullAssertionProblems readable with array literal …
Browse files Browse the repository at this point in the history
…with single value.

PiperOrigin-RevId: 717903919
  • Loading branch information
Googler authored and copybara-github committed Jan 21, 2025
1 parent a991033 commit d42c6e7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,15 @@
@NullMarked
public class NotNullAssertionProblems {
public void testArrayLiteral(String string, @Nullable String nullableString) {
@Nullable String[] array0 = {null};
@Nullable String[] array1 = {string, null};
@Nullable String[] array2 = {string, nullableString};
@Nullable String[] array3 = {null, string};
@Nullable String[] array4 = {nullableString, string};
}

public void testNewArray(String string, @Nullable String nullableString) {
@Nullable String[] array0 = new @Nullable String[] {null};
@Nullable String[] array1 = new @Nullable String[] {string, null};
@Nullable String[] array2 = new @Nullable String[] {string, nullableString};
@Nullable String[] array3 = new @Nullable String[] {null, string};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ open class NotNullAssertionProblems {
@ObjCName("withNSString") string: String,
@ObjCName("withNSString") nullableString: String?
) {
val array0: Array<String?>? = arrayOf<String>(null!!) as Array<String?>?
val array1: Array<String?>? = arrayOf<String>(string, null!!) as Array<String?>?
val array2: Array<String?>? = arrayOf<String>(string, nullableString!!) as Array<String?>?
val array3: Array<String?>? = arrayOf<String>(null!!, string) as Array<String?>?
Expand All @@ -48,6 +49,7 @@ open class NotNullAssertionProblems {
@ObjCName("withNSString") string: String,
@ObjCName("withNSString") nullableString: String?
) {
val array0: Array<String?>? = arrayOf<String?>(null)
val array1: Array<String?>? = arrayOf<String?>(string, null)
val array2: Array<String?>? = arrayOf<String?>(string, nullableString)
val array3: Array<String?>? = arrayOf<String?>(null, string)
Expand Down

0 comments on commit d42c6e7

Please sign in to comment.