Skip to content

Releases: mapstruct/mapstruct

1.5.3.Final

07 Oct 18:42
Compare
Choose a tag to compare

Enhancements

Bugs

  • Generic @AfterMapping does not consider @MappingTarget properly in 1.5 (#3036)
  • Method annotated with @AfterMapping is not called (#2955)
  • Ignored unknown source property error, but property exist (#2743)
  • SubclassMapping doesn't honour mappingControl (#3018)
  • Upgrade from 1.4.1 to 1.5.2 broke primitive to wrapper classes mapping (#2921)
  • Conversion of BigDecimal to primitive double wrong with 1.5.2 (#2913)
  • Ambiguous mapping methods when upgrading to MapStruct 1.5.0.RC1 (#2840)
  • SubclassMapping stackoverflow exception (#2825)
  • Optional wrapping pattern broken in 1.5.2.Final (#2925)
  • Missing import in generated mapper when referencing a nested enum from an unrelated class (#2945)
  • Unused import warning of nested classes (#2907)
  • Compilation error in generated code for @Conditional and collection (#2937)
  • Missing import of nested class (#2897)
  • Ignoring unmapped source properties in inverse inheritance (#2949)
  • Compilation error when mapping fields with the same type due to not wrapping in a try-catch block (#2839)
  • Using @TargetType as a parameter for @Condition causes NPE during compiling (#2882)
  • Cannot map from a covariant (extends) generic type (#2677)

Documentation

  • Add IntelliJ and Eclipse plugin to the documentation (#2928)
  • Fix typos in documentation (#2974, #2982, #2989)
  • Update Typos in javadoc (#2958)
  • Polish comments, javadoc and documentation (#3026)
  • Improve documentation for BeanMapping#ignoreByDefault (#2929)

Build

  • Build fails when running mvn test on an M1 Mac (#2922)

1.5.2.Final

18 Jun 17:14
Compare
Choose a tag to compare

Enhancements

  • Add support for Java Text Blocks in expressions (#2837)

Bugs

  • Generated code does not include enclosing class when referring to nested class (#2880)
  • SubclassExhaustiveStrategy.RUNTIME_EXCEPTION option does not work if the superclass has a non-empty constructor #2891

Build

  • Codecov no longer publishes information for commits (#2870)

1.5.1.Final

05 Jun 06:54
Compare
Choose a tag to compare

Bugs

  • NullPointerException when reporting errors for non Mappers (#2867)

1.5.0.Final

02 Jun 21:31
Compare
Choose a tag to compare

Bugs

  • Compilation error due to missing import with nested classes (#2797)
  • MapStruct 1.5.0 generates invalid code when using @Condition on a presence check for a generic wrapper (#2795)
  • No compile error when conditionExpression and expression are used together (#2794)
  • No import is added to generated class when using @BeforeMapping on a used mapper (#2807)

Documentation

  • Error in the readme ( what is MapStruct paragraph ) (#2851)
  • Enhance documentation around SPI usage (#2739)

Build

  • Update jacoco maven plugin to compile on Java 17 (#2835)

Previous Release Notes

1.5.0.RC1

21 Mar 07:24
Compare
Choose a tag to compare
1.5.0.RC1 Pre-release
Pre-release

Enhancement

  • Add compiler check for unimplemented methods for lifecycle @BeforeMapping / @AfterMapping methods (#2674)
  • Opt-out of using builders via a processor option (#1661)
  • @DecoratedWith does not work with incremental compilation in Gradle 7.3 (#2682)
  • Add support for Jakarta Dependency Injection API (#2567)
  • Allow @InheritInverseConfiguration with @SubclassMapping(s) (#2696)
  • MapStruct 1.4 regression: issue combining qualifiedByName, uses and method chaining (#2538) - In 1.4 we strengthened the check for qualified methods and reported an error if there was no applicable qualifier. This strengthening led to 2-step mappings not to work properly when only one of the steps is qualified. With this issue it is now possible to use 2-step mappings with only one of the steps being qualified.

Bugs

  • Fail to import nested enum when an enum constant is referenced (#2704)
  • Added support for collections and maps with a no-args constructor (#2668)
  • MapStruct does not always use builders in target-object (#1997)
  • Cannot map from a covariant (extends) generic type (#2677)
  • Detecting javax.annotation.processing.Generated in modular Java does not seem to work (#2629)
  • Using MappingTarget inside a Condition causes a FreeMarker template error (#2758)
  • Illegal start of type when using a static method of a generic type (#2755)
  • Mapping embedded map keys that contain characters that aren't valid for Java method names (#2748)

Documentation

  • @Condition docs out of sync (#2689)
  • Add documentation about the new NullValueMappingStrategy for collections and maps (#2687)
  • Add documentation about when mappers are injected (#2686)
  • Clarify documentation about builders and lifecycle @AfterMapping / @BeforeMapping methods (#2719)
  • Correct description for example demonstrating default expression (#2709)
  • Clarify documentation about Condition for update mappings (#2715)

Build

  • Update tools gem for tests to run properly on Java 18+ (#2725)
  • Support defining which test dependencies should be available during testing (#2728)
  • Run CDI integration tests on Java 16+ (#2468)

Contributors

We'd like to thank all the contributors who worked on this release!

1.5.0.Beta2

12 Dec 12:15
Compare
Choose a tag to compare
1.5.0.Beta2 Pre-release
Pre-release

Features

  • Support for Type-Refinement mapping (or Downcast Mapping) (#131, #366, #2438)
  • NullValueMappingStrategy option to map collections/maps, but not beans (#2351)

Enhancement

  • Diagnostics show up on non-Mapper types (#598)
  • Generate imports only for top level classes (#1386)
  • MapStruct should return the target object(which marking with @MappingTarget) when the source object is null (#1752) - See Behaviour Changes
  • Getting incorrect "iterable type to non-iterable type" error (#2005)
  • Expose suppressTimestampInGenerated in @Mapper annotation (#2225)
  • Provide available case transformation when unknown is used in CaseEnumTransformationStrategy (#2525)
  • Add built in conversion between URL and String (#2552)
  • Add unmappedSourcePolicy annotation processor argument (#2555)

Bugs

  • Import handling in TypeFactory should deal with inner types bug (#148)
  • Ambiguous constructors error message does not contain the ambiguous constructors (#2515)
  • MapStruct 1.5.0.Beta1 ZonedDateTime field mapping regression (#2530)
  • Issue with unmappedSourcePolicy and implicit source mapping (#2537)
  • TYPE_USE annotations on method parameters cause them not to match when using errorprone (#2541)
  • ReverseConversion should maintain RequiredHelperMethods (#2544)
  • New mapping feature not support property paths (#2553)
  • Mapping List in Record causes warning (#2554)
  • BeanMapping#ignoreByDefault interaction with unmappedSourcePolicy (#2560)
  • Allow use of mapstruct in default package with nested classes (#2593)
  • Record with "is" prefixed Boolean field causes unmapped source property report (#2596)
  • FQN used when mapping Stream to Array (#2614)
  • Cannot map nested target when mapping from Map to Bean (#2624)
  • Warning about unmapped not existing property (#2635)
  • @Condition not working when the source in the Mapping is the source parameter (#2666)
  • Optional "wrapping" pattern broken with 1.5.0.Beta (#2673)

Documentation

  • Document usage of qualifiers used together with defaultValue (#2636)

Build

  • Add JDK 18 to build matrix (#2591)
  • Move tycho-compiler-jdt as test dependency (#2611)

Codebase Enhancements

  • Refactor Accessors and remove not needed AccessorType(s) (#2680)

Behaviour Changes

Update mappings with a return type

Prior to this release update mappings with a return type returned null when the source parameter was null. However, this is not what a user expects (see #1752).

With this release methods like

Car updateCar(CarDto source, @MappingTarget Car car);

will always return the @MappingTarget method, irregardless of what the source is.

1.5.0.Beta1

18 Jul 13:39
Compare
Choose a tag to compare
1.5.0.Beta1 Pre-release
Pre-release

Features

  • Support for Mapping from Map<String, ???> to Bean (#1075)
  • Conditional mapping (#2051, #2084) - Support for custom source presence checker expressions for mappings and custom method mappings
  • Support mapping Iterable<?> object to an object instead of collection (#607)
  • Support for case changing enum transformation strategy #2445
  • Built-In conversion between String <-> StringBuilder (#597)
  • Built-In conversion between a UUID to a String (#2391)
  • Support throwing an exception as an Enum Mapping option (#2339)

Enhancement

  • Add constants for componentModel in MappingConstants.ComponentModel (#2255)
  • Reuse singleton INSTANCE (if it exists) in mapper references when using the default component model (#2277)
  • [Breaking Change] Retain iteration order for Sorted(Map|Set) values (#2303) - In order to keep the previous behaviour and use Hash(Map|Set) use an @ObjectFactory
  • unmappedTargetPolicy for @BeanMapping (#2132)
  • Optimization: Make java.time.format.DateTimeFormatter instances final members (#2329)
  • [Breaking Change] Report ignored source properties which are missing (#2481) - Previously unknown properties in BeanMapping#ignoreUnmappedSourceProperties were ignored, now there will be a compile error as it is most likely a mistake. To fix the error the unknown properties should be removed from BeanMapping#ignoreUnmappedSourceProperties

Bugs

  • Multiple source properties with defaultExpression lead to unnecessary null checks and unexpected code (#2023)
  • MappingTarget member cannot be set to null (#2274)
  • Import statement not being generated for custom type extending from an Iterable (#2352)
  • Compilation failure when mapper interface is a private nested interface (#2347)
  • When using @ValueMapping string-to-enum mapping results in no cases in switch (#2350)
  • Passing of mapping method argument to a property and using @InheritInverseConfiguration (#2356)
  • Incorrect mapper generated when upgrading from 1.2.0.Final to 1.4.2.Final (#2393)
  • Several source parameters do not support "." (#2402)
  • Source presence checks on collections with non direct mappings is ignored (#2423)
  • Mapstruct mappers diamond inheritance, method is already defined (#2437)
  • ObjectFactory with generic source not in generated code in after generics refactorings (#2463)\
  • Variable is already defined in method (#2478)
  • With wrong config like Enum[] to String, the mapping processor throws NPE (#2439)
  • JaxbElem not used when jaxb-api not on annotation processor path on Java 11 (#2491)
  • DeepClone generates cloning method for Enums #2505

Documentation

  • Make target the first parameter in all the uses of @Mapping (#2368)
  • Update documentation in regards to Java version (#2366)
  • Document markdown syntax issues (#2385)

Build

  • Adapt build for Java 16 (dfc7528)
  • Migrate tests to use JUnit 5 (5bbd1a7, 2d66f08, 627be53)
  • Integration Tests with Java 16 (#2466)
  • Add records cross module integration test (#2375)
  • Use JUnit Pioneer for setting Default Locale and Default Timezone (#2446)
  • Update asciidoctor to latest versions (#2483)
  • Make sure Javadoc can be generated with Java 11 (#2108) - Apiviz has been removed since it no longer works on Java 11

Codebase Enhancements

  • Refactorings around Eclipse Compiler Specifics (#861)
  • Simplify MethodMatcher (#2239)

Breaking changes

The introduction of the mapping from Map<String, ???> to Bean might have lead to some changes in how currently explicitly mapped maps are mapped. Some known changes are:

1.4.2.Final

31 Jan 13:49
Compare
Choose a tag to compare

Enhancement

  • Relax strictness for Mapping#qualifiedByName and Mapping#qualifier for collection mappings (#2324, #2346)
  • Mark mapstruct-processor jar as Spring-Boot-Jar-Type: annotation-processor (#2244)

Bugs

  • Nested target properties uses same method for different mappings after upgrade from 1.3.1.Final to 1.4.1.Final (#2236)
  • MapStruct 1.3.0.Final version is generating wrong code for optional collection getter fields (#2233)
  • Problems with Optional<T> mapping (#2295)
  • Nested source null check calls method twice instead of using intermediate variable (#2245)
  • Mapper create invalid implementation - variable is already defined in method (#2251)
  • Stack Trace instead of Message on Missing Mapping (#2263)
  • Wrong reporting for unmapped source properties when source source is implicitly mapped (#2253)
  • Getting either "Unknown property" or "Unmapped target property" (#2301)
  • @InheritInverseConfiguration and @Mapping(target:"bean.childProperty", ignore=true) do not play together (#2278)
  • Mappings are ignored when @InheritConfiguration defines a mapping for a sub-field (#2318)

Documentation

  • Vague documentation and code samples of @Default annotation as of 1.4.X (#2258)
  • Example uses wrong maven plugin configuration (#2307)
  • Typo in @MapperConfig annotation in documentation (#2293)

1.4.1.Final

11 Oct 08:03
Compare
Choose a tag to compare

Bugs

  • @InheritConfiguration is broken when using multiple source parameters of the same type (#2221)
  • @Mapping with defaultValue and method argument where is missing source does nothing (#2220)
  • NPE when running MapStruct from IntelliJ 2020.3 EAP (#2215) - 1.4.1.Final is the first MapStruct version that supports the new improved IntelliJ experience for annotation processor compiling. In order to avoid the NPE in older MapStruct releases you'll have to build your project with -Djps.track.ap.dependencies=false. More info about this is in IDEA-250718
  • @Mapping needs to define source parameter with defaultValue if you have two arguments in 1.4.0.Final (#2214)
  • Mapping with qualifying and only target defined should implicitly look for a matching property in one of the parameters (#2206)
  • Deep cloning creates intermediate methods for primitive arrays (#2213)

1.4.0.Final

26 Sep 09:49
Compare
Choose a tag to compare

For full upgrade instructions please read the release notes for the previous 1.4 releases:

Bugs

  • Possible regression: Wrong mapper code generation when using Builder (#2195)
  • Qualifier is ignored in case of name based mapping when there are multiple source parameters (#2125)
  • Invalid code generated for enum mapping when field name starts with underscore '_' and continues with digits (#2197)