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

Duplicate properties in the meta-data with lombok #8886

Closed
zhanhb opened this issue Apr 12, 2017 · 7 comments
Closed

Duplicate properties in the meta-data with lombok #8886

zhanhb opened this issue Apr 12, 2017 · 7 comments
Labels
type: bug A general bug
Milestone

Comments

@zhanhb
Copy link
Contributor

zhanhb commented Apr 12, 2017

Get more than one statement in META-INF/spring-configuration-metadata.json when Annotate ConfigurationProperties class with lombok.Getter lombok.Setter

Here is a test project
/~https://github.com/zhanhb/configuration-processor-lombok-test

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Apr 12, 2017
@snicoll snicoll changed the title Get more than one statement with configuration-processor and lombok Duplicate properties with lombok and inner class Apr 12, 2017
@snicoll snicoll changed the title Duplicate properties with lombok and inner class Duplicate properties in the meta-data with lombok and inner class Apr 12, 2017
@snicoll snicoll added priority: normal type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged labels Apr 12, 2017
@AlexFalappa
Copy link
Contributor

AlexFalappa commented May 5, 2017

I created another testcase showcasing the issue at /~https://github.com/AlexFalappa/spring-boot-testcase2. The problem could not depend on the presence of an inner class.

@zhanhb, from my experiments a workaround is to make sure the lombok dependency in the pom.xml comes after the spring-boot-configuration-processor one.

@bluebilt
Copy link

bluebilt commented May 11, 2017

In our STS environment this problem causes a "Save Problem" popup every time an @ConfigurationProperties is modified and saved.

A save participant caused problems. The save participant 'Code Clean Up' caused an exception: java.lang.IndexOutOfBoundsException: Index: 83, Size: 83. See the error log for details.

@AlexFalappa The suggested workaround does not seem to work in our project

@AlexFalappa
Copy link
Contributor

@bluebilt then something more involved is going on in the spring-configuration-processor...

@philwebb philwebb added this to the 1.5.4 milestone May 11, 2017
@snicoll
Copy link
Member

snicoll commented May 12, 2017

Looks like Lombok is quite painful in this scenario, see this stackoverflow thread

What happens here is that lombok has already ran and has generated the thing that we are auto-detecting ourselves. So we first create a property because the getter/setter is there and then we check if lombok types are set somewhere (they are). And we generate the property again.

It would be so much easier if we could guarantee that lombok has to run first. That way, all the lombok specific code in our codebase could go away. Unfortunately, that does not seem to be possible.

@snicoll snicoll changed the title Duplicate properties in the meta-data with lombok and inner class Duplicate properties in the meta-data with lombok May 12, 2017
@snicoll
Copy link
Member

snicoll commented May 12, 2017

@bluebilt please report this issue in the STS tracker. Adding the logs and what you are doing should help.

@AlexFalappa
Copy link
Contributor

@snicoll you may want to have a look at this MapStruct issue where they faced and solved a similar issue.

At this comment one of the lombok developer seem to explain why the annotation processors dependency order in the pom.xml apparently avoids the problem.

After that MapStruct's @gunnarmorling references a SPI made in collaboration with lombok devels to solve the issue.

Hope it helps

@snicoll
Copy link
Member

snicoll commented May 12, 2017

@AlexFalappa thanks. I have a "fix", about to push.

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

No branches or pull requests

6 participants