{"action":"opened","issue":{"url":"https://api.github.com/repos/googlesamples/android-architecture/issues/110","repository_url":"https://api.github.com/repos/googlesamples/android-architecture","labels_url":"https://api.github.com/repos/googlesamples/android-architecture/issues/110/labels{/name}","comments_url":"https://api.github.com/repos/googlesamples/android-architecture/issues/110/comments","events_url":"https://api.github.com/repos/googlesamples/android-architecture/issues/110/events","html_url":"https://github.com/googlesamples/android-architecture/issues/110","id":163482236,"number":110,"title":"@NonNull annotation and checkNotNull often missused","user":{"login":"samiuelson","id":4527432,"avatar_url":"https://avatars.githubusercontent.com/u/4527432?v=3","gravatar_id":"","url":"https://api.github.com/users/samiuelson","html_url":"https://github.com/samiuelson","followers_url":"https://api.github.com/users/samiuelson/followers","following_url":"https://api.github.com/users/samiuelson/following{/other_user}","gists_url":"https://api.github.com/users/samiuelson/gists{/gist_id}","starred_url":"https://api.github.com/users/samiuelson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/samiuelson/subscriptions","organizations_url":"https://api.github.com/users/samiuelson/orgs","repos_url":"https://api.github.com/users/samiuelson/repos","events_url":"https://api.github.com/users/samiuelson/events{/privacy}","received_events_url":"https://api.github.com/users/samiuelson/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-07-01T22:09:24Z","updated_at":"2016-07-01T22:09:24Z","closed_at":null,"body":"I noticed very incorrect usage of `checkNotNull()` guava method for objects with `@NonNull` annotations. \r\nExample from TasksPresenter class:\r\n\r\n```\r\n@Override\r\n    public void openTaskDetails(@NonNull Task requestedTask) {\r\n        checkNotNull(requestedTask, \"requestedTask cannot be null!\");\r\n        mTasksView.showTaskDetailsUi(requestedTask.getId());\r\n    }\r\n\r\n    @Override\r\n    public void completeTask(@NonNull Task completedTask) {\r\n        checkNotNull(completedTask, \"completedTask cannot be null!\");\r\n        mTasksRepository.completeTask(completedTask);\r\n        mTasksView.showTaskMarkedComplete();\r\n        loadTasks(false, false);\r\n    }\r\n\r\n    @Override\r\n    public void activateTask(@NonNull Task activeTask) {\r\n        checkNotNull(activeTask, \"activeTask cannot be null!\");\r\n        mTasksRepository.activateTask(activeTask);\r\n        mTasksView.showTaskMarkedActive();\r\n        loadTasks(false, false);\r\n    }\r\n```\r\nGuys, read the docs please. `@NonNull` is used to assure that related to it object is never ever null. The `checkNotNull()` is used incorrectly. `checkNotNull()` could be called before passing some object in every of these methods above. \r\nIt's not the only class. Such type mistakes are very common among whole project."}}
{"actor":{"display_login":"samiuelson"}}