void () { final Object lock = new Object(); final SynchronizationOnLocalVariableOrMethodParameter x = new SynchronizationOnLocalVariableOrMethodParameter(); IntegerMath addition = (a, b) -> { synchronized(lock) {return a + b;} // no warning }; System.out.println("40 + 2 = " + x.operateBinary(40, 2, addition)); }