API Uses new Object()

I couldn’t do a whole lot to figure out if String and Object are being used for synchronized blocks in the Java API, as stated before that would be too much work that is too tangential to my project.

What I could figure out quite easily, though, is if the Java API makes use of new Object(). I just scanned for a call to Object.<init>() except for at the beginning of a constructors (if a constructor makes that call at the beginning, then it’s a super() call). Since you can’t do a lot with an object created with new Object() except for synchronization (it provides the methods clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, and wait), I can assume that these instances are being used in synchronized blocks.

Quite a few locations popped up. Another reason why I cannot safely ignore Object.

Share

About Mathias

Software development engineer. Principal developer of DrJava. Recent Ph.D. graduate from the Department of Computer Science at Rice University.
This entry was posted in Concurrent Unit Testing. Bookmark the permalink.

Leave a Reply