tag:github.com,2008:https://github.com/mapstruct/mapstruct/releasesRelease notes from mapstruct2026-02-01T21:45:33Ztag:github.com,2008:Repository/4470435/1.7.0.Beta12026-02-01T22:21:38Z1.7.0.Beta1<h3>Features</h3>
<ul>
<li>Support for Java 21 Sequenced Collections (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1669783533" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3240" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3240/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3240">#3240</a>)</li>
<li>Native support for <code>java.util.Optional</code> mapping (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="113435217" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/674" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/674/hovercard" href="https://github.com/mapstruct/mapstruct/issues/674">#674</a>) - MapStruct now fully supports Optional as both source and target types:
<ul>
<li><code>Optional</code> to <code>Optional</code> - Both source and target wrapped in <code>Optional</code></li>
<li><code>Optional</code> to Non-<code>Optional</code> - Unwrapping <code>Optional</code> values</li>
<li>Non-<code>Optional</code> to <code>Optional</code> - Wrapping values in <code>Optional</code></li>
<li><code>Optional</code> properties in beans with automatic presence checks. Note, there is no null check done for <code>Optional</code> properties.</li>
</ul>
</li>
<li>Improved support for Kotlin. Requires use of <code>org.jetbrains.kotlin:kotlin-metadata-jvm</code>.
<ul>
<li>Data Classes (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="750061802" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/2281" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/2281/hovercard" href="https://github.com/mapstruct/mapstruct/issues/2281">#2281</a>, <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="990675024" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/2577" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/2577/hovercard" href="https://github.com/mapstruct/mapstruct/issues/2577">#2577</a>, <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1385759191" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3031" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3031/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3031">#3031</a>) - MapStruct now properly handles:
<ul>
<li>Single field data classes</li>
<li>Proper primary constructor detection
<ul>
<li>Data classes with multiple constructors</li>
<li>Data classes with all default parameters</li>
</ul>
</li>
</ul>
</li>
<li>Sealed Classes (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1936669155" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3404" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3404/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3404">#3404</a>) - Subclass exhaustiveness is now checked for Kotlin sealed classes</li>
</ul>
</li>
<li>Add support for ignoring multiple target properties at once (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2968034127" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3838" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3838/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3838">#3838</a>) - Using new annotation <code>@Ignored</code></li>
</ul>
<h3>Enhancements</h3>
<ul>
<li>Add support for locale parameter for numberFormat and dateFormat (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2364410848" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3628" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3628/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3628">#3628</a>)</li>
<li>Detect Builder without a factory method (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2551977648" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3729" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3729/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3729">#3729</a>) - With this if there is an inner class that ends with <code>Builder</code> and has a constructor with parameters,<br>
it will be treated as a potential builder.<br>
Builders through static methods on the type have a precedence.</li>
<li>Add support for custom exception for subclass exhaustive strategy for <code>@SubclassMapping</code> mapping (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2886779379" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3821" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3821/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3821">#3821</a>) - Available on <code>@BeanMapping</code>, <code>@Mapper</code> and <code>@MappingConfig</code>.</li>
<li>Add new <code>NullValuePropertyMappingStrategy#CLEAR</code> for clearing Collection and Map properties when updating a bean (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="448035510" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/1830" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/1830/hovercard" href="https://github.com/mapstruct/mapstruct/issues/1830">#1830</a>)</li>
<li>Use deterministic order for supporting fields and methods (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="3474351997" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3940" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3940/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3940">#3940</a>)</li>
<li>Support <code>@AnnotatedWith</code> on decorators (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2457614523" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3659" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3659/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3659">#3659</a>)</li>
<li>Behaviour change: Add warning/error for redundant <code>ignoreUnmappedSourceProperties</code> entries (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="3267156162" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3906" data-hovercard-type="pull_request" data-hovercard-url="/mapstruct/mapstruct/pull/3906/hovercard" href="https://github.com/mapstruct/mapstruct/pull/3906">#3906</a>)</li>
<li>Behaviour change: Warning when the target has no target properties (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="213920034" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/1140" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/1140/hovercard" href="https://github.com/mapstruct/mapstruct/issues/1140">#1140</a>)</li>
<li>Behaviour change: Initialize <code>Optional</code> with <code>Optional.empty</code> instead of <code>null</code> (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="3054458519" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3852" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3852/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3852">#3852</a>)</li>
<li>Behaviour change: Mark <code>String</code> to <code>Number</code> as lossy conversion (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="3038254461" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3848" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3848/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3848">#3848</a>)</li>
</ul>
<h3>Bugs</h3>
<ul>
<li>Improve error message when mapping non-iterable to array (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2723286354" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3786" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3786/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3786">#3786</a>)</li>
<li>Fix conditional mapping with <code>@TargetPropertyName</code> failing for nested update mappings (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2813102079" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3809" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3809/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3809">#3809</a>)</li>
<li>Resolve duplicate invocation of overloaded lifecycle methods with inheritance (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="3044893838" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3849" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3849/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3849">#3849</a>) - It is possible to disable this by using the new compiler option <code>mapstruct.disableLifecycleOverloadDeduplicateSelector</code>.</li>
<li>Support generic <code>@Context</code> (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2521799180" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3711" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3711/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3711">#3711</a>)</li>
<li>Properly apply <code>NullValuePropertyMappingStrategy.IGNORE</code> for collections / maps without setters (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2801756370" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3806" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3806/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3806">#3806</a>)</li>
<li>Properly recognize the type of public generic fields (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2804833987" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3807" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3807/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3807">#3807</a>)</li>
<li>Fix method in Record is treated as a fluent setter (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="3146655942" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3886" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3886/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3886">#3886</a>)</li>
<li>Ensure <code>NullValuePropertyMappingStrategy.SET_TO_DEFAULT</code> initializes empty collection/map when target is null (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="3146239728" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3884" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3884/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3884">#3884</a>)</li>
<li>Fix Compiler error when mapping an object named <code>Override</code> (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="3265347817" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3905" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3905/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3905">#3905</a>)</li>
</ul>
<h3>Documentation</h3>
<ul>
<li>General Improvements
<ul>
<li>Javadoc</li>
<li>Typos in comments</li>
<li>Small code refactorings</li>
</ul>
</li>
</ul>
<h3>Build</h3>
<ul>
<li>Move Windows and MacOS builds outside of the main workflow</li>
<li>Update release to release using the new Maven Central Portal</li>
<li>Skip codecov coverage on forks</li>
<li>Improve testing support for Kotlin</li>
</ul>
<h3>Behaviour Change</h3>
<h4>Warning when the target has no target properties (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="213920034" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/1140" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/1140/hovercard" href="https://github.com/mapstruct/mapstruct/issues/1140">#1140</a>)</h4>
<p>With this change, if the target bean does not have any target properties, a warning will be shown.<br>
This is like this to avoid potential mistakes by users, where they might think that the target bean has properties, but it does not.</p>
<h4>Warning for redundant <code>ignoreUnmappedSourceProperties</code> entries (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="3267156162" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3906" data-hovercard-type="pull_request" data-hovercard-url="/mapstruct/mapstruct/pull/3906/hovercard" href="https://github.com/mapstruct/mapstruct/pull/3906">#3906</a>)</h4>
<p>With this change, if the <code>ignoreUnmappedSourceProperties</code> configuration contains properties that are actually mapped, a warning or compiler error will be shown.<br>
The <code>unmappedSourcePolicy</code> is used to determine whether a warning, or an error is shown.</p>
<h4>Initialize <code>Optional</code> with <code>Optional.empty</code> instead of <code>null</code> (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="3054458519" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3852" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3852/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3852">#3852</a>)</h4>
<p>With this change, if the target <code>Optional</code> property is null, it will be initialized with <code>Optional.empty()</code> instead of <code>null</code>.</p>
<h4>Mark <code>String</code> to <code>Number</code> as lossy conversion (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="3038254461" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3848" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3848/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3848">#3848</a>)</h4>
<p>With this change, if the source <code>String</code> property is mapped to a <code>Number</code> property, a warning will be shown.<br>
This is similar to what is happening when mapping <code>long</code> to <code>int</code>, etc.<br>
The <code>typeConversionPolicy</code> <code>ReportingPolicy</code> is used to determine whether a warning, error or ignore is shown.</p>github-actions[bot]tag:github.com,2008:Repository/4470435/1.6.32024-11-09T11:39:58Z1.6.3<h3>Bugs</h3>
<ul>
<li>Redundant if condition in Java record mapping with <code>RETURN_DEFAULT</code> strategy (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2598936378" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3747" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3747/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3747">#3747</a>)</li>
<li>Stackoverflow with Immutables custom builder (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1877522884" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3370" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3370/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3370">#3370</a>)</li>
<li>Unused import of <code>java.time.LocalDate</code> when mapping source <code>LocalDateTime</code> to target <code>LocalDate</code> (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2555335015" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3732" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3732/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3732">#3732</a>)</li>
</ul>
<h3>Documentation</h3>
<ul>
<li>Add section to README.md comparing mapstruct with Java Records (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2619711464" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3751" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3751/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3751">#3751</a>)</li>
</ul>github-actions[bot]tag:github.com,2008:Repository/4470435/1.6.22024-09-16T08:06:40Z1.6.2<h3>Bugs</h3>
<ul>
<li>Regression from 1.6.1: ClassCastException when using records (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2527499938" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3717" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3717/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3717">#3717</a>)</li>
</ul>github-actions[bot]tag:github.com,2008:Repository/4470435/1.6.12024-09-19T21:23:31Z1.6.1<h3>Enhancements</h3>
<ul>
<li>Use Java <code>LinkedHashSet</code> and <code>LinkedHashMap</code> new factory method with known capacity when on Java 19 or later (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1498499257" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3113" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3113/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3113">#3113</a>)</li>
</ul>
<h3>Bugs</h3>
<ul>
<li>Inverse Inheritance Strategy not working for ignored mappings only with target (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2430830996" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3652" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3652/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3652">#3652</a>)</li>
<li>Inconsistent ambiguous mapping method error when using <code>SubclassMapping</code>: generic vs raw types (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2466742797" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3668" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3668/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3668">#3668</a>)</li>
<li>Fix regression when using <code>InheritInverseConfiguration</code> with nested target properties and reversing <code>target = "."</code> (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2468068370" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3670" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3670/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3670">#3670</a>)</li>
<li>Deep mapping with multiple mappings broken in 1.6.0 (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2465969786" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3667" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3667/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3667">#3667</a>)</li>
<li>Two different constants are ignored in 1.6.0 (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2469691080" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3673" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3673/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3673">#3673</a>)</li>
<li>Inconsistent ambiguous mapping method error: generic vs raw types in 1.6.0 (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2466742797" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3668" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3668/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3668">#3668</a>)</li>
<li>Fix cross module records with interfaces not recognizing accessors (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2461246524" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3661" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3661/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3661">#3661</a>)</li>
<li><code>@AfterMapping</code> methods are called twice when using target with builder (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2473538497" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3678" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3678/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3678">#3678</a>)</li>
<li>Compile error when using <code>@AfterMapping</code> method with Builder and TargetObject (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2513037806" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3703" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3703/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3703">#3703</a>)</li>
</ul>
<h3>Behaviour change</h3>
<h4>Inverse Inheritance Strategy not working for ignored mappings only with target</h4>
<p>Prior to this fix <code>@Mapping(target = "myProperty", ignore = true)</code> was being ignored when using <code>@InheritInverseConfiguration</code>.</p>
<p>e.g.</p>
<div class="highlight highlight-source-java notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="@Mapper
public interface ModelMapper {
@Mapping(target = "creationDate", ignore = true)
Entity toEntity(Model model);
@InheritInverseConfiguration
Model toModel(Entity entity);
}"><pre><span class="pl-c1">@</span><span class="pl-c1">Mapper</span>
<span class="pl-k">public</span> <span class="pl-k">interface</span> <span class="pl-smi">ModelMapper</span> {
<span class="pl-c1">@</span><span class="pl-c1">Mapping</span>(<span class="pl-s1">target</span> = <span class="pl-s">"creationDate"</span>, <span class="pl-s1">ignore</span> = <span class="pl-c1">true</span>)
<span class="pl-smi">Entity</span> <span class="pl-en">toEntity</span>(<span class="pl-smi">Model</span> <span class="pl-s1">model</span>);
<span class="pl-c1">@</span><span class="pl-c1">InheritInverseConfiguration</span>
<span class="pl-smi">Model</span> <span class="pl-en">toModel</span>(<span class="pl-smi">Entity</span> <span class="pl-s1">entity</span>);
}</pre></div>
<p>In the example above prior 1.6.1 the <code>Model toModel(Entity entity)</code> was going to map the <code>id</code> property. In order to keep that behavior you'll need to explicitly do the mapping for it.</p>
<div class="highlight highlight-source-java notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="@Mapper
public interface ModelMappe {
@Mapping(target = "creationDate", ignore = true) // NOTE: Handled by JPA.
Entity toEntity(Model model);
@InheritInverseConfiguration
@Mapping(target = "creationDate", source = "creationDate") // Allow reading from Entity
Model toModel(Entity entity);
}"><pre><span class="pl-c1">@</span><span class="pl-c1">Mapper</span>
<span class="pl-k">public</span> <span class="pl-k">interface</span> <span class="pl-smi">ModelMappe</span> {
<span class="pl-c1">@</span><span class="pl-c1">Mapping</span>(<span class="pl-s1">target</span> = <span class="pl-s">"creationDate"</span>, <span class="pl-s1">ignore</span> = <span class="pl-c1">true</span>) <span class="pl-c">// NOTE: Handled by JPA.</span>
<span class="pl-smi">Entity</span> <span class="pl-en">toEntity</span>(<span class="pl-smi">Model</span> <span class="pl-s1">model</span>);
<span class="pl-c1">@</span><span class="pl-c1">InheritInverseConfiguration</span>
<span class="pl-c1">@</span><span class="pl-c1">Mapping</span>(<span class="pl-s1">target</span> = <span class="pl-s">"creationDate"</span>, <span class="pl-s1">source</span> = <span class="pl-s">"creationDate"</span>) <span class="pl-c">// Allow reading from Entity</span>
<span class="pl-smi">Model</span> <span class="pl-en">toModel</span>(<span class="pl-smi">Entity</span> <span class="pl-s1">entity</span>);
}</pre></div>github-actions[bot]tag:github.com,2008:Repository/4470435/1.6.02024-08-12T21:08:53Z1.6.0<h3>Previous Release Notes</h3>
<ul>
<li><a href="https://github.com/mapstruct/mapstruct/releases/tag/1.6.0.RC1">1.6.0.RC1</a></li>
<li><a href="https://github.com/mapstruct/mapstruct/releases/tag/1.6.0.Beta2">1.6.0.Beta2</a></li>
<li><a href="https://github.com/mapstruct/mapstruct/releases/tag/1.6.0.Beta1">1.6.0.Beta1</a></li>
</ul>github-actions[bot]tag:github.com,2008:Repository/4470435/1.6.0.RC12024-08-12T20:50:08Z1.6.0.RC1<h3>Enhancements</h3>
<ul>
<li>Breaking change: (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2254484059" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3574" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3574/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3574">#3574</a>) -<br>
This reverts <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="978479966" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/2560" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/2560/hovercard" href="https://github.com/mapstruct/mapstruct/issues/2560">#2560</a>, because we've decided that <code>@BeanMapping(ignoreByDefault = true)</code> should only be applied to target properties and not to source properties.<br>
Source properties are ignored anyway, the <code>BeanMapping#unmappedSourcePolicy</code> should be used to control what should happen with unmapped source policy</li>
</ul>
<h3>Bugs</h3>
<ul>
<li>Breaking change: Presence check method used only once when multiple source parameters are provided (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2288498944" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3601" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3601/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3601">#3601</a>)</li>
<li>Fix <code>@SubclassMapping</code> not working with <code>@BeanMapping#ignoreUnmappedSourceProperties</code> (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2300168833" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3609" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3609/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3609">#3609</a>)</li>
<li>Fix duplicate method generation with recursive auto mapping (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2276981205" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3591" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3591/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3591">#3591</a>)</li>
</ul>
<h3>Documentation</h3>
<ul>
<li>Fix documentation of <code>unmappedSourcePolicy</code> default value (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2392789637" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3635" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3635/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3635">#3635</a>)</li>
<li>Fix documentation link of before and after mapping when using builders (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2408672983" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3639" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3639/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3639">#3639</a>)</li>
<li>Fix typo in experimental note (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2391084070" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3634" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3634/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3634">#3634</a>)</li>
<li>Add example classes for the passing target type documentation (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2064462290" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3504" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3504/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3504">#3504</a>)</li>
</ul>
<h3>Build</h3>
<ul>
<li>Enforce whitespaces around the for colon with CheckStyle (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2409012715" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3642" data-hovercard-type="pull_request" data-hovercard-url="/mapstruct/mapstruct/pull/3642/hovercard" href="https://github.com/mapstruct/mapstruct/pull/3642">#3642</a>)</li>
</ul>
<h2>Breaking changes</h2>
<h3>Presence checks for source parameters</h3>
<p>In 1.6, support for presence checks on source parameters has been added.<br>
This means that even if you want to map a source parameter directly to some target property the new <code>@SourceParameterCondition</code> or <code>@Condition(appliesTo = ConditionStrategy.SOURCE_PARAMETERS)</code> should be used.</p>
<p>e.g.</p>
<p>If we had the following in 1.5:</p>
<div class="highlight highlight-source-java notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="@Mapper
public interface OrderMapper {
@Mapping(source = "dto", target = "customer", conditionQualifiedByName = "mapCustomerFromOrder")
Order map(OrderDTO dto);
@Condition
@Named("mapCustomerFromOrder")
default boolean mapCustomerFromOrder(OrderDTO dto) {
return dto != null && dto.getCustomerName() != null;
}
}"><pre><span class="pl-c1">@</span><span class="pl-c1">Mapper</span>
<span class="pl-k">public</span> <span class="pl-k">interface</span> <span class="pl-smi">OrderMapper</span> {
<span class="pl-c1">@</span><span class="pl-c1">Mapping</span>(<span class="pl-s1">source</span> = <span class="pl-s">"dto"</span>, <span class="pl-s1">target</span> = <span class="pl-s">"customer"</span>, <span class="pl-s1">conditionQualifiedByName</span> = <span class="pl-s">"mapCustomerFromOrder"</span>)
<span class="pl-smi">Order</span> <span class="pl-en">map</span>(<span class="pl-smi">OrderDTO</span> <span class="pl-s1">dto</span>);
<span class="pl-c1">@</span><span class="pl-c1">Condition</span>
<span class="pl-c1">@</span><span class="pl-c1">Named</span>(<span class="pl-s">"mapCustomerFromOrder"</span>)
<span class="pl-k">default</span> <span class="pl-smi">boolean</span> <span class="pl-en">mapCustomerFromOrder</span>(<span class="pl-smi">OrderDTO</span> <span class="pl-s1">dto</span>) {
<span class="pl-k">return</span> <span class="pl-s1">dto</span> != <span class="pl-c1">null</span> && <span class="pl-s1">dto</span>.<span class="pl-en">getCustomerName</span>() != <span class="pl-c1">null</span>;
}
}</pre></div>
<p>Then MapStruct would generate</p>
<div class="highlight highlight-source-java notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="public class OrderMapperImpl implements OrderMapper {
@Override
public Order map(OrderDTO dto) {
if ( dto == null ) {
return null;
}
Order order = new Order();
if ( mapCustomerFromOrder( dto ) ) {
order.setCustomer( orderDtoToCustomer( orderDTO ) );
}
return order;
}
}"><pre><span class="pl-k">public</span> <span class="pl-k">class</span> <span class="pl-smi">OrderMapperImpl</span> <span class="pl-k">implements</span> <span class="pl-smi">OrderMapper</span> {
<span class="pl-c1">@</span><span class="pl-c1">Override</span>
<span class="pl-k">public</span> <span class="pl-smi">Order</span> <span class="pl-en">map</span>(<span class="pl-smi">OrderDTO</span> <span class="pl-s1">dto</span>) {
<span class="pl-k">if</span> ( <span class="pl-s1">dto</span> == <span class="pl-c1">null</span> ) {
<span class="pl-k">return</span> <span class="pl-c1">null</span>;
}
<span class="pl-smi">Order</span> <span class="pl-s1">order</span> = <span class="pl-k">new</span> <span class="pl-smi">Order</span>();
<span class="pl-k">if</span> ( <span class="pl-en">mapCustomerFromOrder</span>( <span class="pl-s1">dto</span> ) ) {
<span class="pl-s1">order</span>.<span class="pl-en">setCustomer</span>( <span class="pl-en">orderDtoToCustomer</span>( <span class="pl-s1">orderDTO</span> ) );
}
<span class="pl-k">return</span> <span class="pl-s1">order</span>;
}
}</pre></div>
<p>In order for the same to be generated in 1.6, the mapper needs to look like this:</p>
<div class="highlight highlight-source-java notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="@Mapper
public interface OrderMapper {
@Mapping(source = "dto", target = "customer", conditionQualifiedByName = "mapCustomerFromOrder")
Order map(OrderDTO dto);
@SourceParameterCondition
@Named("mapCustomerFromOrder")
default boolean mapCustomerFromOrder(OrderDTO dto) {
return dto != null && dto.getCustomerName() != null;
}
}"><pre><span class="pl-c1">@</span><span class="pl-c1">Mapper</span>
<span class="pl-k">public</span> <span class="pl-k">interface</span> <span class="pl-smi">OrderMapper</span> {
<span class="pl-c1">@</span><span class="pl-c1">Mapping</span>(<span class="pl-s1">source</span> = <span class="pl-s">"dto"</span>, <span class="pl-s1">target</span> = <span class="pl-s">"customer"</span>, <span class="pl-s1">conditionQualifiedByName</span> = <span class="pl-s">"mapCustomerFromOrder"</span>)
<span class="pl-smi">Order</span> <span class="pl-en">map</span>(<span class="pl-smi">OrderDTO</span> <span class="pl-s1">dto</span>);
<span class="pl-c1">@</span><span class="pl-c1">SourceParameterCondition</span>
<span class="pl-c1">@</span><span class="pl-c1">Named</span>(<span class="pl-s">"mapCustomerFromOrder"</span>)
<span class="pl-k">default</span> <span class="pl-smi">boolean</span> <span class="pl-en">mapCustomerFromOrder</span>(<span class="pl-smi">OrderDTO</span> <span class="pl-s1">dto</span>) {
<span class="pl-k">return</span> <span class="pl-s1">dto</span> != <span class="pl-c1">null</span> && <span class="pl-s1">dto</span>.<span class="pl-en">getCustomerName</span>() != <span class="pl-c1">null</span>;
}
}</pre></div>github-actions[bot]tag:github.com,2008:Repository/4470435/1.6.0.Beta22024-05-11T07:11:53Z1.6.0.Beta2<h3>Features</h3>
<ul>
<li>Support conditional mapping for source parameters (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1028039618" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/2610" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/2610/hovercard" href="https://github.com/mapstruct/mapstruct/issues/2610">#2610</a>, <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2020174239" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3459" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3459/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3459">#3459</a>, <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1704051497" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3270" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3270/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3270">#3270</a>)</li>
<li>Add <code>@SourcePropertyName</code> to handle a property name of the source object (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1795252114" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3323" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3323/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3323">#3323</a>) - Currently only applicable for <code>@Condition</code> methods</li>
</ul>
<h3>Enhancements</h3>
<ul>
<li>Improve error message for mapping to <code>target = "."</code> using expression (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2057251489" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3485" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3485/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3485">#3485</a>)</li>
<li>Improve error messages for auto generated mappings (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1172086865" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/2788" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/2788/hovercard" href="https://github.com/mapstruct/mapstruct/issues/2788">#2788</a>)</li>
<li>Remove unnecessary casts to long (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1933862375" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3400" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3400/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3400">#3400</a>)</li>
</ul>
<h3>Bugs</h3>
<ul>
<li><code>@Condition</code> cannot be used only with <code>@Context</code> parameters (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2204321390" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3561" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3561/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3561">#3561</a>)</li>
<li><code>@Condition</code> treated as ambiguous mapping for methods returning Boolean/boolean (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2209782244" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3565" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3565/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3565">#3565</a>)</li>
<li>Subclass mapping warns about unmapped property that is mapped in referenced mapper (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1849232036" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3360" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3360/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3360">#3360</a>)</li>
<li>Interface inherited build method is not found (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2024037720" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3463" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3463/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3463">#3463</a>)</li>
<li>Bean with getter returning Stream is treating the Stream as an alternative setter (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2022465996" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3462" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3462/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3462">#3462</a>)</li>
<li>Using <code>Mapping#expression</code> and <code>Mapping#conditionalQualifiedBy(Name)</code> should lead to compile error (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1943975271" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3413" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3413/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3413">#3413</a>)</li>
<li>Defined mappings for subclass mappings with runtime exception subclass exhaustive strategy not working if result type is abstract class (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1807052101" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3331" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3331/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3331">#3331</a>)</li>
</ul>
<h3>Documentation</h3>
<ul>
<li>Clarify that <code>Mapping#ignoreByDefault</code> is inherited in nested mappings in documentation (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2263321461" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3577" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3577/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3577">#3577</a>)</li>
</ul>
<h3>Build</h3>
<ul>
<li>Improve tests to show that Lombok <code>@SuperBuilder</code> is supported (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2128938503" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3524" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3524/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3524">#3524</a>)</li>
<li>Add Java 21 CI matrix build (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2045134912" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3473" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3473/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3473">#3473</a>)</li>
</ul>github-actions[bot]tag:github.com,2008:Repository/4470435/early-access2024-05-09T13:19:23Zearly-accessNo content.filiphrtag:github.com,2008:Repository/4470435/1.6.0.Beta12024-05-01T06:36:54Z1.6.0.Beta1<h3>Features</h3>
<ul>
<li>Access to target property name (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1078379319" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/2688" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/2688/hovercard" href="https://github.com/mapstruct/mapstruct/issues/2688">#2688</a>) - <code>@TargetPropertyName</code> can be used to access the target property name to conditional and mapping methods</li>
<li>Support passing annotations to generated code (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="347677883" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/1574" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/1574/hovercard" href="https://github.com/mapstruct/mapstruct/issues/1574">#1574</a>, <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1153721935" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/2773" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/2773/hovercard" href="https://github.com/mapstruct/mapstruct/issues/2773">#2773</a>, <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1275855465" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/2895" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/2895/hovercard" href="https://github.com/mapstruct/mapstruct/issues/2895">#2895</a>, <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1349773549" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/2983" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/2983/hovercard" href="https://github.com/mapstruct/mapstruct/issues/2983">#2983</a>) - Using <code>@AnnotateWith</code>. If a method is annotated with <code>@Deprecated</code> it is automatically copied into the generated code.</li>
<li>Support for globally defining <code>nullValueIterableMappingStrategy</code> and <code>nullValueMapMappingStrategy</code> (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1335431487" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/2953" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/2953/hovercard" href="https://github.com/mapstruct/mapstruct/issues/2953">#2953</a>) - The different strategies can be configured using <code>mapstruct.nullValueIterableMappingStrategy</code> and <code>mapstruct.nullValueMapMappingStrategy</code> respectively</li>
<li>Support qualifiers for <code>SubclassMapping</code> annotated methods (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1509648728" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3119" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3119/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3119">#3119</a>)</li>
<li>Support defining custom processor options for custom SPI (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1436725287" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3071" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3071/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3071">#3071</a>) - There is also <code>AdditionalSupportedOptionsProvider</code> that can be used to defined the supported options for a custom SPI. The additional options cannot start with <code>mapstruct</code>.</li>
<li>Support for defining Javadoc on the generated mapper (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1351088773" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/2987" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/2987/hovercard" href="https://github.com/mapstruct/mapstruct/issues/2987">#2987</a>) - Using <code>@Javadoc</code></li>
</ul>
<h3>Enhancements</h3>
<ul>
<li>Support for converting between <code>Enum</code> and <code>Integer</code> (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1343924831" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/2963" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/2963/hovercard" href="https://github.com/mapstruct/mapstruct/issues/2963">#2963</a>)</li>
<li>Support for converting between <code>Locale</code> and <code>String</code> (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1597659589" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3172" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3172/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3172">#3172</a>)</li>
<li>Support for implicit conversion between <code>java.time.LocalDate</code> and <code>java.time.LocalDateTime</code> (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1625890751" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3199" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3199/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3199">#3199</a>)</li>
<li>Support custom name in Spring annotations (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="314172503" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/1427" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/1427/hovercard" href="https://github.com/mapstruct/mapstruct/issues/1427">#1427</a>) - Can be done using <code>@AnnotateWith(value = Service.class, elements = @AnnotateWith.Element(strings = "cakeMapperV2"))</code></li>
<li>Support meta annotations for <code>@ValueMapping</code> (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1389593547" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3037" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3037/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3037">#3037</a>)</li>
<li>Ambiguous mapping method but there is a more specific mapping (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="232172035" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/1216" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/1216/hovercard" href="https://github.com/mapstruct/mapstruct/issues/1216">#1216</a>)</li>
<li>Do not treat getter as an alternative write accessor when using <code>CollectionMappingStrategy#TARGET_IMMUTABLE</code> (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1332862301" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/2952" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/2952/hovercard" href="https://github.com/mapstruct/mapstruct/issues/2952">#2952</a>)</li>
<li>Improve line location report for invalid qualifier for <code>SubclassMapping</code> (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1628880304" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3202" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3202/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3202">#3202</a>)</li>
<li>Support <code>@InheritConfiguration</code> for <code>@SubclassMapping</code> in methods with identical signature (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1511713010" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3125" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3125/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3125">#3125</a>)</li>
<li>Do not require <code>subclassExhaustiveStrategy</code> when source is a sealed class and all subtypes are specified (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1409865211" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3054" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3054/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3054">#3054</a>)</li>
<li>Add validation of <code>String</code> type for <code>@TargetPropertyName</code> (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1254184491" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/2863" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/2863/hovercard" href="https://github.com/mapstruct/mapstruct/issues/2863">#2863</a>)</li>
<li>Support for all lifecycle methods on type being build with builders (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="316924019" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/1454" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/1454/hovercard" href="https://github.com/mapstruct/mapstruct/issues/1454">#1454</a>)
<ul>
<li><code>@BeforeMapping</code> with <code>@TargetType</code> the type being build</li>
<li><code>@AfterMapping</code> with <code>@TargetType</code> the type being build</li>
<li><code>@AfterMapping</code> with <code>@MappingTarget</code> the type being build</li>
</ul>
</li>
<li>Redundant null checks for nested properties (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1675185299" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3245" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3245/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3245">#3245</a>)</li>
<li><code>@Default</code> on Java Record's constructor isn't respected (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1658120599" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3231" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3231/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3231">#3231</a>)</li>
<li>Add <code>InjectionStrategy.SETTER</code> (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1653539163" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3229" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3229/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3229">#3229</a>)</li>
<li>Add <code>BeanMapping#unmappedSourcePolicy</code> (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1760383511" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3309" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3309/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3309">#3309</a>)</li>
<li>Improve support for Map attributes for immutables (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1461959591" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3089" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3089/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3089">#3089</a>)</li>
<li>Support mapping <code>Iterable</code> to <code>Collection</code> (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1887380409" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3376" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3376/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3376">#3376</a>)</li>
</ul>
<h3>Bugs</h3>
<ul>
<li>Breaking change: Mapping from Map to Bean (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1556971180" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3144" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3144/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3144">#3144</a>)</li>
<li>Condition with <code>@TargetType</code> on <code>Collection</code> fails to compile (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1277156628" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/2901" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/2901/hovercard" href="https://github.com/mapstruct/mapstruct/issues/2901">#2901</a>)</li>
<li>Annotations are automatically passed in forged methods (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1364458927" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3015" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3015/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3015">#3015</a>)</li>
<li>Mapping Composition does not work for <code>@SubclassMapping</code> (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1599805725" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3174" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3174/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3174">#3174</a>)</li>
<li>Mapping control disabling conversions does not disable them in 2 step mappings (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1613057967" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3186" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3186/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3186">#3186</a>)</li>
<li><code>@BeanMapping(ignoreByDefault = true)</code> does not work for constructor properties (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1586122731" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3158" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3158/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3158">#3158</a>)</li>
<li><code>@ValueMapping</code> strips spaces from source (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1574521112" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3153" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3153/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3153">#3153</a>)</li>
<li><code>defaultExpression</code> does not work when mapping a collection of custom types (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1588179594" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3159" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3159/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3159">#3159</a>)</li>
<li>Arrays cannot be mapped to collection / iterable using an adder method (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1589989052" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3165" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3165/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3165">#3165</a>)</li>
<li>Unmapped source properties error when source is mapped to a nested field of the target object (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1163925987" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/2781" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/2781/hovercard" href="https://github.com/mapstruct/mapstruct/issues/2781">#2781</a>)</li>
<li><code>NullPointerException</code> when ignoring target '.' (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1669742744" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3238" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3238/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3238">#3238</a>) - There is now a compilation error instead of an error in the processor</li>
<li><code>NullValuePropertyMappingStrategy.IGNORE</code> does not ignore target collection even when source one is null (only when <code>collectionMappingStrategy = CollectionMappingStrategy.TARGET_IMMUTABLE</code>) (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1482045700" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3104" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3104/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3104">#3104</a>)</li>
<li><code>@SubclassMapping</code> not working with <code>@Mapping</code> nested properties and target all (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1513694745" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3126" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3126/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3126">#3126</a>)</li>
<li>Compile error when using <code>default</code> and <code>static</code> methods in <code>@MapperConfig</code> (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1736531285" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3296" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3296/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3296">#3296</a>)</li>
<li>Generic class with adder method and <code>CollectionMappingStrategy.ADDER_PREFERRED</code> fails (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1761515830" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3310" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3310/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3310">#3310</a>)</li>
<li>MapStruct can not map only primitives (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1781909092" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3317" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3317/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3317">#3317</a>)</li>
<li>2-step mapping with generics does not work correctly (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1059147275" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/2663" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/2663/hovercard" href="https://github.com/mapstruct/mapstruct/issues/2663">#2663</a>)</li>
<li>MapStruct no longer handles generic mapping methods (in conjunction with immutables) after upgrading from 1.4.x to version 1.5.x (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1589542225" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3163" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3163/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3163">#3163</a>)</li>
<li>Ignored mappings when using <code>@InheritConfiguration</code> (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1854513774" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3361" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3361/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3361">#3361</a>)</li>
</ul>
<h3>Documentation</h3>
<ul>
<li>Use GitHub new Issue Form Templates (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1361071146" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3008" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3008/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3008">#3008</a>)</li>
<li>Mapping composition is no longer experimental (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1669759294" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3239" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3239/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3239">#3239</a>)</li>
<li>Improve Lombok integration documentation (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1885027830" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3374" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3374/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3374">#3374</a>)</li>
</ul>
<h3>Build / Refactoring</h3>
<ul>
<li>Try to stabilise some date conversion tests (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1190683444" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/2806" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/2806/hovercard" href="https://github.com/mapstruct/mapstruct/issues/2806">#2806</a>)</li>
<li>Avoid unnecessary unboxing of Boolean (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1358968242" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3003" data-hovercard-type="pull_request" data-hovercard-url="/mapstruct/mapstruct/pull/3003/hovercard" href="https://github.com/mapstruct/mapstruct/pull/3003">#3003</a>)</li>
<li>Update FreeMarker to 2.3.32</li>
<li>Refactor method selection and use a context to be able to more easily access information (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1718572392" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3280" data-hovercard-type="pull_request" data-hovercard-url="/mapstruct/mapstruct/pull/3280/hovercard" href="https://github.com/mapstruct/mapstruct/pull/3280">#3280</a>)</li>
<li>Update tarLongFileMode to use POSIX (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1820671274" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3340" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3340/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3340">#3340</a>)</li>
<li>Simplified some expressions, redundant expressions removed (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1731268225" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3292" data-hovercard-type="pull_request" data-hovercard-url="/mapstruct/mapstruct/pull/3292/hovercard" href="https://github.com/mapstruct/mapstruct/pull/3292">#3292</a>)</li>
<li>Refactor to use presence check for mapping methods (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1831149755" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3347" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3347/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3347">#3347</a>) - Still only internal and custom presence checks methods are not supported for source parameters (see <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1028039618" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/2610" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/2610/hovercard" href="https://github.com/mapstruct/mapstruct/issues/2610">#2610</a> for that)</li>
<li>Update github actions (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1924962698" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3397" data-hovercard-type="pull_request" data-hovercard-url="/mapstruct/mapstruct/pull/3397/hovercard" href="https://github.com/mapstruct/mapstruct/pull/3397">#3397</a>)
<ul>
<li>Add Java 21 to test matrix</li>
<li>Add Java EA to test matrix</li>
<li>Removing java 13 and 18 from test matrict</li>
</ul>
</li>
</ul>
<h2>Breaking Changes</h2>
<h3>Map to Bean</h3>
<p>In 1.5 we added support for mapping a map to a bean by implicitly mapping all the properties from the target bean by accessing them from the map. However, this lead to some problems in multi mapping methods. Therefore, in this release we tightened up a bit and in multi source mapping methods the Map will not be considered when doing implicit mappings.</p>
<p>e.g.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="@Mapper
public interface CarMapper {
// This method is going to implicitly map all the target properties from the map
Target map(Map<String, Object> map);
// This method is not going to use the map for implicit mappings.
// Only the name will be mapped from the map (since it has been defined like that
@Mapping(target = "name", source = "map.name")
Target map(Source source, Map<String, Object> map)
}"><pre class="notranslate"><code>@Mapper
public interface CarMapper {
// This method is going to implicitly map all the target properties from the map
Target map(Map<String, Object> map);
// This method is not going to use the map for implicit mappings.
// Only the name will be mapped from the map (since it has been defined like that
@Mapping(target = "name", source = "map.name")
Target map(Source source, Map<String, Object> map)
}
</code></pre></div>
<h3><code>@BeanMapping</code> inheritance</h3>
<p>All, except <code>resultType</code> and <code>ignoredUnmappedSourceProperties</code> attributes of <code>@BeanMapping</code> have been made to consistently be passed down to the generated nested methods. This means that if you were relying on some buggy behavior it might no longer work.</p>
<p>e.g. <code>BeanMapping#ignoreByDefault</code> was not being passed down properly, i.e. implicit mapping was being done for nested properties. This has been fixed. If you want to implicitly map nested mappings then you'll have to define your own mapper appropriatelly.</p>
<div class="highlight highlight-source-java notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="@Mapper
interface MyMapper {
@BeanMapping( ignoreByDefault = true )
@Mapping( source = "sub", target = "target" )
Target map( Source source );
}"><pre><span class="pl-c1">@</span><span class="pl-c1">Mapper</span>
<span class="pl-k">interface</span> <span class="pl-smi">MyMapper</span> {
<span class="pl-c1">@</span><span class="pl-c1">BeanMapping</span>( <span class="pl-s1">ignoreByDefault</span> = <span class="pl-c1">true</span> )
<span class="pl-c1">@</span><span class="pl-c1">Mapping</span>( <span class="pl-s1">source</span> = <span class="pl-s">"sub"</span>, <span class="pl-s1">target</span> = <span class="pl-s">"target"</span> )
<span class="pl-smi">Target</span> <span class="pl-en">map</span>( <span class="pl-smi">Source</span> <span class="pl-s1">source</span> );
}</pre></div>
<p>needs to be replaced with</p>
<div class="highlight highlight-source-java notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="@Mapper
interface MyMapper {
@BeanMapping( ignoreByDefault = true )
@Mapping( source = "sub", target = "target" )
Target map( Source source );
// this is the mapping `source = "sub"` and `target = "target"`
// redefined to get rid of the `ignoreByDefault=true`, because this property is inherited
SubTarget subSourceToSubTarget( SubSource subSource );
}"><pre><span class="pl-c1">@</span><span class="pl-c1">Mapper</span>
<span class="pl-k">interface</span> <span class="pl-smi">MyMapper</span> {
<span class="pl-c1">@</span><span class="pl-c1">BeanMapping</span>( <span class="pl-s1">ignoreByDefault</span> = <span class="pl-c1">true</span> )
<span class="pl-c1">@</span><span class="pl-c1">Mapping</span>( <span class="pl-s1">source</span> = <span class="pl-s">"sub"</span>, <span class="pl-s1">target</span> = <span class="pl-s">"target"</span> )
<span class="pl-smi">Target</span> <span class="pl-en">map</span>( <span class="pl-smi">Source</span> <span class="pl-s1">source</span> );
<span class="pl-c">// this is the mapping `source = "sub"` and `target = "target"` </span>
<span class="pl-c">// redefined to get rid of the `ignoreByDefault=true`, because this property is inherited</span>
<span class="pl-smi">SubTarget</span> <span class="pl-en">subSourceToSubTarget</span>( <span class="pl-smi">SubSource</span> <span class="pl-s1">subSource</span> );
}</pre></div>
<h2>Sponsoring</h2>
<p>After the request from the community we have enabled sponsoring for the project. See <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="792017714" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/2340" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/2340/hovercard" href="https://github.com/mapstruct/mapstruct/issues/2340">#2340</a> for how you can sponsor us if you want to.</p>
<h2>Contributors</h2>
<ul>
<li><a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/anton-erofeev/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/anton-erofeev">@anton-erofeev</a></li>
<li><a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/Blackbaud-JasonBodnar/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/Blackbaud-JasonBodnar">@Blackbaud-JasonBodnar</a></li>
<li><a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/Bragolgirith/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/Bragolgirith">@Bragolgirith</a></li>
<li><a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/chenzijia12300/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/chenzijia12300">@chenzijia12300</a></li>
<li><a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/eroznik/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/eroznik">@eroznik</a></li>
<li><a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/EvaristeGalois11/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/EvaristeGalois11">@EvaristeGalois11</a></li>
<li><a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/ivlcic/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/ivlcic">@ivlcic</a></li>
<li><a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/jccampanero/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/jccampanero">@jccampanero</a></li>
<li><a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/kooixh/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/kooixh">@kooixh</a></li>
<li><a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/MengxingYuan/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/MengxingYuan">@MengxingYuan</a></li>
<li><a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/MLNW/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/MLNW">@MLNW</a></li>
<li><a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/Nikolas-Charalambidis/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/Nikolas-Charalambidis">@Nikolas-Charalambidis</a></li>
<li><a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/paparadva/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/paparadva">@paparadva</a></li>
<li><a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/prasanth08/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/prasanth08">@prasanth08</a></li>
<li><a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/ro0sterjam/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/ro0sterjam">@ro0sterjam</a></li>
<li><a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/rgdoliveira/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/rgdoliveira">@rgdoliveira</a></li>
<li><a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/venkatesh2090/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/venkatesh2090">@venkatesh2090</a></li>
</ul>filiphrtag:github.com,2008:Repository/4470435/1.5.5.Final2023-04-23T20:18:33Z1.5.5.Final<h3>Enhancements</h3>
<ul>
<li>Add support for Jakarta XML Binding (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1111642947" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/2730" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/2730/hovercard" href="https://github.com/mapstruct/mapstruct/issues/2730">#2730</a>)</li>
</ul>
<h3>Bugs</h3>
<ul>
<li><code>BeanMappingOptions#ignoreUnmappedSourceProperties</code> are not inherited via <code>@InheritConfiguration</code> (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1679606843" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3248" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3248/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3248">#3248</a>) - Regression from 1.5.3</li>
</ul>
<h3>Documentation</h3>
<ul>
<li>jakarta-cdi component model not in docs (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1668235503" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3236" data-hovercard-type="issue" data-hovercard-url="/mapstruct/mapstruct/issues/3236/hovercard" href="https://github.com/mapstruct/mapstruct/issues/3236">#3236</a>)</li>
<li>Polish links in docs (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1640900202" data-permission-text="Title is private" data-url="https://github.com/mapstruct/mapstruct/issues/3214" data-hovercard-type="pull_request" data-hovercard-url="/mapstruct/mapstruct/pull/3214/hovercard" href="https://github.com/mapstruct/mapstruct/pull/3214">#3214</a>)</li>
</ul>filiphr