{"action":"created","comment":{"url":"https://api.github.com/repos/findbugsproject/findbugs/pulls/comments/41318592","id":41318592,"diff_hunk":"@@ -1072,6 +1090,34 @@ private void handleSuspiciousRefComparison(JavaClass jclass, Method method, Meth\n                 sourceLineAnnotation, location));\n     }\n \n+    private void handleValueBasedRefComparison(JavaClass jclass, Method method, MethodGen methodGen,\n+            List<WarningWithProperties> refComparisonList, Location location, String signature, ReferenceType lhsType,\n+            ReferenceType rhsType) {\n+        XField xf = null;\n+        if (lhsType instanceof FinalConstant) {\n+            xf = ((FinalConstant) lhsType).getXField();\n+        } else if (rhsType instanceof FinalConstant) {\n+            xf = ((FinalConstant) rhsType).getXField();\n+        }\n+        String sourceFile = jclass.getSourceFileName();\n+        String bugPattern = \"VBC_REF_COMPARISON\";","path":"findbugs/src/java/edu/umd/cs/findbugs/detect/FindRefComparison.java","position":78,"original_position":68,"commit_id":"aac7572a5acd974e20248c48a15640a64cc65b52","original_commit_id":"23e476959bb2b3b58f1055e2163ea1eb00d8376f","user":{"login":"nicolaiparlog","id":6537432,"avatar_url":"https://avatars.githubusercontent.com/u/6537432?v=3","gravatar_id":"","url":"https://api.github.com/users/nicolaiparlog","html_url":"https://github.com/nicolaiparlog","followers_url":"https://api.github.com/users/nicolaiparlog/followers","following_url":"https://api.github.com/users/nicolaiparlog/following{/other_user}","gists_url":"https://api.github.com/users/nicolaiparlog/gists{/gist_id}","starred_url":"https://api.github.com/users/nicolaiparlog/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nicolaiparlog/subscriptions","organizations_url":"https://api.github.com/users/nicolaiparlog/orgs","repos_url":"https://api.github.com/users/nicolaiparlog/repos","events_url":"https://api.github.com/users/nicolaiparlog/events{/privacy}","received_events_url":"https://api.github.com/users/nicolaiparlog/received_events","type":"User","site_admin":false},"body":"[Done](https://github.com/findbugsproject/findbugs/pull/46/files#diff-61b90f4ada57d0056fcacf3895ec6b6eL476).","created_at":"2015-10-06T20:37:43Z","updated_at":"2015-10-06T20:37:43Z","html_url":"https://github.com/findbugsproject/findbugs/pull/46#discussion_r41318592","pull_request_url":"https://api.github.com/repos/findbugsproject/findbugs/pulls/46","_links":{"self":{"href":"https://api.github.com/repos/findbugsproject/findbugs/pulls/comments/41318592"},"html":{"href":"https://github.com/findbugsproject/findbugs/pull/46#discussion_r41318592"},"pull_request":{"href":"https://api.github.com/repos/findbugsproject/findbugs/pulls/46"}}},"pull_request":{"url":"https://api.github.com/repos/findbugsproject/findbugs/pulls/46","id":43708799,"html_url":"https://github.com/findbugsproject/findbugs/pull/46","diff_url":"https://github.com/findbugsproject/findbugs/pull/46.diff","patch_url":"https://github.com/findbugsproject/findbugs/pull/46.patch","issue_url":"https://api.github.com/repos/findbugsproject/findbugs/issues/46","number":46,"state":"open","locked":false,"title":"Value-Based Classes","user":{"login":"nicolaiparlog","id":6537432,"avatar_url":"https://avatars.githubusercontent.com/u/6537432?v=3","gravatar_id":"","url":"https://api.github.com/users/nicolaiparlog","html_url":"https://github.com/nicolaiparlog","followers_url":"https://api.github.com/users/nicolaiparlog/followers","following_url":"https://api.github.com/users/nicolaiparlog/following{/other_user}","gists_url":"https://api.github.com/users/nicolaiparlog/gists{/gist_id}","starred_url":"https://api.github.com/users/nicolaiparlog/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nicolaiparlog/subscriptions","organizations_url":"https://api.github.com/users/nicolaiparlog/orgs","repos_url":"https://api.github.com/users/nicolaiparlog/repos","events_url":"https://api.github.com/users/nicolaiparlog/events{/privacy}","received_events_url":"https://api.github.com/users/nicolaiparlog/received_events","type":"User","site_admin":false},"body":":bangbang: **THIS PULL REQUEST IS NOT COMPLETE YET**\r\n\r\nThis is my shot at implementing [Feature Request #313: Warn about identity-sensitive operations on value based classes ](https://sourceforge.net/p/findbugs/feature-requests/313/).\r\n\r\nFor brevity's sake I'll use _vbi_ for _value-based instance(s)_, i.e. an instance of a value-based class.\r\n\r\n## Current State\r\n\r\nThe annotation `@ValueBased` can be used to mark own value-based classes. These classes and those from the JDK are processed uniformly when it comes to the following checks:\r\n\r\n* :white_check_mark: no reference comparison\r\n* :white_check_mark: serialization of _vbi_\r\n    * :white_check_mark: no non-transient field in serializable class (works out of the box)\r\n    * :white_check_mark: no direct serialization via `ObjectOutputStream.writeObject`  (works out of the box)\r\n* :red_circle: identity hash code\r\n    * :white_check_mark: no argument to `System.identityHashCode`\r\n    * :red_circle: no key in an `IdentityHashMap`\r\n* :white_check_mark: no locking on a _vbi_\r\n    * :white_check_mark: no use in `synchronized` block\r\n    * :white_check_mark: no calls to `Object.wait`\r\n    * :white_check_mark: no calls to `Object.notify`\r\n    * :white_check_mark: no calls to `Object.notifyAll`\r\n\r\n## Notes\r\n\r\nEnsuring that a class annotated with `@ValueBased` has all properties described in the [official documentation](https://docs.oracle.com/javase/8/docs/api/java/lang/doc-files/ValueBased.html) is not in the scope of [#313](https://sourceforge.net/p/findbugs/feature-requests/313/) and hence also not of this pull request.","created_at":"2015-08-30T07:05:40Z","updated_at":"2015-10-06T20:37:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2ee8c2b09e647cea821c78d3b101cb52215bcb63","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/findbugsproject/findbugs/pulls/46/commits","review_comments_url":"https://api.github.com/repos/findbugsproject/findbugs/pulls/46/comments","review_comment_url":"https://api.github.com/repos/findbugsproject/findbugs/pulls/comments{/number}","comments_url":"https://api.github.com/repos/findbugsproject/findbugs/issues/46/comments","statuses_url":"https://api.github.com/repos/findbugsproject/findbugs/statuses/aac7572a5acd974e20248c48a15640a64cc65b52","head":{"label":"CodeFX-org:vbc","ref":"vbc","sha":"aac7572a5acd974e20248c48a15640a64cc65b52","user":{"login":"CodeFX-org","id":8392752,"avatar_url":"https://avatars.githubusercontent.com/u/8392752?v=3","gravatar_id":"","url":"https://api.github.com/users/CodeFX-org","html_url":"https://github.com/CodeFX-org","followers_url":"https://api.github.com/users/CodeFX-org/followers","following_url":"https://api.github.com/users/CodeFX-org/following{/other_user}","gists_url":"https://api.github.com/users/CodeFX-org/gists{/gist_id}","starred_url":"https://api.github.com/users/CodeFX-org/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CodeFX-org/subscriptions","organizations_url":"https://api.github.com/users/CodeFX-org/orgs","repos_url":"https://api.github.com/users/CodeFX-org/repos","events_url":"https://api.github.com/users/CodeFX-org/events{/privacy}","received_events_url":"https://api.github.com/users/CodeFX-org/received_events","type":"Organization","site_admin":false},"repo":{"id":39469031,"name":"findbugs","full_name":"CodeFX-org/findbugs","owner":{"login":"CodeFX-org","id":8392752,"avatar_url":"https://avatars.githubusercontent.com/u/8392752?v=3","gravatar_id":"","url":"https://api.github.com/users/CodeFX-org","html_url":"https://github.com/CodeFX-org","followers_url":"https://api.github.com/users/CodeFX-org/followers","following_url":"https://api.github.com/users/CodeFX-org/following{/other_user}","gists_url":"https://api.github.com/users/CodeFX-org/gists{/gist_id}","starred_url":"https://api.github.com/users/CodeFX-org/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CodeFX-org/subscriptions","organizations_url":"https://api.github.com/users/CodeFX-org/orgs","repos_url":"https://api.github.com/users/CodeFX-org/repos","events_url":"https://api.github.com/users/CodeFX-org/events{/privacy}","received_events_url":"https://api.github.com/users/CodeFX-org/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/CodeFX-org/findbugs","description":"Automatically exported from code.google.com/p/findbugs","fork":true,"url":"https://api.github.com/repos/CodeFX-org/findbugs","forks_url":"https://api.github.com/repos/CodeFX-org/findbugs/forks","keys_url":"https://api.github.com/repos/CodeFX-org/findbugs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CodeFX-org/findbugs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CodeFX-org/findbugs/teams","hooks_url":"https://api.github.com/repos/CodeFX-org/findbugs/hooks","issue_events_url":"https://api.github.com/repos/CodeFX-org/findbugs/issues/events{/number}","events_url":"https://api.github.com/repos/CodeFX-org/findbugs/events","assignees_url":"https://api.github.com/repos/CodeFX-org/findbugs/assignees{/user}","branches_url":"https://api.github.com/repos/CodeFX-org/findbugs/branches{/branch}","tags_url":"https://api.github.com/repos/CodeFX-org/findbugs/tags","blobs_url":"https://api.github.com/repos/CodeFX-org/findbugs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CodeFX-org/findbugs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CodeFX-org/findbugs/git/refs{/sha}","trees_url":"https://api.github.com/repos/CodeFX-org/findbugs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CodeFX-org/findbugs/statuses/{sha}","languages_url":"https://api.github.com/repos/CodeFX-org/findbugs/languages","stargazers_url":"https://api.github.com/repos/CodeFX-org/findbugs/stargazers","contributors_url":"https://api.github.com/repos/CodeFX-org/findbugs/contributors","subscribers_url":"https://api.github.com/repos/CodeFX-org/findbugs/subscribers","subscription_url":"https://api.github.com/repos/CodeFX-org/findbugs/subscription","commits_url":"https://api.github.com/repos/CodeFX-org/findbugs/commits{/sha}","git_commits_url":"https://api.github.com/repos/CodeFX-org/findbugs/git/commits{/sha}","comments_url":"https://api.github.com/repos/CodeFX-org/findbugs/comments{/number}","issue_comment_url":"https://api.github.com/repos/CodeFX-org/findbugs/issues/comments{/number}","contents_url":"https://api.github.com/repos/CodeFX-org/findbugs/contents/{+path}","compare_url":"https://api.github.com/repos/CodeFX-org/findbugs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CodeFX-org/findbugs/merges","archive_url":"https://api.github.com/repos/CodeFX-org/findbugs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CodeFX-org/findbugs/downloads","issues_url":"https://api.github.com/repos/CodeFX-org/findbugs/issues{/number}","pulls_url":"https://api.github.com/repos/CodeFX-org/findbugs/pulls{/number}","milestones_url":"https://api.github.com/repos/CodeFX-org/findbugs/milestones{/number}","notifications_url":"https://api.github.com/repos/CodeFX-org/findbugs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CodeFX-org/findbugs/labels{/name}","releases_url":"https://api.github.com/repos/CodeFX-org/findbugs/releases{/id}","created_at":"2015-07-21T20:45:28Z","updated_at":"2015-07-21T20:45:45Z","pushed_at":"2015-10-06T20:36:18Z","git_url":"git://github.com/CodeFX-org/findbugs.git","ssh_url":"git@github.com:CodeFX-org/findbugs.git","clone_url":"https://github.com/CodeFX-org/findbugs.git","svn_url":"https://github.com/CodeFX-org/findbugs","homepage":null,"size":138435,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"findbugsproject:master","ref":"master","sha":"abf2e5397508819cc617de9a0c7efd36f00f3a5a","user":{"login":"findbugsproject","id":13423687,"avatar_url":"https://avatars.githubusercontent.com/u/13423687?v=3","gravatar_id":"","url":"https://api.github.com/users/findbugsproject","html_url":"https://github.com/findbugsproject","followers_url":"https://api.github.com/users/findbugsproject/followers","following_url":"https://api.github.com/users/findbugsproject/following{/other_user}","gists_url":"https://api.github.com/users/findbugsproject/gists{/gist_id}","starred_url":"https://api.github.com/users/findbugsproject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/findbugsproject/subscriptions","organizations_url":"https://api.github.com/users/findbugsproject/orgs","repos_url":"https://api.github.com/users/findbugsproject/repos","events_url":"https://api.github.com/users/findbugsproject/events{/privacy}","received_events_url":"https://api.github.com/users/findbugsproject/received_events","type":"Organization","site_admin":false},"repo":{"id":39406013,"name":"findbugs","full_name":"findbugsproject/findbugs","owner":{"login":"findbugsproject","id":13423687,"avatar_url":"https://avatars.githubusercontent.com/u/13423687?v=3","gravatar_id":"","url":"https://api.github.com/users/findbugsproject","html_url":"https://github.com/findbugsproject","followers_url":"https://api.github.com/users/findbugsproject/followers","following_url":"https://api.github.com/users/findbugsproject/following{/other_user}","gists_url":"https://api.github.com/users/findbugsproject/gists{/gist_id}","starred_url":"https://api.github.com/users/findbugsproject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/findbugsproject/subscriptions","organizations_url":"https://api.github.com/users/findbugsproject/orgs","repos_url":"https://api.github.com/users/findbugsproject/repos","events_url":"https://api.github.com/users/findbugsproject/events{/privacy}","received_events_url":"https://api.github.com/users/findbugsproject/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/findbugsproject/findbugs","description":"The new home of the FindBugs project","fork":false,"url":"https://api.github.com/repos/findbugsproject/findbugs","forks_url":"https://api.github.com/repos/findbugsproject/findbugs/forks","keys_url":"https://api.github.com/repos/findbugsproject/findbugs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/findbugsproject/findbugs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/findbugsproject/findbugs/teams","hooks_url":"https://api.github.com/repos/findbugsproject/findbugs/hooks","issue_events_url":"https://api.github.com/repos/findbugsproject/findbugs/issues/events{/number}","events_url":"https://api.github.com/repos/findbugsproject/findbugs/events","assignees_url":"https://api.github.com/repos/findbugsproject/findbugs/assignees{/user}","branches_url":"https://api.github.com/repos/findbugsproject/findbugs/branches{/branch}","tags_url":"https://api.github.com/repos/findbugsproject/findbugs/tags","blobs_url":"https://api.github.com/repos/findbugsproject/findbugs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/findbugsproject/findbugs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/findbugsproject/findbugs/git/refs{/sha}","trees_url":"https://api.github.com/repos/findbugsproject/findbugs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/findbugsproject/findbugs/statuses/{sha}","languages_url":"https://api.github.com/repos/findbugsproject/findbugs/languages","stargazers_url":"https://api.github.com/repos/findbugsproject/findbugs/stargazers","contributors_url":"https://api.github.com/repos/findbugsproject/findbugs/contributors","subscribers_url":"https://api.github.com/repos/findbugsproject/findbugs/subscribers","subscription_url":"https://api.github.com/repos/findbugsproject/findbugs/subscription","commits_url":"https://api.github.com/repos/findbugsproject/findbugs/commits{/sha}","git_commits_url":"https://api.github.com/repos/findbugsproject/findbugs/git/commits{/sha}","comments_url":"https://api.github.com/repos/findbugsproject/findbugs/comments{/number}","issue_comment_url":"https://api.github.com/repos/findbugsproject/findbugs/issues/comments{/number}","contents_url":"https://api.github.com/repos/findbugsproject/findbugs/contents/{+path}","compare_url":"https://api.github.com/repos/findbugsproject/findbugs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/findbugsproject/findbugs/merges","archive_url":"https://api.github.com/repos/findbugsproject/findbugs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/findbugsproject/findbugs/downloads","issues_url":"https://api.github.com/repos/findbugsproject/findbugs/issues{/number}","pulls_url":"https://api.github.com/repos/findbugsproject/findbugs/pulls{/number}","milestones_url":"https://api.github.com/repos/findbugsproject/findbugs/milestones{/number}","notifications_url":"https://api.github.com/repos/findbugsproject/findbugs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/findbugsproject/findbugs/labels{/name}","releases_url":"https://api.github.com/repos/findbugsproject/findbugs/releases{/id}","created_at":"2015-07-20T20:09:41Z","updated_at":"2015-10-04T08:01:26Z","pushed_at":"2015-10-06T20:36:19Z","git_url":"git://github.com/findbugsproject/findbugs.git","ssh_url":"git@github.com:findbugsproject/findbugs.git","clone_url":"https://github.com/findbugsproject/findbugs.git","svn_url":"https://github.com/findbugsproject/findbugs","homepage":"","size":140744,"stargazers_count":57,"watchers_count":57,"language":"Java","has_issues":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":18,"mirror_url":null,"open_issues_count":6,"forks":18,"open_issues":6,"watchers":57,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/findbugsproject/findbugs/pulls/46"},"html":{"href":"https://github.com/findbugsproject/findbugs/pull/46"},"issue":{"href":"https://api.github.com/repos/findbugsproject/findbugs/issues/46"},"comments":{"href":"https://api.github.com/repos/findbugsproject/findbugs/issues/46/comments"},"review_comments":{"href":"https://api.github.com/repos/findbugsproject/findbugs/pulls/46/comments"},"review_comment":{"href":"https://api.github.com/repos/findbugsproject/findbugs/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/findbugsproject/findbugs/pulls/46/commits"},"statuses":{"href":"https://api.github.com/repos/findbugsproject/findbugs/statuses/aac7572a5acd974e20248c48a15640a64cc65b52"}}}}