Hi Steve,

On 06/15/2016 05:56 PM, Steve Drach wrote:
>Fields or methods is another discussion point for the base and runtime 
versions.
My thinking is, in this case fields and methods are equivalent, the method not 
giving any more flexibility than a field.  For example the method 
JarFile.baseVersion will just return the value contained in the private final 
static field BASE_VERSION.  Or the public final static field BASE_VERSION can 
be directly accessed.  I see no advantage of a method here.  But I’m willing to 
be enlightened.


If you make the static final field part of public API, then you constrain yourself to initializing it in class initializer. If you keep it private and expose it via a static method now, then you keep the freedom to initialize it lazily if it ever happens to be needed in the future because of various reasons such as initialization circularity. But I don't know if this applies in your case. Would you ever need to use part of JarFile class early in bootup sequence before those fields can be initialized?

Regards, Peter

Reply via email to