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
javac compiler's string concatenation optimization and it seems it does a bit "too much" for my taste.
Update: 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.
Recent comments
8 hours 29 min ago
8 hours 48 min ago
2 days 13 hours ago
6 days 20 hours ago
1 week 53 min ago
1 week 1 day ago
1 week 1 day ago
1 week 1 day ago
1 week 3 days ago
1 week 5 days ago