jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/335099 )
Change subject: Hygiene: add Page @NonNull / @Nullable annotations ...................................................................... Hygiene: add Page @NonNull / @Nullable annotations Add missing @NonNull / @Nullable annotations as inferred by existing constructor annotations and final. Remove redundant null check in DescriptionEditClient Change-Id: Ia657ef88f78f653229f61a6d929b5cc10ff54dbf --- M app/src/main/java/org/wikipedia/descriptions/DescriptionEditClient.java M app/src/main/java/org/wikipedia/page/Page.java 2 files changed, 17 insertions(+), 23 deletions(-) Approvals: jenkins-bot: Verified Mholloway: Looks good to me, approved diff --git a/app/src/main/java/org/wikipedia/descriptions/DescriptionEditClient.java b/app/src/main/java/org/wikipedia/descriptions/DescriptionEditClient.java index 2a86efb..51e8344 100644 --- a/app/src/main/java/org/wikipedia/descriptions/DescriptionEditClient.java +++ b/app/src/main/java/org/wikipedia/descriptions/DescriptionEditClient.java @@ -42,8 +42,7 @@ public static boolean isEditAllowed(@NonNull Page page) { PageProperties props = page.getPageProperties(); - return props != null - && props.canEdit() + return props.canEdit() && !TextUtils.isEmpty(props.getWikiBaseItem()) && ENABLED_LANGUAGES.contains(page.getTitle().getWikiSite().languageCode()); } diff --git a/app/src/main/java/org/wikipedia/page/Page.java b/app/src/main/java/org/wikipedia/page/Page.java index 8b6b3fd..3c93637 100755 --- a/app/src/main/java/org/wikipedia/page/Page.java +++ b/app/src/main/java/org/wikipedia/page/Page.java @@ -17,14 +17,12 @@ * Represents a particular page along with its full contents. */ public class Page { - @VisibleForTesting - static final int MEDIAWIKI_ORIGIN = 0; - @VisibleForTesting - static final int RESTBASE_ORIGIN = 1; + @VisibleForTesting static final int MEDIAWIKI_ORIGIN = 0; + @VisibleForTesting static final int RESTBASE_ORIGIN = 1; - private final PageTitle title; - private final List<Section> sections; - private final PageProperties pageProperties; + @NonNull private final PageTitle title; + @NonNull private final List<Section> sections; + @NonNull private final PageProperties pageProperties; /** * The media gallery collection associated with this page. @@ -32,7 +30,7 @@ * the page cache because the page itself is cached. Subsequent instances of the Gallery * activity will then be able to retrieve the page's gallery collection from cache. */ - private GalleryCollection galleryCollection; + @Nullable private GalleryCollection galleryCollection; /** * An indicator what payload version the page content was originally retrieved from. @@ -42,10 +40,11 @@ */ private int version = MEDIAWIKI_ORIGIN; - public GalleryCollection getGalleryCollection() { + @Nullable public GalleryCollection getGalleryCollection() { return galleryCollection; } - public void setGalleryCollection(GalleryCollection collection) { + + public void setGalleryCollection(@Nullable GalleryCollection collection) { galleryCollection = collection; } @@ -77,11 +76,11 @@ return version == RESTBASE_ORIGIN; } - public PageTitle getTitle() { + @NonNull public PageTitle getTitle() { return title; } - public List<Section> getSections() { + @NonNull public List<Section> getSections() { return sections; } @@ -89,12 +88,11 @@ return pageProperties.getDisplayTitle(); } - @Nullable - public String getTitlePronunciationUrl() { + @Nullable public String getTitlePronunciationUrl() { return getPageProperties().getTitlePronunciationUrl(); } - public PageProperties getPageProperties() { + @NonNull public PageProperties getPageProperties() { return pageProperties; } @@ -102,8 +100,7 @@ return getTitle().namespace() == Namespace.MAIN; } - @Override - public boolean equals(Object o) { + @Override public boolean equals(Object o) { if (!(o instanceof Page)) { return false; } @@ -114,16 +111,14 @@ && pageProperties.equals(other.pageProperties); } - @Override - public int hashCode() { + @Override public int hashCode() { int result = title.hashCode(); result = 31 * result + sections.hashCode(); result = 31 * result + pageProperties.hashCode(); return result; } - @Override - public String toString() { + @Override public String toString() { return "Page{" + "title=" + title + ", sections=" + sections -- To view, visit https://gerrit.wikimedia.org/r/335099 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ia657ef88f78f653229f61a6d929b5cc10ff54dbf Gerrit-PatchSet: 1 Gerrit-Project: apps/android/wikipedia Gerrit-Branch: master Gerrit-Owner: Niedzielski <sniedziel...@wikimedia.org> Gerrit-Reviewer: Brion VIBBER <br...@wikimedia.org> Gerrit-Reviewer: Dbrant <dbr...@wikimedia.org> Gerrit-Reviewer: Mholloway <mhollo...@wikimedia.org> Gerrit-Reviewer: Sniedzielski <sniedziel...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits