Loading core/java/com/android/internal/util/Preconditions.java +4 −20 Original line number Diff line number Diff line Loading @@ -126,7 +126,9 @@ public class Preconditions { * @param reference an object reference * @return the non-null reference that was validated * @throws NullPointerException if {@code reference} is null * @deprecated - use {@link java.util.Objects.requireNonNull} instead. */ @Deprecated @UnsupportedAppUsage public static @NonNull <T> T checkNotNull(final T reference) { if (reference == null) { Loading @@ -144,7 +146,9 @@ public class Preconditions { * be converted to a string using {@link String#valueOf(Object)} * @return the non-null reference that was validated * @throws NullPointerException if {@code reference} is null * @deprecated - use {@link java.util.Objects.requireNonNull} instead. */ @Deprecated @UnsupportedAppUsage public static @NonNull <T> T checkNotNull(final T reference, final Object errorMessage) { if (reference == null) { Loading @@ -153,26 +157,6 @@ public class Preconditions { return reference; } /** * Ensures that an object reference passed as a parameter to the calling * method is not null. * * @param reference an object reference * @param messageTemplate a printf-style message template to use if the check fails; will * be converted to a string using {@link String#format(String, Object...)} * @param messageArgs arguments for {@code messageTemplate} * @return the non-null reference that was validated * @throws NullPointerException if {@code reference} is null */ public static @NonNull <T> T checkNotNull(final T reference, final String messageTemplate, final Object... messageArgs) { if (reference == null) { throw new NullPointerException(String.format(messageTemplate, messageArgs)); } return reference; } /** * Ensures the truth of an expression involving the state of the calling * instance, but not involving any parameters to the calling method. Loading Loading
core/java/com/android/internal/util/Preconditions.java +4 −20 Original line number Diff line number Diff line Loading @@ -126,7 +126,9 @@ public class Preconditions { * @param reference an object reference * @return the non-null reference that was validated * @throws NullPointerException if {@code reference} is null * @deprecated - use {@link java.util.Objects.requireNonNull} instead. */ @Deprecated @UnsupportedAppUsage public static @NonNull <T> T checkNotNull(final T reference) { if (reference == null) { Loading @@ -144,7 +146,9 @@ public class Preconditions { * be converted to a string using {@link String#valueOf(Object)} * @return the non-null reference that was validated * @throws NullPointerException if {@code reference} is null * @deprecated - use {@link java.util.Objects.requireNonNull} instead. */ @Deprecated @UnsupportedAppUsage public static @NonNull <T> T checkNotNull(final T reference, final Object errorMessage) { if (reference == null) { Loading @@ -153,26 +157,6 @@ public class Preconditions { return reference; } /** * Ensures that an object reference passed as a parameter to the calling * method is not null. * * @param reference an object reference * @param messageTemplate a printf-style message template to use if the check fails; will * be converted to a string using {@link String#format(String, Object...)} * @param messageArgs arguments for {@code messageTemplate} * @return the non-null reference that was validated * @throws NullPointerException if {@code reference} is null */ public static @NonNull <T> T checkNotNull(final T reference, final String messageTemplate, final Object... messageArgs) { if (reference == null) { throw new NullPointerException(String.format(messageTemplate, messageArgs)); } return reference; } /** * Ensures the truth of an expression involving the state of the calling * instance, but not involving any parameters to the calling method. Loading