In Lock.scala, we have a method that can easily deadlock in the following scenario given lock a and lock b:
This method cannot / should not be fixed. As a preemptive measure we should remove the logic and make it very obvious when attempts to use it are made. Then, we should rewrite the attempts to carefully unlock the values as needed, taking care to keep a consistent order of access.
Once we are sure the method is no longer used, we can simply remove it at revert back to Java's default compare behavior of comparing identity.