Menu

#3 equals, hashCode, & toString not thread-safe

open
nobody
None
5
2004-07-09
2004-07-09
Dan Smith
No

The current equals, hashCode, and toString methods rely
on the assumption that only one thread will be allowed
to call them at a time. If, say, the debugger is
stopped in the middle of an o.toString() call and then
a user makes another call to o.toString() from the
DrJava interactions pane, the result, along with o's
resulting internal state, may be incorrect. This might
be solved by maintaining a table of each thread that is
currently calling, for example, o.toString().

Discussion