Assume I have a
private static Object lock = new Object();
and somewhere in the same class
public void run() {
synchronized(lock) {
//only 1 thread here, all others wait
}
}
I always read that the lock object should be final, but not exactly why. Assume I know for 100% that my code doesn't touch the lock object anywhere, if one omits the final keyword, does this mean that the synchronization is not 100% bulletproof?