{"action":"created","comment":{"url":"https://api.github.com/repos/hibernate/hibernate-validator/pulls/comments/62456214","id":62456214,"diff_hunk":"@@ -139,6 +139,7 @@\n \tprivate final Map<Class<? extends Annotation>, List<? extends Class<?>>> builtinConstraints;\n \n \tprivate final ValidatorClassMap validatorClasses = new ValidatorClassMap();\n+\tprivate ConcurrentMap<Class<? extends Annotation>, Object> overridenAnnotations = newConcurrentHashMap();","path":"engine/src/main/java/org/hibernate/validator/internal/metadata/core/ConstraintHelper.java","position":4,"original_position":4,"commit_id":"6262f2dc8ecb1925b93d9f216b67b78dcb2ee627","original_commit_id":"c55308612b2c3d995a9aba5470fab427f249cc11","user":{"login":"gunnarmorling","id":28612,"avatar_url":"https://avatars.githubusercontent.com/u/28612?v=3","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":"What is the purpose of this map?","created_at":"2016-05-09T07:02:09Z","updated_at":"2016-05-09T07:02:09Z","html_url":"https://github.com/hibernate/hibernate-validator/pull/468#discussion_r62456214","pull_request_url":"https://api.github.com/repos/hibernate/hibernate-validator/pulls/468","_links":{"self":{"href":"https://api.github.com/repos/hibernate/hibernate-validator/pulls/comments/62456214"},"html":{"href":"https://github.com/hibernate/hibernate-validator/pull/468#discussion_r62456214"},"pull_request":{"href":"https://api.github.com/repos/hibernate/hibernate-validator/pulls/468"}}},"pull_request":{"url":"https://api.github.com/repos/hibernate/hibernate-validator/pulls/468","id":68792672,"html_url":"https://github.com/hibernate/hibernate-validator/pull/468","diff_url":"https://github.com/hibernate/hibernate-validator/pull/468.diff","patch_url":"https://github.com/hibernate/hibernate-validator/pull/468.patch","issue_url":"https://api.github.com/repos/hibernate/hibernate-validator/issues/468","number":468,"state":"open","locked":false,"title":"HV-501 - Extend programmatic API to allow alteration of ConstraintValidator list for a given constraint","user":{"login":"fenrhil","id":412878,"avatar_url":"https://avatars.githubusercontent.com/u/412878?v=3","gravatar_id":"","url":"https://api.github.com/users/fenrhil","html_url":"https://github.com/fenrhil","followers_url":"https://api.github.com/users/fenrhil/followers","following_url":"https://api.github.com/users/fenrhil/following{/other_user}","gists_url":"https://api.github.com/users/fenrhil/gists{/gist_id}","starred_url":"https://api.github.com/users/fenrhil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fenrhil/subscriptions","organizations_url":"https://api.github.com/users/fenrhil/orgs","repos_url":"https://api.github.com/users/fenrhil/repos","events_url":"https://api.github.com/users/fenrhil/events{/privacy}","received_events_url":"https://api.github.com/users/fenrhil/received_events","type":"User","site_admin":false},"body":"Here is the patch for HV-501. I split the PR in two commits:\r\n * the first to introduce the new feature (the programmatic API)\r\n * the second to replace the older, experimental concept of `ConstraintDefinitionContributor` by this new feature.\r\n\r\nSome notes about this PR below.\r\n\r\n1. In the constructor of `ValidatorFactoryImpl`, I had to move up the initialization of `this.constraintMappings`. I'd really like if someone could confirm that this has no way of breaking anything... Unit tests do succeed, but, you know...\r\n2. As a result of these commits, `ConstraintMappingContributor` may now be used for attributing validators to constraints, exactly the feature that was previously provided by `ConstraintDefinitionContributor`. Thus the default contributor `ServiceLoaderBasedConstraintDefinitionContributor` is now `ServiceLoaderBasedConstraintMappingContributor`.\r\n3. I replaced `HibernateValidatorConfiguration#getDefaultConstraintDefinitionContributor` with `HibernateValidatorConfiguration#getDefaultConstraintMappingContributor`. Based solely on the javadoc, it's an API break: nothing in this method's javadoc mentioned the fact that it was part of an experimental API. But the reference documentation was, in my opinion, clearly stating that everything related to the `ConstraintDefinitionContributor`s was experimental, so I'd say it's fine.\r\n4. I'm not sure about what the adequate behavior should be when someone tries to define the same constraint multiple times in different constraint mappings (either programmatic or XML). For now, I made sure that an exception is thrown (see `org.hibernate.validator.test.cfg.ValidatorConstraintMappingTest.testMultipleDefinitionForSameConstraintOnDifferentConstraintMappings()`). This seems consistent with the behavior of XML parsing, though it prevents overriding XML configuration with programmatic API calls.\r\nNote that I had to move some error-checking code from the XML parser to `ConstraintHelper`, which resulted mainly in the message of HV000167 changing slightly. Also, error precedence slightly changed, so for instance if an XML file defines a constraint for the second time, and does it with an invalid class in the validators list, then now an exception will be thrown about the validator and not about the duplicate definition. I think it's more of a minor inconvenience than a real API break, but let me know if you disagree.\r\n5. I updated the reference doc and the relevant tests (moved them to `ConstraintApiTest`), but I think it really needs proofreading.\r\n6. Please let me know if anything's wrong/impolite with my use of `@author` in the Javadoc. I'm not quite sure what I did was in line with your policy.","created_at":"2016-05-03T23:40:29Z","updated_at":"2016-05-09T07:02:09Z","closed_at":null,"merged_at":null,"merge_commit_sha":"66b103f72576edfcb938a38a67d73bc7e3cd71bb","assignee":{"login":"gunnarmorling","id":28612,"avatar_url":"https://avatars.githubusercontent.com/u/28612?v=3","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},"milestone":null,"commits_url":"https://api.github.com/repos/hibernate/hibernate-validator/pulls/468/commits","review_comments_url":"https://api.github.com/repos/hibernate/hibernate-validator/pulls/468/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/468/comments","statuses_url":"https://api.github.com/repos/hibernate/hibernate-validator/statuses/6262f2dc8ecb1925b93d9f216b67b78dcb2ee627","head":{"label":"fenrhil:HV-501","ref":"HV-501","sha":"6262f2dc8ecb1925b93d9f216b67b78dcb2ee627","user":{"login":"fenrhil","id":412878,"avatar_url":"https://avatars.githubusercontent.com/u/412878?v=3","gravatar_id":"","url":"https://api.github.com/users/fenrhil","html_url":"https://github.com/fenrhil","followers_url":"https://api.github.com/users/fenrhil/followers","following_url":"https://api.github.com/users/fenrhil/following{/other_user}","gists_url":"https://api.github.com/users/fenrhil/gists{/gist_id}","starred_url":"https://api.github.com/users/fenrhil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fenrhil/subscriptions","organizations_url":"https://api.github.com/users/fenrhil/orgs","repos_url":"https://api.github.com/users/fenrhil/repos","events_url":"https://api.github.com/users/fenrhil/events{/privacy}","received_events_url":"https://api.github.com/users/fenrhil/received_events","type":"User","site_admin":false},"repo":{"id":56804197,"name":"hibernate-validator","full_name":"fenrhil/hibernate-validator","owner":{"login":"fenrhil","id":412878,"avatar_url":"https://avatars.githubusercontent.com/u/412878?v=3","gravatar_id":"","url":"https://api.github.com/users/fenrhil","html_url":"https://github.com/fenrhil","followers_url":"https://api.github.com/users/fenrhil/followers","following_url":"https://api.github.com/users/fenrhil/following{/other_user}","gists_url":"https://api.github.com/users/fenrhil/gists{/gist_id}","starred_url":"https://api.github.com/users/fenrhil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fenrhil/subscriptions","organizations_url":"https://api.github.com/users/fenrhil/orgs","repos_url":"https://api.github.com/users/fenrhil/repos","events_url":"https://api.github.com/users/fenrhil/events{/privacy}","received_events_url":"https://api.github.com/users/fenrhil/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/fenrhil/hibernate-validator","description":"Hibernate Validator - Bean Validation 1.1 (JSR 349) Reference Implementation","fork":true,"url":"https://api.github.com/repos/fenrhil/hibernate-validator","forks_url":"https://api.github.com/repos/fenrhil/hibernate-validator/forks","keys_url":"https://api.github.com/repos/fenrhil/hibernate-validator/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fenrhil/hibernate-validator/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fenrhil/hibernate-validator/teams","hooks_url":"https://api.github.com/repos/fenrhil/hibernate-validator/hooks","issue_events_url":"https://api.github.com/repos/fenrhil/hibernate-validator/issues/events{/number}","events_url":"https://api.github.com/repos/fenrhil/hibernate-validator/events","assignees_url":"https://api.github.com/repos/fenrhil/hibernate-validator/assignees{/user}","branches_url":"https://api.github.com/repos/fenrhil/hibernate-validator/branches{/branch}","tags_url":"https://api.github.com/repos/fenrhil/hibernate-validator/tags","blobs_url":"https://api.github.com/repos/fenrhil/hibernate-validator/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fenrhil/hibernate-validator/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fenrhil/hibernate-validator/git/refs{/sha}","trees_url":"https://api.github.com/repos/fenrhil/hibernate-validator/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fenrhil/hibernate-validator/statuses/{sha}","languages_url":"https://api.github.com/repos/fenrhil/hibernate-validator/languages","stargazers_url":"https://api.github.com/repos/fenrhil/hibernate-validator/stargazers","contributors_url":"https://api.github.com/repos/fenrhil/hibernate-validator/contributors","subscribers_url":"https://api.github.com/repos/fenrhil/hibernate-validator/subscribers","subscription_url":"https://api.github.com/repos/fenrhil/hibernate-validator/subscription","commits_url":"https://api.github.com/repos/fenrhil/hibernate-validator/commits{/sha}","git_commits_url":"https://api.github.com/repos/fenrhil/hibernate-validator/git/commits{/sha}","comments_url":"https://api.github.com/repos/fenrhil/hibernate-validator/comments{/number}","issue_comment_url":"https://api.github.com/repos/fenrhil/hibernate-validator/issues/comments{/number}","contents_url":"https://api.github.com/repos/fenrhil/hibernate-validator/contents/{+path}","compare_url":"https://api.github.com/repos/fenrhil/hibernate-validator/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fenrhil/hibernate-validator/merges","archive_url":"https://api.github.com/repos/fenrhil/hibernate-validator/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fenrhil/hibernate-validator/downloads","issues_url":"https://api.github.com/repos/fenrhil/hibernate-validator/issues{/number}","pulls_url":"https://api.github.com/repos/fenrhil/hibernate-validator/pulls{/number}","milestones_url":"https://api.github.com/repos/fenrhil/hibernate-validator/milestones{/number}","notifications_url":"https://api.github.com/repos/fenrhil/hibernate-validator/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fenrhil/hibernate-validator/labels{/name}","releases_url":"https://api.github.com/repos/fenrhil/hibernate-validator/releases{/id}","deployments_url":"https://api.github.com/repos/fenrhil/hibernate-validator/deployments","created_at":"2016-04-21T20:38:08Z","updated_at":"2016-04-21T20:38:12Z","pushed_at":"2016-05-03T23:21:28Z","git_url":"git://github.com/fenrhil/hibernate-validator.git","ssh_url":"git@github.com:fenrhil/hibernate-validator.git","clone_url":"https://github.com/fenrhil/hibernate-validator.git","svn_url":"https://github.com/fenrhil/hibernate-validator","homepage":"http://validator.hibernate.org/","size":20746,"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":"hibernate:master","ref":"master","sha":"ef9e0abdba01deb13a0013ef7254b54b4ad23159","user":{"login":"hibernate","id":348262,"avatar_url":"https://avatars.githubusercontent.com/u/348262?v=3","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://avatars.githubusercontent.com/u/348262?v=3","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 1.1 (JSR 349) 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":"2016-05-08T02:33:36Z","pushed_at":"2016-05-05T18:21:08Z","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://validator.hibernate.org/","size":23161,"stargazers_count":228,"watchers_count":228,"language":"Java","has_issues":false,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":163,"mirror_url":null,"open_issues_count":2,"forks":163,"open_issues":2,"watchers":228,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/hibernate/hibernate-validator/pulls/468"},"html":{"href":"https://github.com/hibernate/hibernate-validator/pull/468"},"issue":{"href":"https://api.github.com/repos/hibernate/hibernate-validator/issues/468"},"comments":{"href":"https://api.github.com/repos/hibernate/hibernate-validator/issues/468/comments"},"review_comments":{"href":"https://api.github.com/repos/hibernate/hibernate-validator/pulls/468/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/468/commits"},"statuses":{"href":"https://api.github.com/repos/hibernate/hibernate-validator/statuses/6262f2dc8ecb1925b93d9f216b67b78dcb2ee627"}}}}