A constant reference to an object is not a constant, it's just a constant reference to an object.
private static final
is not what defines something to be a constant or not. It's just the Java way to define a constant, but it doesn't mean that every private static final
declaration was put there to define a constant.
When I write private static final Logger
I'm not trying to define a constant, I'm just trying to define a reference to an object that is private
(that it is not accessible from other classes), static
(that it is a class level variable, no instance needed) and final
(that can only be assigned once). If it happens to coincide with the way Java expects you to declare a constant, well, bad luck, but it doesn't make it a constant. I don't care what the compiler, sonar, or any Java guru says. A constant value, like MILLISECONDS_IN_A_SECOND = 1000
is one thing, and a constant reference to an object is another.
Gold is known to shine, but not everything that shines is gold.