The "Lock acquired but not safely unlocked" inspection wants you to write code like this:
However, isn't it best practice to write code like this?
Because we follow the above convention in our own code IDEA will flag our code as violating the inspection - so, we usually end up disabling this inspection. Remember that Lock is an interface, and even though it is highly unlikely that the lock() method will fail (throw an exception), it is still possible since you could be calling into any implementation. If one followed what the intention wants, then there is the very small chance that you will attempt to call unlock() on a Lock that was never locked to begin with, since its lock() method failed to lock... if that makes sense. :)
Should I open a request in the tracker for this to be changed?