{"action":"created","comment":{"url":"https://api.github.com/repos/eclipse/smarthome/pulls/comments/131079627","pull_request_review_id":54022938,"id":131079627,"diff_hunk":"@@ -251,7 +255,7 @@ public Rule add(Rule rule) {\n      * @param rule candidate for unique ID\n      * @return a rule with UID\n      */\n-    protected Rule initRuleId(String rUID, Rule rule) {\n+    protected @Nonnull Rule initRuleId(String rUID, Rule rule) {","path":"bundles/automation/org.eclipse.smarthome.automation.core/src/main/java/org/eclipse/smarthome/automation/core/internal/RuleRegistryImpl.java","position":38,"original_position":38,"commit_id":"2a1a7601b2cf1071a2d019001bab751139a256d4","original_commit_id":"2a1a7601b2cf1071a2d019001bab751139a256d4","user":{"login":"maggu2810","id":204670,"avatar_url":"https://avatars2.githubusercontent.com/u/204670?v=4","gravatar_id":"","url":"https://api.github.com/users/maggu2810","html_url":"https://github.com/maggu2810","followers_url":"https://api.github.com/users/maggu2810/followers","following_url":"https://api.github.com/users/maggu2810/following{/other_user}","gists_url":"https://api.github.com/users/maggu2810/gists{/gist_id}","starred_url":"https://api.github.com/users/maggu2810/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maggu2810/subscriptions","organizations_url":"https://api.github.com/users/maggu2810/orgs","repos_url":"https://api.github.com/users/maggu2810/repos","events_url":"https://api.github.com/users/maggu2810/events{/privacy}","received_events_url":"https://api.github.com/users/maggu2810/received_events","type":"User","site_admin":false},"body":">>> but it adds additional checks at runtime\r\n\r\n>> I didn't get the point why the annotation itself will add checks at runtime.\r\nCould you please explain.\r\n\r\n> Because the @nonnull is annotated with @retention(RetentionPolicy.RUNTIME)\r\n\r\nCan you please explain me about the relationship between the retention policy runtime and additional checks at runtime?\r\n\r\n```\r\nAnnotations are to be recorded in the class file by the compiler and retained by the VM at run time, so they may be read reflectively.\r\n```\r\n\r\nSo, a point could be \"the file size of the classes increases by a few bytes\".","created_at":"2017-08-03T08:20:49Z","updated_at":"2017-08-03T08:20:49Z","html_url":"https://github.com/eclipse/smarthome/pull/3933#discussion_r131079627","pull_request_url":"https://api.github.com/repos/eclipse/smarthome/pulls/3933","_links":{"self":{"href":"https://api.github.com/repos/eclipse/smarthome/pulls/comments/131079627"},"html":{"href":"https://github.com/eclipse/smarthome/pull/3933#discussion_r131079627"},"pull_request":{"href":"https://api.github.com/repos/eclipse/smarthome/pulls/3933"}}},"pull_request":{"url":"https://api.github.com/repos/eclipse/smarthome/pulls/3933","id":133648674,"html_url":"https://github.com/eclipse/smarthome/pull/3933","diff_url":"https://github.com/eclipse/smarthome/pull/3933.diff","patch_url":"https://github.com/eclipse/smarthome/pull/3933.patch","issue_url":"https://api.github.com/repos/eclipse/smarthome/issues/3933","number":3933,"state":"open","locked":false,"title":"added some null annotations to core APIs","user":{"login":"kaikreuzer","id":3244965,"avatar_url":"https://avatars3.githubusercontent.com/u/3244965?v=4","gravatar_id":"","url":"https://api.github.com/users/kaikreuzer","html_url":"https://github.com/kaikreuzer","followers_url":"https://api.github.com/users/kaikreuzer/followers","following_url":"https://api.github.com/users/kaikreuzer/following{/other_user}","gists_url":"https://api.github.com/users/kaikreuzer/gists{/gist_id}","starred_url":"https://api.github.com/users/kaikreuzer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kaikreuzer/subscriptions","organizations_url":"https://api.github.com/users/kaikreuzer/orgs","repos_url":"https://api.github.com/users/kaikreuzer/repos","events_url":"https://api.github.com/users/kaikreuzer/events{/privacy}","received_events_url":"https://api.github.com/users/kaikreuzer/received_events","type":"User","site_admin":false},"body":"I had started to put some null annotations to our Registry interface. I learned that adding such annotations quickly spreads throughout the code, so I ended up adding them at a lot of places.\r\nI tried to limit it for the start and have a decent balance between the number of changed classes and the number of new warnings being added to the code at all unchecked places.\r\n\r\nA few observations:\r\n- In general, I think it is a good thing to have the annotations as one pays more attention to parameters that are passed to and from methods.\r\n- Being able to express that one expects non-null params makes many of those `throw new IllegalArgumentException()` superfluous.\r\n- It is indeed a pity that we cannot express that a collection does not contain any null values - when iterating over them (what we do very regularly), we always have to add an additional null check to be safe (and not to see any null check warning).\r\n- `Collections.emptyList()` (and similar methods) are not recognised to be non-null, so we have to add a `suppressWarnings` when we use them (not ideal). The same applies to other 3rd party libs or JVM classes as we do not have any null information about them.\r\n- I think we have introduced a bug when adding the `Identifiable` interface: I would claim that `Identifiable.getUID()` should return a non-null value. Adding such an annotation gets us into trouble with the `Rule` class, though as we allow the creation of rules without any UID (which is added only by the rule registry upon add). I think we should have a closer look at how this can best be resolved - for the moment, I didn't add the annotation on `getUID()`.\r\n\r\nSigned-off-by: Kai Kreuzer <kai@openhab.org>","created_at":"2017-08-02T08:21:54Z","updated_at":"2017-08-03T08:20:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a9cd7fd4c29a74c779427a32052c6da34278c552","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/eclipse/smarthome/pulls/3933/commits","review_comments_url":"https://api.github.com/repos/eclipse/smarthome/pulls/3933/comments","review_comment_url":"https://api.github.com/repos/eclipse/smarthome/pulls/comments{/number}","comments_url":"https://api.github.com/repos/eclipse/smarthome/issues/3933/comments","statuses_url":"https://api.github.com/repos/eclipse/smarthome/statuses/2a1a7601b2cf1071a2d019001bab751139a256d4","head":{"label":"kaikreuzer:annotations","ref":"annotations","sha":"2a1a7601b2cf1071a2d019001bab751139a256d4","user":{"login":"kaikreuzer","id":3244965,"avatar_url":"https://avatars3.githubusercontent.com/u/3244965?v=4","gravatar_id":"","url":"https://api.github.com/users/kaikreuzer","html_url":"https://github.com/kaikreuzer","followers_url":"https://api.github.com/users/kaikreuzer/followers","following_url":"https://api.github.com/users/kaikreuzer/following{/other_user}","gists_url":"https://api.github.com/users/kaikreuzer/gists{/gist_id}","starred_url":"https://api.github.com/users/kaikreuzer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kaikreuzer/subscriptions","organizations_url":"https://api.github.com/users/kaikreuzer/orgs","repos_url":"https://api.github.com/users/kaikreuzer/repos","events_url":"https://api.github.com/users/kaikreuzer/events{/privacy}","received_events_url":"https://api.github.com/users/kaikreuzer/received_events","type":"User","site_admin":false},"repo":{"id":15803647,"name":"smarthome","full_name":"kaikreuzer/smarthome","owner":{"login":"kaikreuzer","id":3244965,"avatar_url":"https://avatars3.githubusercontent.com/u/3244965?v=4","gravatar_id":"","url":"https://api.github.com/users/kaikreuzer","html_url":"https://github.com/kaikreuzer","followers_url":"https://api.github.com/users/kaikreuzer/followers","following_url":"https://api.github.com/users/kaikreuzer/following{/other_user}","gists_url":"https://api.github.com/users/kaikreuzer/gists{/gist_id}","starred_url":"https://api.github.com/users/kaikreuzer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kaikreuzer/subscriptions","organizations_url":"https://api.github.com/users/kaikreuzer/orgs","repos_url":"https://api.github.com/users/kaikreuzer/repos","events_url":"https://api.github.com/users/kaikreuzer/events{/privacy}","received_events_url":"https://api.github.com/users/kaikreuzer/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kaikreuzer/smarthome","description":"Eclipse SmartHome project","fork":true,"url":"https://api.github.com/repos/kaikreuzer/smarthome","forks_url":"https://api.github.com/repos/kaikreuzer/smarthome/forks","keys_url":"https://api.github.com/repos/kaikreuzer/smarthome/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kaikreuzer/smarthome/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kaikreuzer/smarthome/teams","hooks_url":"https://api.github.com/repos/kaikreuzer/smarthome/hooks","issue_events_url":"https://api.github.com/repos/kaikreuzer/smarthome/issues/events{/number}","events_url":"https://api.github.com/repos/kaikreuzer/smarthome/events","assignees_url":"https://api.github.com/repos/kaikreuzer/smarthome/assignees{/user}","branches_url":"https://api.github.com/repos/kaikreuzer/smarthome/branches{/branch}","tags_url":"https://api.github.com/repos/kaikreuzer/smarthome/tags","blobs_url":"https://api.github.com/repos/kaikreuzer/smarthome/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kaikreuzer/smarthome/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kaikreuzer/smarthome/git/refs{/sha}","trees_url":"https://api.github.com/repos/kaikreuzer/smarthome/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kaikreuzer/smarthome/statuses/{sha}","languages_url":"https://api.github.com/repos/kaikreuzer/smarthome/languages","stargazers_url":"https://api.github.com/repos/kaikreuzer/smarthome/stargazers","contributors_url":"https://api.github.com/repos/kaikreuzer/smarthome/contributors","subscribers_url":"https://api.github.com/repos/kaikreuzer/smarthome/subscribers","subscription_url":"https://api.github.com/repos/kaikreuzer/smarthome/subscription","commits_url":"https://api.github.com/repos/kaikreuzer/smarthome/commits{/sha}","git_commits_url":"https://api.github.com/repos/kaikreuzer/smarthome/git/commits{/sha}","comments_url":"https://api.github.com/repos/kaikreuzer/smarthome/comments{/number}","issue_comment_url":"https://api.github.com/repos/kaikreuzer/smarthome/issues/comments{/number}","contents_url":"https://api.github.com/repos/kaikreuzer/smarthome/contents/{+path}","compare_url":"https://api.github.com/repos/kaikreuzer/smarthome/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kaikreuzer/smarthome/merges","archive_url":"https://api.github.com/repos/kaikreuzer/smarthome/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kaikreuzer/smarthome/downloads","issues_url":"https://api.github.com/repos/kaikreuzer/smarthome/issues{/number}","pulls_url":"https://api.github.com/repos/kaikreuzer/smarthome/pulls{/number}","milestones_url":"https://api.github.com/repos/kaikreuzer/smarthome/milestones{/number}","notifications_url":"https://api.github.com/repos/kaikreuzer/smarthome/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kaikreuzer/smarthome/labels{/name}","releases_url":"https://api.github.com/repos/kaikreuzer/smarthome/releases{/id}","deployments_url":"https://api.github.com/repos/kaikreuzer/smarthome/deployments","created_at":"2014-01-10T16:46:33Z","updated_at":"2017-02-04T11:06:56Z","pushed_at":"2017-08-02T15:38:21Z","git_url":"git://github.com/kaikreuzer/smarthome.git","ssh_url":"git@github.com:kaikreuzer/smarthome.git","clone_url":"https://github.com/kaikreuzer/smarthome.git","svn_url":"https://github.com/kaikreuzer/smarthome","homepage":null,"size":34601,"stargazers_count":3,"watchers_count":3,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":3,"default_branch":"master"}},"base":{"label":"eclipse:master","ref":"master","sha":"0ab05792f2ecec7f7600b1c6c744fd2107257d5e","user":{"login":"eclipse","id":56974,"avatar_url":"https://avatars1.githubusercontent.com/u/56974?v=4","gravatar_id":"","url":"https://api.github.com/users/eclipse","html_url":"https://github.com/eclipse","followers_url":"https://api.github.com/users/eclipse/followers","following_url":"https://api.github.com/users/eclipse/following{/other_user}","gists_url":"https://api.github.com/users/eclipse/gists{/gist_id}","starred_url":"https://api.github.com/users/eclipse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eclipse/subscriptions","organizations_url":"https://api.github.com/users/eclipse/orgs","repos_url":"https://api.github.com/users/eclipse/repos","events_url":"https://api.github.com/users/eclipse/events{/privacy}","received_events_url":"https://api.github.com/users/eclipse/received_events","type":"Organization","site_admin":false},"repo":{"id":15778981,"name":"smarthome","full_name":"eclipse/smarthome","owner":{"login":"eclipse","id":56974,"avatar_url":"https://avatars1.githubusercontent.com/u/56974?v=4","gravatar_id":"","url":"https://api.github.com/users/eclipse","html_url":"https://github.com/eclipse","followers_url":"https://api.github.com/users/eclipse/followers","following_url":"https://api.github.com/users/eclipse/following{/other_user}","gists_url":"https://api.github.com/users/eclipse/gists{/gist_id}","starred_url":"https://api.github.com/users/eclipse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eclipse/subscriptions","organizations_url":"https://api.github.com/users/eclipse/orgs","repos_url":"https://api.github.com/users/eclipse/repos","events_url":"https://api.github.com/users/eclipse/events{/privacy}","received_events_url":"https://api.github.com/users/eclipse/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/eclipse/smarthome","description":"Eclipse SmartHome™ project","fork":false,"url":"https://api.github.com/repos/eclipse/smarthome","forks_url":"https://api.github.com/repos/eclipse/smarthome/forks","keys_url":"https://api.github.com/repos/eclipse/smarthome/keys{/key_id}","collaborators_url":"https://api.github.com/repos/eclipse/smarthome/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/eclipse/smarthome/teams","hooks_url":"https://api.github.com/repos/eclipse/smarthome/hooks","issue_events_url":"https://api.github.com/repos/eclipse/smarthome/issues/events{/number}","events_url":"https://api.github.com/repos/eclipse/smarthome/events","assignees_url":"https://api.github.com/repos/eclipse/smarthome/assignees{/user}","branches_url":"https://api.github.com/repos/eclipse/smarthome/branches{/branch}","tags_url":"https://api.github.com/repos/eclipse/smarthome/tags","blobs_url":"https://api.github.com/repos/eclipse/smarthome/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/eclipse/smarthome/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/eclipse/smarthome/git/refs{/sha}","trees_url":"https://api.github.com/repos/eclipse/smarthome/git/trees{/sha}","statuses_url":"https://api.github.com/repos/eclipse/smarthome/statuses/{sha}","languages_url":"https://api.github.com/repos/eclipse/smarthome/languages","stargazers_url":"https://api.github.com/repos/eclipse/smarthome/stargazers","contributors_url":"https://api.github.com/repos/eclipse/smarthome/contributors","subscribers_url":"https://api.github.com/repos/eclipse/smarthome/subscribers","subscription_url":"https://api.github.com/repos/eclipse/smarthome/subscription","commits_url":"https://api.github.com/repos/eclipse/smarthome/commits{/sha}","git_commits_url":"https://api.github.com/repos/eclipse/smarthome/git/commits{/sha}","comments_url":"https://api.github.com/repos/eclipse/smarthome/comments{/number}","issue_comment_url":"https://api.github.com/repos/eclipse/smarthome/issues/comments{/number}","contents_url":"https://api.github.com/repos/eclipse/smarthome/contents/{+path}","compare_url":"https://api.github.com/repos/eclipse/smarthome/compare/{base}...{head}","merges_url":"https://api.github.com/repos/eclipse/smarthome/merges","archive_url":"https://api.github.com/repos/eclipse/smarthome/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/eclipse/smarthome/downloads","issues_url":"https://api.github.com/repos/eclipse/smarthome/issues{/number}","pulls_url":"https://api.github.com/repos/eclipse/smarthome/pulls{/number}","milestones_url":"https://api.github.com/repos/eclipse/smarthome/milestones{/number}","notifications_url":"https://api.github.com/repos/eclipse/smarthome/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/eclipse/smarthome/labels{/name}","releases_url":"https://api.github.com/repos/eclipse/smarthome/releases{/id}","deployments_url":"https://api.github.com/repos/eclipse/smarthome/deployments","created_at":"2014-01-09T20:47:19Z","updated_at":"2017-08-01T20:50:17Z","pushed_at":"2017-08-03T08:11:44Z","git_url":"git://github.com/eclipse/smarthome.git","ssh_url":"git@github.com:eclipse/smarthome.git","clone_url":"https://github.com/eclipse/smarthome.git","svn_url":"https://github.com/eclipse/smarthome","homepage":"https://www.eclipse.org/smarthome/","size":35083,"stargazers_count":538,"watchers_count":538,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":521,"mirror_url":null,"open_issues_count":329,"forks":521,"open_issues":329,"watchers":538,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/eclipse/smarthome/pulls/3933"},"html":{"href":"https://github.com/eclipse/smarthome/pull/3933"},"issue":{"href":"https://api.github.com/repos/eclipse/smarthome/issues/3933"},"comments":{"href":"https://api.github.com/repos/eclipse/smarthome/issues/3933/comments"},"review_comments":{"href":"https://api.github.com/repos/eclipse/smarthome/pulls/3933/comments"},"review_comment":{"href":"https://api.github.com/repos/eclipse/smarthome/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/eclipse/smarthome/pulls/3933/commits"},"statuses":{"href":"https://api.github.com/repos/eclipse/smarthome/statuses/2a1a7601b2cf1071a2d019001bab751139a256d4"}}}}
{"actor":{"display_login":"maggu2810"}}