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

Constants generated with @FieldNameConstants are in lower camel case #2092

Closed
oleksandr-bilous opened this issue Apr 8, 2019 · 2 comments
Closed

Comments

@oleksandr-bilous
Copy link

oleksandr-bilous commented Apr 8, 2019

Short description
@FieldNameConstants generates an inner type with string constants in a lower camel case. Doesn't depend on asEnum() is true or false.

We understand that @FieldNameConstants is an experimental feature, but we are also widely using it within a lot of our projects. It is sad that in the last Lombok versions it was refactored in a way to use a lower camel case as an only possible solution to name the constants.

I have seen other issues that are connected with this one. (Or issues that are dedicated to the same question). And I understand why you want to keep the current solution as a default one. But it is definitely not clear why you are against to make an option to let developers choose the code style they want.

Expected behavior
A lot of developers are using following code styles as primary ones. And it's amiss, that new lombok updates break them.

According to Google's java style guide :

Constant names use CONSTANT_CASE: all uppercase letters, with each word separated from the next by a single underscore.

Oracle's java language specification says:

Constant names normally have no lowercase letters ...

May we expect that you will add an option to let us choose between naming styles? Maybe as an additional parameter in the annotation. It would be great to make developers choose the way they want to follow.

Target audience
Possibly every developer that has been using lombok's @FieldNameConstants feature alongside uppercase constants code style.

@rzwitserloot
Copy link
Collaborator

rzwitserloot commented Apr 30, 2019

Isn't this kind of a ridiculous concern? Slavish adherence to a style guide seems like a bad idea to me.

However, if a significant chunk of lombok users share this to me ununderstandable concern, and it's easy for us to add, eh, well. We aim to please, I guess :)

working on it. It'll be a config key option only and not the default. Because if we make it the default, then someone is gonna name a variable, say, DVDPlayer and then complains that we turned that into constant D_V_D_PLAYER.

@crimsonvspurple
Copy link

crimsonvspurple commented Jun 4, 2024

Can we get something like this? #3477

Alternatively, something like

@FieldNameConstant(value = "dvd_player")
String DVDPlayer;

so at least we can specify the name to use for a few odd fields...

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

No branches or pull requests

3 participants