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

Option to generate public static Getters and private static final fields instead of public static final fields #15

Open
sdavids opened this issue Mar 25, 2017 · 0 comments

Comments

@sdavids
Copy link

sdavids commented Mar 25, 2017

Java Puzzlers (http://www.javapuzzlers.com/contents.html) - "Puzzle 93: Class Warfare":

"References to constant fields are resolved at compile time to the constant values they denote [...] API designers should think long and hard before exporting a constant field [...] If, however, you want clients to adapt to changes in the field, make sure it isn't a constant."

https://docs.oracle.com/javase/specs/jls/se8/html/jls-4.html#jls-4.12.4
https://docs.oracle.com/javase/specs/jls/se8/html/jls-13.html#jls-13.4.9

@@

The field name to getter name could be converted via Guava's CaseFormat:

"get " + UPPER_UNDERSCORE.to(UPPER_CAMEL, constantName)

jfcameron added a commit to jfcameron/gradle-buildconfig-plugin that referenced this issue Jul 6, 2018
Option to generate public static Getters and private static final fields instead of public static final fields mfuerstenau#15
jfcameron added a commit to jfcameron/gradle-buildconfig-plugin that referenced this issue Jul 7, 2018
Option to generate public static Getters and private static final fields instead of public static final fields mfuerstenau#15
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

1 participant