can I use synchronized to a final field?
===

Consider following code, I want to make it a thread safe class, so that it will never get odd number:

    class Test {
      private int value = 0;
      private final Object lock;

      public void add() {
        synchronized (lock) {
          value++;
          value++;
        }
      }

      public int getValue() {
        synchronized (lock) {
          return value;
        }
      } 
    }

I am now doubt of the lock field, which is declared to be final, will this matter? or it will break the thread safety? 

I think if the lock field is not declared to be final, this should be a thread-safe class. If this conclusion is wrong, please correct me, thank you.