diff --git a/material/samples/app/src/main/java/null_safety_java/App.java b/material/samples/app/src/main/java/null_safety_java/App.java index 2bf3b857..ad282c29 100644 --- a/material/samples/app/src/main/java/null_safety_java/App.java +++ b/material/samples/app/src/main/java/null_safety_java/App.java @@ -9,6 +9,9 @@ public class App { public static void main(String[] args) { + + int length = getLength(null); + @Nonnull String name; name = null; // warning @@ -19,9 +22,14 @@ public static void main(String[] args) { System.out.println(name2 == null ? 0 : name2.length()); } + public static int getLength(String name) { + return name.length(); + } + public static int getLength2(@Nullable String name) { if (name == null) return 0; return name.length(); } + }