Tuesday, 3 November 2015

Compile time constant and Risk

Compile time constant

public static final variables are known as compile time constant, public is optional there.
They are replaced with actual values at compile time because compiler know their value up-front and also knows that it cannot be changed during run-time.

Risk associate with Compile time constant

Problem with this is that if you are using public static finalvariable from some in-house or third party library and their value changed later than your client will still be using old value even after you deploy new version of JARs.

To avoid that, make sure you compile your program when you upgrade dependency JAR files.

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...