{"action":"created","comment":{"url":"https://api.github.com/repos/hibernate/hibernate-validator/pulls/comments/146666649","pull_request_review_id":71642100,"id":146666649,"diff_hunk":"@@ -0,0 +1,286 @@\n+/*\n+ * Hibernate Validator, declare and validate application constraints\n+ *\n+ * License: Apache License, Version 2.0\n+ * See the license.txt file in the root directory or <http://www.apache.org/licenses/LICENSE-2.0>.\n+ */\n+package org.hibernate.validator.internal.util.annotation;\n+\n+import static org.hibernate.validator.internal.util.CollectionHelper.newHashMap;\n+\n+import java.io.Serializable;\n+import java.lang.annotation.Annotation;\n+import java.lang.reflect.Method;\n+import java.security.AccessController;\n+import java.security.PrivilegedAction;\n+import java.util.Arrays;\n+import java.util.HashMap;\n+import java.util.Map;\n+import java.util.Map.Entry;\n+import java.util.Set;\n+import java.util.SortedSet;\n+import java.util.TreeSet;\n+\n+import org.hibernate.validator.internal.util.logging.Log;\n+import org.hibernate.validator.internal.util.logging.LoggerFactory;\n+import org.hibernate.validator.internal.util.privilegedactions.GetAnnotationAttributes;\n+import org.hibernate.validator.internal.util.privilegedactions.GetDeclaredMethods;\n+\n+/**\n+ * Encapsulates the data you need to create an annotation. In\n+ * particular, it stores the type of an {@code Annotation} instance\n+ * and the values of its elements.\n+ * The \"elements\" we're talking about are the annotation attributes,\n+ * not its targets (the term \"element\" is used ambiguously\n+ * in Java's annotations documentation).\n+ *\n+ * @author Paolo Perrotta\n+ * @author Davide Marchignoli\n+ * @author Hardy Ferentschik\n+ * @author Gunnar Morling\n+ * @author Guillaume Smet\n+ */\n+public class AnnotationDescriptor<T extends Annotation> implements Serializable {\n+\n+\tprivate static final Log LOG = LoggerFactory.make();\n+\n+\tprivate final Class<T> type;\n+\n+\tprivate final AnnotationAttributes attributes;\n+\n+\tprivate final int hashCode;\n+\n+\tprivate final T annotation;\n+\n+\t@SuppressWarnings(\"unchecked\")\n+\tpublic AnnotationDescriptor(T annotation) {\n+\t\tthis.type = (Class<T>) annotation.annotationType();\n+\t\tthis.attributes = run( GetAnnotationAttributes.action( annotation ) );\n+\t\tthis.annotation = annotation;\n+\t\tthis.hashCode = buildHashCode();\n+\t}\n+\n+\tprivate AnnotationDescriptor(Class<T> annotationType, AnnotationAttributes parameters) {\n+\t\tthis.type = annotationType;\n+\t\tthis.attributes = parameters;\n+\t\tthis.hashCode = buildHashCode();\n+\t\tthis.annotation = AnnotationFactory.create( this );\n+\t}\n+\n+\tpublic Class<T> type() {\n+\t\treturn type;\n+\t}\n+\n+\tpublic AnnotationAttributes getAttributes() {\n+\t\treturn attributes;\n+\t}\n+\n+\tpublic T annotation() {\n+\t\treturn annotation;\n+\t}\n+\n+\t@Override\n+\tpublic boolean equals(Object obj) {\n+\t\tif ( this == obj ) {\n+\t\t\treturn true;\n+\t\t}\n+\t\tif ( obj == null || obj.getClass() != AnnotationDescriptor.class ) {\n+\t\t\treturn false;\n+\t\t}\n+\n+\t\tAnnotationDescriptor<?> other = (AnnotationDescriptor<?>) obj;\n+\n+\t\tif ( !type.equals( other.type ) ) {\n+\t\t\treturn false;\n+\t\t}\n+\n+\t\tif ( attributes.size() != other.attributes.size() ) {\n+\t\t\treturn false;\n+\t\t}\n+\n+\t\tfor ( Entry<String, Object> member : attributes.entrySet() ) {\n+\t\t\tObject value = member.getValue();\n+\t\t\tObject otherValue = other.attributes.getParameter( member.getKey() );\n+\n+\t\t\tif ( !areEqual( value, otherValue ) ) {\n+\t\t\t\treturn false;\n+\t\t\t}\n+\t\t}\n+\n+\t\treturn true;\n+\t}\n+\n+\t/**\n+\t * Calculates the hash code of this annotation descriptor as described in\n+\t * {@link Annotation#hashCode()}.\n+\t *\n+\t * @return The hash code of this descriptor.\n+\t *\n+\t * @see Annotation#hashCode()\n+\t */\n+\t@Override\n+\tpublic int hashCode() {\n+\t\treturn hashCode;\n+\t}\n+\n+\t@Override\n+\tpublic String toString() {\n+\t\tStringBuilder result = new StringBuilder();\n+\t\tresult.append( '@' ).append( type.getName() ).append( '(' );\n+\t\tfor ( String s : getRegisteredAttributesInAlphabeticalOrder() ) {\n+\t\t\tresult.append( s ).append( '=' ).append( attributes.getParameter( s ) ).append( \", \" );\n+\t\t}\n+\t\t// remove last separator:\n+\t\tif ( attributes.size() > 0 ) {\n+\t\t\tresult.delete( result.length() - 2, result.length() );\n+\t\t\tresult.append( \")\" );\n+\t\t}\n+\t\telse {\n+\t\t\tresult.delete( result.length() - 1, result.length() );\n+\t\t}\n+\n+\t\treturn result.toString();\n+\t}\n+\n+\tprivate SortedSet<String> getRegisteredAttributesInAlphabeticalOrder() {\n+\t\treturn new TreeSet<String>( attributes.keySet() );\n+\t}\n+\n+\tprivate int buildHashCode() {\n+\t\tint hashCode = 0;\n+\n+\t\tfor ( Entry<String, Object> member : attributes.entrySet() ) {\n+\t\t\tObject value = member.getValue();\n+\n+\t\t\tint nameHashCode = member.getKey().hashCode();\n+\n+\t\t\tint valueHashCode =\n+\t\t\t\t\t!value.getClass().isArray() ? value.hashCode() :","path":"engine/src/main/java/org/hibernate/validator/internal/util/annotation/AnnotationDescriptor.java","position":194,"original_position":158,"commit_id":"2de63223c3ba5eaded7446195396d804e4f90fd7","original_commit_id":"931501a3f1189aed7329dc6272e9e871aa262e34","user":{"login":"gunnarmorling","id":28612,"avatar_url":"https://avatars2.githubusercontent.com/u/28612?v=4","gravatar_id":"","url":"https://api.github.com/users/gunnarmorling","html_url":"https://github.com/gunnarmorling","followers_url":"https://api.github.com/users/gunnarmorling/followers","following_url":"https://api.github.com/users/gunnarmorling/following{/other_user}","gists_url":"https://api.github.com/users/gunnarmorling/gists{/gist_id}","starred_url":"https://api.github.com/users/gunnarmorling/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gunnarmorling/subscriptions","organizations_url":"https://api.github.com/users/gunnarmorling/orgs","repos_url":"https://api.github.com/users/gunnarmorling/repos","events_url":"https://api.github.com/users/gunnarmorling/events{/privacy}","received_events_url":"https://api.github.com/users/gunnarmorling/received_events","type":"User","site_admin":false},"body":"Ok, makes sense.","created_at":"2017-10-24T19:24:21Z","updated_at":"2017-10-24T19:24:21Z","html_url":"https://github.com/hibernate/hibernate-validator/pull/868#discussion_r146666649","pull_request_url":"https://api.github.com/repos/hibernate/hibernate-validator/pulls/868","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/hibernate/hibernate-validator/pulls/comments/146666649"},"html":{"href":"https://github.com/hibernate/hibernate-validator/pull/868#discussion_r146666649"},"pull_request":{"href":"https://api.github.com/repos/hibernate/hibernate-validator/pulls/868"}},"in_reply_to_id":146607977},"pull_request":{"url":"https://api.github.com/repos/hibernate/hibernate-validator/pulls/868","id":148368981,"html_url":"https://github.com/hibernate/hibernate-validator/pull/868","diff_url":"https://github.com/hibernate/hibernate-validator/pull/868.diff","patch_url":"https://github.com/hibernate/hibernate-validator/pull/868.patch","issue_url":"https://api.github.com/repos/hibernate/hibernate-validator/issues/868","number":868,"state":"open","locked":false,"title":"Another set of performance related improvements","user":{"login":"gsmet","id":1279749,"avatar_url":"https://avatars1.githubusercontent.com/u/1279749?v=4","gravatar_id":"","url":"https://api.github.com/users/gsmet","html_url":"https://github.com/gsmet","followers_url":"https://api.github.com/users/gsmet/followers","following_url":"https://api.github.com/users/gsmet/following{/other_user}","gists_url":"https://api.github.com/users/gsmet/gists{/gist_id}","starred_url":"https://api.github.com/users/gsmet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gsmet/subscriptions","organizations_url":"https://api.github.com/users/gsmet/orgs","repos_url":"https://api.github.com/users/gsmet/repos","events_url":"https://api.github.com/users/gsmet/events{/privacy}","received_events_url":"https://api.github.com/users/gsmet/received_events","type":"User","site_admin":false},"body":" * https://hibernate.atlassian.net/browse/HV-1501\r\n * https://hibernate.atlassian.net/browse/HV-1502\r\n * https://hibernate.atlassian.net/browse/HV-1503\r\n\r\nBean Validation benchmark (lower is better, average of 2 runs):\r\n * 5.4.2.Final: 22938 ms\r\n * 6.0.3.Final: 10488.5 ms\r\n * 6.0.4-SNAPSHOT: 7418.5 ms","created_at":"2017-10-24T11:27:00Z","updated_at":"2017-10-24T19:24:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4c5ee0dbd177c1be6b0cb6bd909f0fd7932390ec","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/hibernate/hibernate-validator/pulls/868/commits","review_comments_url":"https://api.github.com/repos/hibernate/hibernate-validator/pulls/868/comments","review_comment_url":"https://api.github.com/repos/hibernate/hibernate-validator/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hibernate/hibernate-validator/issues/868/comments","statuses_url":"https://api.github.com/repos/hibernate/hibernate-validator/statuses/2de63223c3ba5eaded7446195396d804e4f90fd7","head":{"label":"gsmet:HV-1501","ref":"HV-1501","sha":"2de63223c3ba5eaded7446195396d804e4f90fd7","user":{"login":"gsmet","id":1279749,"avatar_url":"https://avatars1.githubusercontent.com/u/1279749?v=4","gravatar_id":"","url":"https://api.github.com/users/gsmet","html_url":"https://github.com/gsmet","followers_url":"https://api.github.com/users/gsmet/followers","following_url":"https://api.github.com/users/gsmet/following{/other_user}","gists_url":"https://api.github.com/users/gsmet/gists{/gist_id}","starred_url":"https://api.github.com/users/gsmet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gsmet/subscriptions","organizations_url":"https://api.github.com/users/gsmet/orgs","repos_url":"https://api.github.com/users/gsmet/repos","events_url":"https://api.github.com/users/gsmet/events{/privacy}","received_events_url":"https://api.github.com/users/gsmet/received_events","type":"User","site_admin":false},"repo":{"id":56131797,"name":"hibernate-validator","full_name":"gsmet/hibernate-validator","owner":{"login":"gsmet","id":1279749,"avatar_url":"https://avatars1.githubusercontent.com/u/1279749?v=4","gravatar_id":"","url":"https://api.github.com/users/gsmet","html_url":"https://github.com/gsmet","followers_url":"https://api.github.com/users/gsmet/followers","following_url":"https://api.github.com/users/gsmet/following{/other_user}","gists_url":"https://api.github.com/users/gsmet/gists{/gist_id}","starred_url":"https://api.github.com/users/gsmet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gsmet/subscriptions","organizations_url":"https://api.github.com/users/gsmet/orgs","repos_url":"https://api.github.com/users/gsmet/repos","events_url":"https://api.github.com/users/gsmet/events{/privacy}","received_events_url":"https://api.github.com/users/gsmet/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/gsmet/hibernate-validator","description":"Hibernate Validator - Bean Validation 1.1 (JSR 349) Reference Implementation","fork":true,"url":"https://api.github.com/repos/gsmet/hibernate-validator","forks_url":"https://api.github.com/repos/gsmet/hibernate-validator/forks","keys_url":"https://api.github.com/repos/gsmet/hibernate-validator/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gsmet/hibernate-validator/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gsmet/hibernate-validator/teams","hooks_url":"https://api.github.com/repos/gsmet/hibernate-validator/hooks","issue_events_url":"https://api.github.com/repos/gsmet/hibernate-validator/issues/events{/number}","events_url":"https://api.github.com/repos/gsmet/hibernate-validator/events","assignees_url":"https://api.github.com/repos/gsmet/hibernate-validator/assignees{/user}","branches_url":"https://api.github.com/repos/gsmet/hibernate-validator/branches{/branch}","tags_url":"https://api.github.com/repos/gsmet/hibernate-validator/tags","blobs_url":"https://api.github.com/repos/gsmet/hibernate-validator/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gsmet/hibernate-validator/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gsmet/hibernate-validator/git/refs{/sha}","trees_url":"https://api.github.com/repos/gsmet/hibernate-validator/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gsmet/hibernate-validator/statuses/{sha}","languages_url":"https://api.github.com/repos/gsmet/hibernate-validator/languages","stargazers_url":"https://api.github.com/repos/gsmet/hibernate-validator/stargazers","contributors_url":"https://api.github.com/repos/gsmet/hibernate-validator/contributors","subscribers_url":"https://api.github.com/repos/gsmet/hibernate-validator/subscribers","subscription_url":"https://api.github.com/repos/gsmet/hibernate-validator/subscription","commits_url":"https://api.github.com/repos/gsmet/hibernate-validator/commits{/sha}","git_commits_url":"https://api.github.com/repos/gsmet/hibernate-validator/git/commits{/sha}","comments_url":"https://api.github.com/repos/gsmet/hibernate-validator/comments{/number}","issue_comment_url":"https://api.github.com/repos/gsmet/hibernate-validator/issues/comments{/number}","contents_url":"https://api.github.com/repos/gsmet/hibernate-validator/contents/{+path}","compare_url":"https://api.github.com/repos/gsmet/hibernate-validator/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gsmet/hibernate-validator/merges","archive_url":"https://api.github.com/repos/gsmet/hibernate-validator/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gsmet/hibernate-validator/downloads","issues_url":"https://api.github.com/repos/gsmet/hibernate-validator/issues{/number}","pulls_url":"https://api.github.com/repos/gsmet/hibernate-validator/pulls{/number}","milestones_url":"https://api.github.com/repos/gsmet/hibernate-validator/milestones{/number}","notifications_url":"https://api.github.com/repos/gsmet/hibernate-validator/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gsmet/hibernate-validator/labels{/name}","releases_url":"https://api.github.com/repos/gsmet/hibernate-validator/releases{/id}","deployments_url":"https://api.github.com/repos/gsmet/hibernate-validator/deployments","created_at":"2016-04-13T07:48:18Z","updated_at":"2016-04-13T07:48:22Z","pushed_at":"2017-10-24T17:57:33Z","git_url":"git://github.com/gsmet/hibernate-validator.git","ssh_url":"git@github.com:gsmet/hibernate-validator.git","clone_url":"https://github.com/gsmet/hibernate-validator.git","svn_url":"https://github.com/gsmet/hibernate-validator","homepage":"http://validator.hibernate.org/","size":26851,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_projects":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"base":{"label":"hibernate:master","ref":"master","sha":"567d9dd439cb08bb60146609008576d6c6317e7c","user":{"login":"hibernate","id":348262,"avatar_url":"https://avatars1.githubusercontent.com/u/348262?v=4","gravatar_id":"","url":"https://api.github.com/users/hibernate","html_url":"https://github.com/hibernate","followers_url":"https://api.github.com/users/hibernate/followers","following_url":"https://api.github.com/users/hibernate/following{/other_user}","gists_url":"https://api.github.com/users/hibernate/gists{/gist_id}","starred_url":"https://api.github.com/users/hibernate/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hibernate/subscriptions","organizations_url":"https://api.github.com/users/hibernate/orgs","repos_url":"https://api.github.com/users/hibernate/repos","events_url":"https://api.github.com/users/hibernate/events{/privacy}","received_events_url":"https://api.github.com/users/hibernate/received_events","type":"Organization","site_admin":false},"repo":{"id":972205,"name":"hibernate-validator","full_name":"hibernate/hibernate-validator","owner":{"login":"hibernate","id":348262,"avatar_url":"https://avatars1.githubusercontent.com/u/348262?v=4","gravatar_id":"","url":"https://api.github.com/users/hibernate","html_url":"https://github.com/hibernate","followers_url":"https://api.github.com/users/hibernate/followers","following_url":"https://api.github.com/users/hibernate/following{/other_user}","gists_url":"https://api.github.com/users/hibernate/gists{/gist_id}","starred_url":"https://api.github.com/users/hibernate/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hibernate/subscriptions","organizations_url":"https://api.github.com/users/hibernate/orgs","repos_url":"https://api.github.com/users/hibernate/repos","events_url":"https://api.github.com/users/hibernate/events{/privacy}","received_events_url":"https://api.github.com/users/hibernate/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/hibernate/hibernate-validator","description":"Hibernate Validator - Bean Validation 2.0 (JSR 380) Reference Implementation","fork":false,"url":"https://api.github.com/repos/hibernate/hibernate-validator","forks_url":"https://api.github.com/repos/hibernate/hibernate-validator/forks","keys_url":"https://api.github.com/repos/hibernate/hibernate-validator/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hibernate/hibernate-validator/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hibernate/hibernate-validator/teams","hooks_url":"https://api.github.com/repos/hibernate/hibernate-validator/hooks","issue_events_url":"https://api.github.com/repos/hibernate/hibernate-validator/issues/events{/number}","events_url":"https://api.github.com/repos/hibernate/hibernate-validator/events","assignees_url":"https://api.github.com/repos/hibernate/hibernate-validator/assignees{/user}","branches_url":"https://api.github.com/repos/hibernate/hibernate-validator/branches{/branch}","tags_url":"https://api.github.com/repos/hibernate/hibernate-validator/tags","blobs_url":"https://api.github.com/repos/hibernate/hibernate-validator/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hibernate/hibernate-validator/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hibernate/hibernate-validator/git/refs{/sha}","trees_url":"https://api.github.com/repos/hibernate/hibernate-validator/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hibernate/hibernate-validator/statuses/{sha}","languages_url":"https://api.github.com/repos/hibernate/hibernate-validator/languages","stargazers_url":"https://api.github.com/repos/hibernate/hibernate-validator/stargazers","contributors_url":"https://api.github.com/repos/hibernate/hibernate-validator/contributors","subscribers_url":"https://api.github.com/repos/hibernate/hibernate-validator/subscribers","subscription_url":"https://api.github.com/repos/hibernate/hibernate-validator/subscription","commits_url":"https://api.github.com/repos/hibernate/hibernate-validator/commits{/sha}","git_commits_url":"https://api.github.com/repos/hibernate/hibernate-validator/git/commits{/sha}","comments_url":"https://api.github.com/repos/hibernate/hibernate-validator/comments{/number}","issue_comment_url":"https://api.github.com/repos/hibernate/hibernate-validator/issues/comments{/number}","contents_url":"https://api.github.com/repos/hibernate/hibernate-validator/contents/{+path}","compare_url":"https://api.github.com/repos/hibernate/hibernate-validator/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hibernate/hibernate-validator/merges","archive_url":"https://api.github.com/repos/hibernate/hibernate-validator/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hibernate/hibernate-validator/downloads","issues_url":"https://api.github.com/repos/hibernate/hibernate-validator/issues{/number}","pulls_url":"https://api.github.com/repos/hibernate/hibernate-validator/pulls{/number}","milestones_url":"https://api.github.com/repos/hibernate/hibernate-validator/milestones{/number}","notifications_url":"https://api.github.com/repos/hibernate/hibernate-validator/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hibernate/hibernate-validator/labels{/name}","releases_url":"https://api.github.com/repos/hibernate/hibernate-validator/releases{/id}","deployments_url":"https://api.github.com/repos/hibernate/hibernate-validator/deployments","created_at":"2010-10-08T13:25:07Z","updated_at":"2017-10-24T18:14:07Z","pushed_at":"2017-10-24T17:57:35Z","git_url":"git://github.com/hibernate/hibernate-validator.git","ssh_url":"git@github.com:hibernate/hibernate-validator.git","clone_url":"https://github.com/hibernate/hibernate-validator.git","svn_url":"https://github.com/hibernate/hibernate-validator","homepage":"http://hibernate.org/validator/","size":26600,"stargazers_count":405,"watchers_count":405,"language":"Java","has_issues":false,"has_projects":false,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":257,"mirror_url":null,"archived":false,"open_issues_count":6,"forks":257,"open_issues":6,"watchers":405,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hibernate/hibernate-validator/pulls/868"},"html":{"href":"https://github.com/hibernate/hibernate-validator/pull/868"},"issue":{"href":"https://api.github.com/repos/hibernate/hibernate-validator/issues/868"},"comments":{"href":"https://api.github.com/repos/hibernate/hibernate-validator/issues/868/comments"},"review_comments":{"href":"https://api.github.com/repos/hibernate/hibernate-validator/pulls/868/comments"},"review_comment":{"href":"https://api.github.com/repos/hibernate/hibernate-validator/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hibernate/hibernate-validator/pulls/868/commits"},"statuses":{"href":"https://api.github.com/repos/hibernate/hibernate-validator/statuses/2de63223c3ba5eaded7446195396d804e4f90fd7"}},"author_association":"OWNER"}}
{"actor":{"display_login":"gunnarmorling"}}