Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fluent setters on fields with names starting with set are not working #1799

Closed
nathan-me-lawrence opened this issue Apr 26, 2019 · 7 comments · Fixed by #1917
Closed

Fluent setters on fields with names starting with set are not working #1799

nathan-me-lawrence opened this issue Apr 26, 2019 · 7 comments · Fixed by #1917
Labels
Milestone

Comments

@nathan-me-lawrence
Copy link

nathan-me-lawrence commented Apr 26, 2019

It seems in version MapStruct 1.3.0-Final theres an issue with builders and fields that begin with the word set such as settlement or setup.

Example (with lombok)

Source:

@Builder
public class Foo {
    private String setup;
    private LocalDate settlement;

}

Target:

@Builder
public class Bar {
    private String setup;
    private LocalDate settlement;

}

Neither of these fields are mapped. But I did get it to work by adding

@Mapping(source = "settlement", target = "tlement")
@Mapping(source = "setup", target = "up")
@filiphr filiphr added the bug label May 3, 2019
@filiphr filiphr added this to the 1.4.0 milestone May 3, 2019
@filiphr
Copy link
Member

filiphr commented May 3, 2019

Thanks for raising this issue @OhDearMoshe. This is certainly a bug and we would try to fix it asap.

In case you have some time and are wiling to play a bit with the MapStruct codebase you could help out with a contribution 😉. We would of course guide you

@ghost
Copy link

ghost commented May 8, 2019

Hi guys. Could you please review #1810.
Hopefully it fixes everything, however side effects are expected as for existing methods which are expected to be used as getters/setters, but not following Oracle's specification the code will be broken. For instance i noticed such cases in MapStruct tests: "getaName", "setaName" for a field named "aName".
Thanks in advance for review and comments.

@ghost
Copy link

ghost commented May 15, 2019

@filiphr Could you please comment on this item? No pushing, just want to close my internal gestalt :). Thanks

@ghost
Copy link

ghost commented May 31, 2019

any news, gentlemen?

@ghost
Copy link

ghost commented Jul 22, 2019

guys, could someone comment on this item please.

@filiphr
Copy link
Member

filiphr commented Aug 18, 2019

I reviewed the PR @msymonov, sorry for taking such a long time.

@choudharylakshyaveer
Copy link

Below config worked fine for me
<dependency> <groupId>org.mapstruct</groupId> <artifactId>mapstruct</artifactId> <version>1.5.2.Final</version> </dependency>

<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.5.1</version> <configuration> <source>1.8</source> <target>1.8</target> <annotationProcessorPaths> <path> <groupId>org.mapstruct</groupId> <artifactId>mapstruct-processor</artifactId> <version>1.4.2.Final</version> </path> <path> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <version>1.18.24</version> </path> <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok-mapstruct-binding</artifactId> <version>0.2.0</version> </dependency> <path> <groupId>org.mapstruct</groupId> <artifactId>mapstruct-processor</artifactId> <version>1.5.2.Final</version> </path> </annotationProcessorPaths> <compilerArgs> <compilerArg> -Amapstruct.defaultComponentModel=spring </compilerArg> </compilerArgs> </configuration> </plugin>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants