Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!npeer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail From: Lew Newsgroups: comp.lang.java.programmer Subject: Re: unchecked conversion warning. Date: Mon, 18 Jun 2012 12:28:30 -0700 (PDT) Organization: http://groups.google.com Lines: 25 Message-ID: <1bf8c686-8f7f-4ff1-94ff-5ea1a1b1fecd@googlegroups.com> References: <3s7cs7hd18l0ffci55ns0286n4lc4cutlu@4ax.com> <265ea956-a3ed-4e76-8fc9-9ce9728f6b37@googlegroups.com> NNTP-Posting-Host: 69.28.149.29 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: posting.google.com 1340047793 3645 127.0.0.1 (18 Jun 2012 19:29:53 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 18 Jun 2012 19:29:53 +0000 (UTC) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=69.28.149.29; posting-account=CP-lKQoAAAAGtB5diOuGlDQk0jIwmH0T User-Agent: G2/1.0 X-Received-Bytes: 2166 Xref: csiph.com comp.lang.java.programmer:15385 Robert Klemme wrote: > I totally agree. Btw, there is one interesting detail: JavaDoc of > Collections.synchronizedList() and the other synchronized*() methods > explicitly state that the mutex used for synchronizing is that of the > returned object: > > http://docs.oracle.com/javase/7/docs/api/java/util/Collections.html#synchronizedList%28java.util.List%29 I see no such promise there. And in fact it's not true. The source for the 'synchronizedCollection()' family of methods reveals that there's a separate field 'mutex' of type 'Object' on which the methods synchronize. > No such statement is done about Vector. So while the source code of > Vector tells us that the Vector instance is used to synchronize the > JavaDoc does not give any guarantee about that and - at least > theoretically - Sun/Oracle could change that and synchronize on another > instance. And that would rarely matter, unless a person were adding actions that tried to synchronize on the same monitor. -- Lew