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
Adding final to the parameter from addFinalIfNeed in HandlerSetter? #3647
Comments
Basically, it's just a formatting/style question (which, BTW., you can customize with the setting |
@janrieke Thans, about your comment. but my question is "Adding final to the parameter from addFinalIfNeed in HandlerSetter?". i'm just wondering what that code does. And you said "There's no difference when it comes to the semantics of the generated code.". so what made you add the final keyword by default? If there really isn't a difference in semantics, shouldn't we add the option "finalParams" to "annotation" rather than "delombok"? (e.g. |
I really don't understand your question. If it makes no semantic difference, why should that be a parameter for the annotation? Unless you delombok, you will never read that generated code, because it's generated "under the hood" of javac. And if you delombok: Some developers like automatically making parameters final, some don't, and some simply do not care. That's mainly a choice of style. For instance, Eclipse has a similar auto-formatting setting. So delombok has it configurable and there is a default (which, to repeat, does not make any semantic difference for the code lombok generates). |
First, I wanted to know why final is added to parameter after build when I used "@Setter".
Before Build
After Build
The class file (Waste.class) that was created after the build was opened by IntelliJ.
I also executed "javap -p -c -v".
searching the code to add final keyword
I found a suspicious code.
lombok/src/core/lombok/javac/handlers/HandleSetter.java
Line 240 in 9dc7e7f
Question
Adding final to the parameter from addFinalIfNeed in HandlerSetter?
The text was updated successfully, but these errors were encountered: