{"action":"created","comment":{"url":"https://api.github.com/repos/mapstruct/mapstruct/pulls/comments/85379645","pull_request_review_id":6098494,"id":85379645,"diff_hunk":"@@ -18,41 +18,41 @@\n      limitations under the License.\n \n -->\n+<#import \"../macro/SourceUtil.ftl\" as source>\n+<#import \"../macro/TargetUtil.ftl\" as target>\n+<@source.handleExceptions>\n <#if ( ext.existingInstanceMapping ) >\n-    <@_assignment targetWriteAccessorName = localVarName/>\n     if ( ${ext.targetBeanName}.${targetGetterName}() != null ) {\n         ${ext.targetBeanName}.${targetGetterName}().clear();\n-        if ( ${localVarName} != null ) {\n-            ${ext.targetBeanName}.${ext.targetReadAccessorName}().<#if ext.targetType.collectionType>addAll<#else>putAll</#if>( ${localVarName} );\n+        <@source.handleNullCheck>","path":"processor/src/main/resources/org/mapstruct/ap/internal/model/assignment/SetterWrapperForCollectionsAndMaps.ftl","position":13,"original_position":13,"commit_id":"aeb53bf43df0824e52a2423481cec70d09715012","original_commit_id":"aeb53bf43df0824e52a2423481cec70d09715012","user":{"login":"agudian","id":2737102,"avatar_url":"https://avatars.githubusercontent.com/u/2737102?v=3","gravatar_id":"","url":"https://api.github.com/users/agudian","html_url":"https://github.com/agudian","followers_url":"https://api.github.com/users/agudian/followers","following_url":"https://api.github.com/users/agudian/following{/other_user}","gists_url":"https://api.github.com/users/agudian/gists{/gist_id}","starred_url":"https://api.github.com/users/agudian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/agudian/subscriptions","organizations_url":"https://api.github.com/users/agudian/orgs","repos_url":"https://api.github.com/users/agudian/repos","events_url":"https://api.github.com/users/agudian/events{/privacy}","received_events_url":"https://api.github.com/users/agudian/received_events","type":"User","site_admin":false},"body":"That's pretty cool! 👍 ","created_at":"2016-10-27T16:48:27Z","updated_at":"2016-10-27T16:53:04Z","html_url":"https://github.com/mapstruct/mapstruct/pull/932#discussion_r85379645","pull_request_url":"https://api.github.com/repos/mapstruct/mapstruct/pulls/932","_links":{"self":{"href":"https://api.github.com/repos/mapstruct/mapstruct/pulls/comments/85379645"},"html":{"href":"https://github.com/mapstruct/mapstruct/pull/932#discussion_r85379645"},"pull_request":{"href":"https://api.github.com/repos/mapstruct/mapstruct/pulls/932"}}},"pull_request":{"url":"https://api.github.com/repos/mapstruct/mapstruct/pulls/932","id":90103270,"html_url":"https://github.com/mapstruct/mapstruct/pull/932","diff_url":"https://github.com/mapstruct/mapstruct/pull/932.diff","patch_url":"https://github.com/mapstruct/mapstruct/pull/932.patch","issue_url":"https://api.github.com/repos/mapstruct/mapstruct/issues/932","number":932,"state":"open","locked":false,"title":"#913 uncompilable code generated in 1.1.0.CR1 for collection properties","user":{"login":"sjaakd","id":6173283,"avatar_url":"https://avatars.githubusercontent.com/u/6173283?v=3","gravatar_id":"","url":"https://api.github.com/users/sjaakd","html_url":"https://github.com/sjaakd","followers_url":"https://api.github.com/users/sjaakd/followers","following_url":"https://api.github.com/users/sjaakd/following{/other_user}","gists_url":"https://api.github.com/users/sjaakd/gists{/gist_id}","starred_url":"https://api.github.com/users/sjaakd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sjaakd/subscriptions","organizations_url":"https://api.github.com/users/sjaakd/orgs","repos_url":"https://api.github.com/users/sjaakd/repos","events_url":"https://api.github.com/users/sjaakd/events{/privacy}","received_events_url":"https://api.github.com/users/sjaakd/received_events","type":"User","site_admin":false},"body":"The solution is twofold ( 1 & 2) but with some consequences ( 3 & 4):\r\n\r\n1. It introduces the new ideas I have for templates. It uses the `<#nested>` in Freemarker to wrap statements in a null check or try-catch clause. The idea is to gradually phase out the other `xyzWrapper` and only keep an lefthandside (target) and righthandside (source), making stuff a lot simpeler.\r\n\r\n2. Delegate the `NullValueMappingStrategy` to the forged Map/Iterable mapping methods and let them handle default situations. This requires that the user is warned for creating plausible null pointer situations. \r\n\r\n3. Choose (in case the user did not define a `NullValueMappingStrategy`  explicitly for forged methods the `NullValueMappingStrategy.RETURN_DEFAULT` iso  `NullValueMappingStrategy.RETURN_NULL`. This seems more in line with the idea that a used mapping method itself is responsible for handling null input.\r\n\r\n4. There's a drawback, a testcase (#865) starts to fail that expects null to be returned when both source and target collection, which seems reasonable. Possibly bring back some null checks on source here.\r\n\r\nNext step (after CR2): \r\n\r\na. rebasing this on #903 it should be simple to get rid of the `NewCollectionOrMapWrapper` and `EnumSetCopyWrapper`. \r\n\r\nb. As further optimization: a local variable is not required when there's no NPE check.\r\n\r\nc. Plain property mappings in a similar way?\r\n\r\nThere seems to be an issue with delegating the `NullValueMappingStrategy` from `@Mapper` to `@BeanMapping`","created_at":"2016-10-19T22:33:21Z","updated_at":"2016-10-27T16:53:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3f6c42b8067d1864a82214ba2dd4a73acfd030b5","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/mapstruct/mapstruct/pulls/932/commits","review_comments_url":"https://api.github.com/repos/mapstruct/mapstruct/pulls/932/comments","review_comment_url":"https://api.github.com/repos/mapstruct/mapstruct/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mapstruct/mapstruct/issues/932/comments","statuses_url":"https://api.github.com/repos/mapstruct/mapstruct/statuses/aeb53bf43df0824e52a2423481cec70d09715012","head":{"label":"sjaakd:913","ref":"913","sha":"aeb53bf43df0824e52a2423481cec70d09715012","user":{"login":"sjaakd","id":6173283,"avatar_url":"https://avatars.githubusercontent.com/u/6173283?v=3","gravatar_id":"","url":"https://api.github.com/users/sjaakd","html_url":"https://github.com/sjaakd","followers_url":"https://api.github.com/users/sjaakd/followers","following_url":"https://api.github.com/users/sjaakd/following{/other_user}","gists_url":"https://api.github.com/users/sjaakd/gists{/gist_id}","starred_url":"https://api.github.com/users/sjaakd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sjaakd/subscriptions","organizations_url":"https://api.github.com/users/sjaakd/orgs","repos_url":"https://api.github.com/users/sjaakd/repos","events_url":"https://api.github.com/users/sjaakd/events{/privacy}","received_events_url":"https://api.github.com/users/sjaakd/received_events","type":"User","site_admin":false},"repo":{"id":15548682,"name":"mapstruct","full_name":"sjaakd/mapstruct","owner":{"login":"sjaakd","id":6173283,"avatar_url":"https://avatars.githubusercontent.com/u/6173283?v=3","gravatar_id":"","url":"https://api.github.com/users/sjaakd","html_url":"https://github.com/sjaakd","followers_url":"https://api.github.com/users/sjaakd/followers","following_url":"https://api.github.com/users/sjaakd/following{/other_user}","gists_url":"https://api.github.com/users/sjaakd/gists{/gist_id}","starred_url":"https://api.github.com/users/sjaakd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sjaakd/subscriptions","organizations_url":"https://api.github.com/users/sjaakd/orgs","repos_url":"https://api.github.com/users/sjaakd/repos","events_url":"https://api.github.com/users/sjaakd/events{/privacy}","received_events_url":"https://api.github.com/users/sjaakd/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sjaakd/mapstruct","description":"An annotation processor for generating type-safe bean mappers","fork":true,"url":"https://api.github.com/repos/sjaakd/mapstruct","forks_url":"https://api.github.com/repos/sjaakd/mapstruct/forks","keys_url":"https://api.github.com/repos/sjaakd/mapstruct/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sjaakd/mapstruct/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sjaakd/mapstruct/teams","hooks_url":"https://api.github.com/repos/sjaakd/mapstruct/hooks","issue_events_url":"https://api.github.com/repos/sjaakd/mapstruct/issues/events{/number}","events_url":"https://api.github.com/repos/sjaakd/mapstruct/events","assignees_url":"https://api.github.com/repos/sjaakd/mapstruct/assignees{/user}","branches_url":"https://api.github.com/repos/sjaakd/mapstruct/branches{/branch}","tags_url":"https://api.github.com/repos/sjaakd/mapstruct/tags","blobs_url":"https://api.github.com/repos/sjaakd/mapstruct/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sjaakd/mapstruct/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sjaakd/mapstruct/git/refs{/sha}","trees_url":"https://api.github.com/repos/sjaakd/mapstruct/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sjaakd/mapstruct/statuses/{sha}","languages_url":"https://api.github.com/repos/sjaakd/mapstruct/languages","stargazers_url":"https://api.github.com/repos/sjaakd/mapstruct/stargazers","contributors_url":"https://api.github.com/repos/sjaakd/mapstruct/contributors","subscribers_url":"https://api.github.com/repos/sjaakd/mapstruct/subscribers","subscription_url":"https://api.github.com/repos/sjaakd/mapstruct/subscription","commits_url":"https://api.github.com/repos/sjaakd/mapstruct/commits{/sha}","git_commits_url":"https://api.github.com/repos/sjaakd/mapstruct/git/commits{/sha}","comments_url":"https://api.github.com/repos/sjaakd/mapstruct/comments{/number}","issue_comment_url":"https://api.github.com/repos/sjaakd/mapstruct/issues/comments{/number}","contents_url":"https://api.github.com/repos/sjaakd/mapstruct/contents/{+path}","compare_url":"https://api.github.com/repos/sjaakd/mapstruct/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sjaakd/mapstruct/merges","archive_url":"https://api.github.com/repos/sjaakd/mapstruct/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sjaakd/mapstruct/downloads","issues_url":"https://api.github.com/repos/sjaakd/mapstruct/issues{/number}","pulls_url":"https://api.github.com/repos/sjaakd/mapstruct/pulls{/number}","milestones_url":"https://api.github.com/repos/sjaakd/mapstruct/milestones{/number}","notifications_url":"https://api.github.com/repos/sjaakd/mapstruct/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sjaakd/mapstruct/labels{/name}","releases_url":"https://api.github.com/repos/sjaakd/mapstruct/releases{/id}","deployments_url":"https://api.github.com/repos/sjaakd/mapstruct/deployments","created_at":"2013-12-31T11:17:00Z","updated_at":"2015-05-08T20:21:16Z","pushed_at":"2016-10-25T19:47:42Z","git_url":"git://github.com/sjaakd/mapstruct.git","ssh_url":"git@github.com:sjaakd/mapstruct.git","clone_url":"https://github.com/sjaakd/mapstruct.git","svn_url":"https://github.com/sjaakd/mapstruct","homepage":"http://mapstruct.org/","size":4735,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"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":"mapstruct:master","ref":"master","sha":"d94d5857ce479e76ea22099bd9120af06f50e6d1","user":{"login":"mapstruct","id":4086779,"avatar_url":"https://avatars.githubusercontent.com/u/4086779?v=3","gravatar_id":"","url":"https://api.github.com/users/mapstruct","html_url":"https://github.com/mapstruct","followers_url":"https://api.github.com/users/mapstruct/followers","following_url":"https://api.github.com/users/mapstruct/following{/other_user}","gists_url":"https://api.github.com/users/mapstruct/gists{/gist_id}","starred_url":"https://api.github.com/users/mapstruct/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mapstruct/subscriptions","organizations_url":"https://api.github.com/users/mapstruct/orgs","repos_url":"https://api.github.com/users/mapstruct/repos","events_url":"https://api.github.com/users/mapstruct/events{/privacy}","received_events_url":"https://api.github.com/users/mapstruct/received_events","type":"Organization","site_admin":false},"repo":{"id":4470435,"name":"mapstruct","full_name":"mapstruct/mapstruct","owner":{"login":"mapstruct","id":4086779,"avatar_url":"https://avatars.githubusercontent.com/u/4086779?v=3","gravatar_id":"","url":"https://api.github.com/users/mapstruct","html_url":"https://github.com/mapstruct","followers_url":"https://api.github.com/users/mapstruct/followers","following_url":"https://api.github.com/users/mapstruct/following{/other_user}","gists_url":"https://api.github.com/users/mapstruct/gists{/gist_id}","starred_url":"https://api.github.com/users/mapstruct/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mapstruct/subscriptions","organizations_url":"https://api.github.com/users/mapstruct/orgs","repos_url":"https://api.github.com/users/mapstruct/repos","events_url":"https://api.github.com/users/mapstruct/events{/privacy}","received_events_url":"https://api.github.com/users/mapstruct/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mapstruct/mapstruct","description":"An annotation processor for generating type-safe bean mappers","fork":false,"url":"https://api.github.com/repos/mapstruct/mapstruct","forks_url":"https://api.github.com/repos/mapstruct/mapstruct/forks","keys_url":"https://api.github.com/repos/mapstruct/mapstruct/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mapstruct/mapstruct/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mapstruct/mapstruct/teams","hooks_url":"https://api.github.com/repos/mapstruct/mapstruct/hooks","issue_events_url":"https://api.github.com/repos/mapstruct/mapstruct/issues/events{/number}","events_url":"https://api.github.com/repos/mapstruct/mapstruct/events","assignees_url":"https://api.github.com/repos/mapstruct/mapstruct/assignees{/user}","branches_url":"https://api.github.com/repos/mapstruct/mapstruct/branches{/branch}","tags_url":"https://api.github.com/repos/mapstruct/mapstruct/tags","blobs_url":"https://api.github.com/repos/mapstruct/mapstruct/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mapstruct/mapstruct/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mapstruct/mapstruct/git/refs{/sha}","trees_url":"https://api.github.com/repos/mapstruct/mapstruct/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mapstruct/mapstruct/statuses/{sha}","languages_url":"https://api.github.com/repos/mapstruct/mapstruct/languages","stargazers_url":"https://api.github.com/repos/mapstruct/mapstruct/stargazers","contributors_url":"https://api.github.com/repos/mapstruct/mapstruct/contributors","subscribers_url":"https://api.github.com/repos/mapstruct/mapstruct/subscribers","subscription_url":"https://api.github.com/repos/mapstruct/mapstruct/subscription","commits_url":"https://api.github.com/repos/mapstruct/mapstruct/commits{/sha}","git_commits_url":"https://api.github.com/repos/mapstruct/mapstruct/git/commits{/sha}","comments_url":"https://api.github.com/repos/mapstruct/mapstruct/comments{/number}","issue_comment_url":"https://api.github.com/repos/mapstruct/mapstruct/issues/comments{/number}","contents_url":"https://api.github.com/repos/mapstruct/mapstruct/contents/{+path}","compare_url":"https://api.github.com/repos/mapstruct/mapstruct/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mapstruct/mapstruct/merges","archive_url":"https://api.github.com/repos/mapstruct/mapstruct/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mapstruct/mapstruct/downloads","issues_url":"https://api.github.com/repos/mapstruct/mapstruct/issues{/number}","pulls_url":"https://api.github.com/repos/mapstruct/mapstruct/pulls{/number}","milestones_url":"https://api.github.com/repos/mapstruct/mapstruct/milestones{/number}","notifications_url":"https://api.github.com/repos/mapstruct/mapstruct/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mapstruct/mapstruct/labels{/name}","releases_url":"https://api.github.com/repos/mapstruct/mapstruct/releases{/id}","deployments_url":"https://api.github.com/repos/mapstruct/mapstruct/deployments","created_at":"2012-05-28T12:42:42Z","updated_at":"2016-10-26T06:23:27Z","pushed_at":"2016-10-27T09:13:30Z","git_url":"git://github.com/mapstruct/mapstruct.git","ssh_url":"git@github.com:mapstruct/mapstruct.git","clone_url":"https://github.com/mapstruct/mapstruct.git","svn_url":"https://github.com/mapstruct/mapstruct","homepage":"http://mapstruct.org/","size":6178,"stargazers_count":498,"watchers_count":498,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":119,"mirror_url":null,"open_issues_count":160,"forks":119,"open_issues":160,"watchers":498,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mapstruct/mapstruct/pulls/932"},"html":{"href":"https://github.com/mapstruct/mapstruct/pull/932"},"issue":{"href":"https://api.github.com/repos/mapstruct/mapstruct/issues/932"},"comments":{"href":"https://api.github.com/repos/mapstruct/mapstruct/issues/932/comments"},"review_comments":{"href":"https://api.github.com/repos/mapstruct/mapstruct/pulls/932/comments"},"review_comment":{"href":"https://api.github.com/repos/mapstruct/mapstruct/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mapstruct/mapstruct/pulls/932/commits"},"statuses":{"href":"https://api.github.com/repos/mapstruct/mapstruct/statuses/aeb53bf43df0824e52a2423481cec70d09715012"}}}}
{"actor":{"display_login":"agudian"}}