Methods and systems for protecting object identity in an object-oriented
programming language. An object from a class for protecting object
identity is instantiated in memory. The object includes a first method
that determines whether two object values are equal, and a second method
that overrides an identity method associated with a superclass of the
object by invoking the first method, the identity method for determining
the identity of two objects. The object is immediately locked in response
to the instantiating, so that the identity of the locked object is
protected from threads that attempt to synchronize on the locked object.