mfuerstenau / gradle-buildconfig-plugin

A BuildConfig plugin for Gradle java projects
MIT License
173 stars 20 forks source link

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

Open sdavids opened 7 years ago

sdavids commented 7 years ago

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)