From 9e91be3541fe33e8c3fe0298bf70f5b132e1c7d2 Mon Sep 17 00:00:00 2001 From: John Reck Date: Thu, 12 Aug 2021 17:12:10 -0400 Subject: [PATCH] Fix Nullability annotation The initial commit of the @Nullable annotation appears to have been based off of the javadocs. However, the actual code does not appear to have allowed for null at that time. It's not entirely clear if null was ever allowed, but it hasn't been allowed since API 14 at least Test: make Fixes: 195924626 Change-Id: Ibffdc7b90cbfc3bc65a4a08bee52e2e3412bed3e --- core/api/current.txt | 2 +- graphics/java/android/graphics/Canvas.java | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/core/api/current.txt b/core/api/current.txt index dd7f37745f875..1515bbf26fbc1 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -14971,7 +14971,7 @@ package android.graphics { method public void drawTextRun(@NonNull android.graphics.text.MeasuredText, int, int, int, int, float, float, boolean, @NonNull android.graphics.Paint); method public void drawVertices(@NonNull android.graphics.Canvas.VertexMode, int, @NonNull float[], int, @Nullable float[], int, @Nullable int[], int, @Nullable short[], int, int, @NonNull android.graphics.Paint); method public void enableZ(); - method public boolean getClipBounds(@Nullable android.graphics.Rect); + method public boolean getClipBounds(@NonNull android.graphics.Rect); method @NonNull public final android.graphics.Rect getClipBounds(); method public int getDensity(); method @Nullable public android.graphics.DrawFilter getDrawFilter(); diff --git a/graphics/java/android/graphics/Canvas.java b/graphics/java/android/graphics/Canvas.java index 81aeec07db9ed..abf7e99110864 100644 --- a/graphics/java/android/graphics/Canvas.java +++ b/graphics/java/android/graphics/Canvas.java @@ -1272,11 +1272,10 @@ public class Canvas extends BaseCanvas { * in a way similar to quickReject, in that it tells you that drawing * outside of these bounds will be clipped out. * - * @param bounds Return the clip bounds here. If it is null, ignore it but - * still return true if the current clip is non-empty. + * @param bounds Return the clip bounds here. * @return true if the current clip is non-empty. */ - public boolean getClipBounds(@Nullable Rect bounds) { + public boolean getClipBounds(@NonNull Rect bounds) { return nGetClipBounds(mNativeCanvasWrapper, bounds); }