jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/358976 )

Change subject: Hygiene: Add some NonNull annotations where necessary.
......................................................................


Hygiene: Add some NonNull annotations where necessary.

This may help us chase down NPEs in the future.

Change-Id: I7eed25f07be707ba698aaafd08ea304f017ba66d
---
M app/src/main/java/org/wikipedia/history/HistoryEntry.java
M app/src/main/java/org/wikipedia/page/PageActivity.java
M app/src/main/java/org/wikipedia/page/PageFragment.java
3 files changed, 25 insertions(+), 28 deletions(-)

Approvals:
  jenkins-bot: Verified
  Mholloway: Looks good to me, approved



diff --git a/app/src/main/java/org/wikipedia/history/HistoryEntry.java 
b/app/src/main/java/org/wikipedia/history/HistoryEntry.java
index 89f9f3e..be9feb0 100644
--- a/app/src/main/java/org/wikipedia/history/HistoryEntry.java
+++ b/app/src/main/java/org/wikipedia/history/HistoryEntry.java
@@ -48,7 +48,7 @@
         this(title, timestamp, source, 0);
     }
 
-    public HistoryEntry(PageTitle title, int source) {
+    public HistoryEntry(@NonNull PageTitle title, int source) {
         this(title, new Date(), source);
     }
 
diff --git a/app/src/main/java/org/wikipedia/page/PageActivity.java 
b/app/src/main/java/org/wikipedia/page/PageActivity.java
index 87736cb..eccc44a 100644
--- a/app/src/main/java/org/wikipedia/page/PageActivity.java
+++ b/app/src/main/java/org/wikipedia/page/PageActivity.java
@@ -326,7 +326,7 @@
      * @param title Title of the page to load.
      * @param entry HistoryEntry associated with this page.
      */
-    public void loadPage(PageTitle title, HistoryEntry entry) {
+    public void loadPage(@NonNull PageTitle title, @NonNull HistoryEntry 
entry) {
         loadPage(title, entry, TabPosition.CURRENT_TAB);
     }
 
@@ -339,9 +339,9 @@
      *                 foreground tab.
      */
     @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
-    public void loadPage(final PageTitle title,
-                         final HistoryEntry entry,
-                         final TabPosition position) {
+    public void loadPage(@NonNull final PageTitle title,
+                         @NonNull final HistoryEntry entry,
+                         @NonNull final TabPosition position) {
         if (isDestroyed()) {
             return;
         }
@@ -380,7 +380,7 @@
         });
     }
 
-    public void loadPageInForegroundTab(PageTitle title, HistoryEntry entry) {
+    public void loadPageInForegroundTab(@NonNull PageTitle title, @NonNull 
HistoryEntry entry) {
         loadPage(title, entry, TabPosition.NEW_TAB_FOREGROUND);
     }
 
@@ -402,11 +402,11 @@
         loadPage(title, historyEntry, position);
     }
 
-    public void showLinkPreview(PageTitle title, int entrySource) {
+    public void showLinkPreview(@NonNull PageTitle title, int entrySource) {
         showLinkPreview(title, entrySource, null);
     }
 
-    public void showLinkPreview(PageTitle title, int entrySource, @Nullable 
Location location) {
+    public void showLinkPreview(@NonNull PageTitle title, int entrySource, 
@Nullable Location location) {
         bottomSheetPresenter.show(getSupportFragmentManager(),
                 LinkPreviewDialog.newInstance(title, entrySource, location));
     }
@@ -704,7 +704,7 @@
         saveState(outState);
     }
 
-    private void saveState(Bundle outState) {
+    private void saveState(@NonNull Bundle outState) {
         outState.putBoolean("isSearching", isSearching());
         outState.putString(LANGUAGE_CODE_BUNDLE_KEY, 
app.getAppOrSystemLanguageCode());
     }
diff --git a/app/src/main/java/org/wikipedia/page/PageFragment.java 
b/app/src/main/java/org/wikipedia/page/PageFragment.java
index 8f34054..c878f65 100755
--- a/app/src/main/java/org/wikipedia/page/PageFragment.java
+++ b/app/src/main/java/org/wikipedia/page/PageFragment.java
@@ -443,7 +443,7 @@
         webView.setWebViewClient(new OkHttpWebViewClient());
     }
 
-    private void handleInternalLink(PageTitle title) {
+    private void handleInternalLink(@NonNull PageTitle title) {
         if (!isResumed()) {
             return;
         }
@@ -592,7 +592,7 @@
         tabsProvider.invalidate();
     }
 
-    public void openInNewBackgroundTabFromMenu(PageTitle title, HistoryEntry 
entry) {
+    public void openInNewBackgroundTabFromMenu(@NonNull PageTitle title, 
@NonNull HistoryEntry entry) {
         if (noPagesOpen()) {
             openInNewForegroundTabFromMenu(title, entry);
         } else {
@@ -601,19 +601,17 @@
         }
     }
 
-    public void openInNewForegroundTabFromMenu(PageTitle title, HistoryEntry 
entry) {
+    public void openInNewForegroundTabFromMenu(@NonNull PageTitle title, 
@NonNull HistoryEntry entry) {
         openInNewTabFromMenu(title, entry, getForegroundTabPosition());
         pageFragmentLoadState.loadFromBackStack();
     }
 
-    public void openInNewTabFromMenu(PageTitle title,
-                                     HistoryEntry entry,
-                                     int position) {
+    public void openInNewTabFromMenu(@NonNull PageTitle title, @NonNull 
HistoryEntry entry, int position) {
         openInNewTab(title, entry, position);
         tabFunnel.logOpenInNew(tabList.size());
     }
 
-    public void loadPage(PageTitle title, HistoryEntry entry, boolean 
pushBackStack) {
+    public void loadPage(@NonNull PageTitle title, @NonNull HistoryEntry 
entry, boolean pushBackStack) {
         //is the new title the same as what's already being displayed?
         if (!getCurrentTab().getBackStack().isEmpty()
                 && 
getCurrentTab().getBackStack().get(getCurrentTab().getBackStack().size() - 1)
@@ -629,13 +627,13 @@
         loadPage(title, entry, pushBackStack, 0);
     }
 
-    public void loadPage(PageTitle title, HistoryEntry entry, boolean 
pushBackStack,
-                         int stagedScrollY) {
+    public void loadPage(@NonNull PageTitle title, @NonNull HistoryEntry entry,
+                         boolean pushBackStack, int stagedScrollY) {
         loadPage(title, entry, pushBackStack, stagedScrollY, false);
     }
 
-    public void loadPage(PageTitle title, HistoryEntry entry, boolean 
pushBackStack,
-                         boolean pageRefreshed) {
+    public void loadPage(@NonNull PageTitle title, @NonNull HistoryEntry entry,
+                         boolean pushBackStack, boolean pageRefreshed) {
         loadPage(title, entry, pushBackStack, 0, pageRefreshed);
     }
 
@@ -648,8 +646,8 @@
      * @param entry HistoryEntry associated with the new page.
      * @param pushBackStack Whether to push the new page onto the backstack.
      */
-    public void loadPage(PageTitle title, HistoryEntry entry, boolean 
pushBackStack,
-                         int stagedScrollY, boolean pageRefreshed) {
+    public void loadPage(@NonNull PageTitle title, @NonNull HistoryEntry entry,
+                         boolean pushBackStack, int stagedScrollY, boolean 
pageRefreshed) {
         // update the time spent reading of the current page, before loading 
the new one
         addTimeSpentReading(activeTimer.getElapsedSec());
         activeTimer.reset();
@@ -890,7 +888,7 @@
      * Scroll to a specific section in the WebView.
      * @param sectionAnchor Anchor link of the section to scroll to.
      */
-    public void scrollToSection(String sectionAnchor) {
+    public void scrollToSection(@NonNull String sectionAnchor) {
         if (!isAdded() || tocHandler == null) {
             return;
         }
@@ -915,7 +913,7 @@
         }
     }
 
-    public void onPageLoadError(Throwable caught) {
+    public void onPageLoadError(@NonNull Throwable caught) {
         if (!isAdded()) {
             return;
         }
@@ -991,7 +989,7 @@
         }
     }
 
-    private void setupToC(PageViewModel model, boolean isFirstPage) {
+    private void setupToC(@NonNull PageViewModel model, boolean isFirstPage) {
         tocHandler.setupToC(model.getPage(), model.getTitle().getWikiSite(), 
isFirstPage);
         tocHandler.setEnabled(true);
     }
@@ -1007,8 +1005,7 @@
 
     private void setBookmarkIconForPageSavedState(boolean pageSaved) {
         pageSavedToList = pageSaved;
-        TabLayout.Tab bookmarkTab
-                = tabLayout.getTabAt(PageActionTab.ADD_TO_READING_LIST.code());
+        TabLayout.Tab bookmarkTab = 
tabLayout.getTabAt(PageActionTab.ADD_TO_READING_LIST.code());
         if (bookmarkTab != null) {
             bookmarkTab.setIcon(pageSaved ? R.drawable.ic_bookmark_white_24dp
                     : R.drawable.ic_bookmark_border_white_24dp);
@@ -1038,7 +1035,7 @@
         });
     }
 
-    private void openInNewTab(PageTitle title, HistoryEntry entry, int 
position) {
+    private void openInNewTab(@NonNull PageTitle title, @NonNull HistoryEntry 
entry, int position) {
         if (shouldCreateNewTab()) {
             // create a new tab
             Tab tab = new Tab();

-- 
To view, visit https://gerrit.wikimedia.org/r/358976
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I7eed25f07be707ba698aaafd08ea304f017ba66d
Gerrit-PatchSet: 2
Gerrit-Project: apps/android/wikipedia
Gerrit-Branch: master
Gerrit-Owner: Dbrant <[email protected]>
Gerrit-Reviewer: Brion VIBBER <[email protected]>
Gerrit-Reviewer: Mholloway <[email protected]>
Gerrit-Reviewer: Niedzielski <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to