I'm sure thousands have stumbled on this before me, but still, it's weird and I cannot explain why it works as it works.
At first glance it appeared that if you define a variable in a public class as
public static final
(ie. a constant) and the variable has a primitive type, then other classes referencing this variable will somehow "cache" the variable value in their own .class file. Looking deeper into the problem I've discovered that the situation is not as bad as I feared: I just crossed
compiler's string concatenation optimization and it seems it does a bit "too much" for my taste.
Jeff provided a to sections of the Java Language Specification that explain why and how this is working. The relevant term is: compile-time constants.