Non-Deterministic / Unpredictable Behavior (Again)
Randall R Schulz <[email protected]> Thu, 10 Apr 2008 18:25:13 -0700
| Newsgroups | gmane.comp.windows.devel.java.advanced |
|---|---|
| Message-ID | <[email protected]> |
Hi, Well, I've done the fine-tooth-comb routine and still have the problem of unrepeatable results. Here's some more information: - I use the "immutable after initialization" (IAI) pattern extensively. - In going over my code, I noticed many places in equals() or hashCode() implementations that were careful not to dereference null fields. In the light of IAI, it seems this is just a bad idea (one wants to know if equals() or hashCode() are being called before an instance is fully initialized), so I removed those checks. Now if equals() or hashCode() are invoked on incompletely constituted instances, they'll throw NPEs. - All the classes in question are descendants of one of two abstract classes. I added implementations of equals() and hashCode() in these abstract classes, each (pair) of which throws a "subclass responsibility" exception when invoked. After all this, the unrepeatability of results remains. I am completely baffled by this. Are there _any_ ways a properly written, single-threaded program can yield this kind of behavior? Randall Schulz =================================== This list is hosted by DevelopMentorĀ® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com