Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit de08dbd7 authored by Paul Duffin's avatar Paul Duffin
Browse files

Temporarily remove @Nullable from findViewById(int) methods

Previously, Metalava had a nasty hack that would ignore the `@Nullable`
annotation present in the source code definition of any
`findViewById(int)` methods. This change explicitly removes the
annotations from the source code which will allow the Metalava hack to
be removed.

Longer term, the calls to `findViewById(int)` that would be broken
because they treat the returned value as being `@NonNull` will be
replaced with `requireViewById(int)`.

Bug: 347204084
Test: m droid
Change-Id: Ie67b40dd3321f403bcecffddd11453038b2329a9
parent d67cb978
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -3579,7 +3579,7 @@ public class Activity extends ContextThemeWrapper
     * @see View#findViewById(int)
     * @see Activity#requireViewById(int)
     */
    @Nullable
    /* TODO(b/347672184): Re-add @Nullable */
    public <T extends View> T findViewById(@IdRes int id) {
        return getWindow().findViewById(id);
    }
+1 −1
Original line number Diff line number Diff line
@@ -565,7 +565,7 @@ public class Dialog implements DialogInterface, Window.Callback,
     * @see View#findViewById(int)
     * @see Dialog#requireViewById(int)
     */
    @Nullable
    /* TODO(b/347672184): Re-add @Nullable */
    public <T extends View> T findViewById(@IdRes int id) {
        return mWindow.findViewById(id);
    }
+1 −1
Original line number Diff line number Diff line
@@ -523,7 +523,7 @@ public class DreamService extends Service implements Window.Callback {
     * @see View#findViewById(int)
     * @see DreamService#requireViewById(int)
     */
    @Nullable
    /* TODO(b/347672184): Re-add @Nullable */
    public <T extends View> T findViewById(@IdRes int id) {
        return getWindow().findViewById(id);
    }
+1 −1
Original line number Diff line number Diff line
@@ -26858,7 +26858,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     * @return a view with given ID if found, or {@code null} otherwise
     * @see View#requireViewById(int)
     */
    @Nullable
    /* TODO(b/347672184): Re-add @Nullable */
    public final <T extends View> T findViewById(@IdRes int id) {
        if (id == NO_ID) {
            return null;
+1 −1
Original line number Diff line number Diff line
@@ -1632,7 +1632,7 @@ public abstract class Window {
     * @see View#findViewById(int)
     * @see Window#requireViewById(int)
     */
    @Nullable
    /* TODO(b/347672184): Re-add @Nullable */
    public <T extends View> T findViewById(@IdRes int id) {
        return getDecorView().findViewById(id);
    }