Problem Description
When I was compiling the project locally today, I found a very strange problem. It kept prompting that the symbol could not be found at a certain location.
But it actually displayed normally in Idea. At first I thought it was IDEA's fault again, so I restarted IDEA, executed mvn clean and then recompiled. But the problem has not been solved
Cause Analysis:
No one has changed this code recently, so I was very confused, so I clicked into the corresponding class and found that someone submitted a new field yesterday, and it was very similar to an original field. There was only one problem with the capitalization of letters. Could it be added? Problem with adding fields?
Because this class uses the @Data annotation, based on past experience, I felt that there might be a problem with lombok when processing similar fields, and it did not create a get set method for the second field, so I built a class myself and The classes generated by its compilation are decompiled.
Sure enough, only the first field has a get set method created, and the second field is completely ignored
Then the cause of the problem has been located. It is actually a bug in lombok. When I was about to report the bug on github, I found that someone had actually mentioned it a long time ago, as shown below:
At that time, the developer believed that this was not a bug, but that there should not be such two fields with different case in a class at all, and then closed the issue.
The author says this and it’s actually not a big problem. There are many standards in programming itself, and the framework is based on the standards. If you don’t strictly abide by the standards, it is normal for bugs not to be repaired.
solution:
Handwritten get set method can cure all problems, just use Idea to help us generate it
Remove the @Data annotation and compile it again, and find that the compilation returns to normal