Bugs item #2872063, was opened at 2009-10-02 16:37
Message generated for change (Tracker Item Submitted) made by nradov
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=479921&aid=2872063&group_id=56262Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Nick Radov (nradov)
Assigned to: Nobody/Anonymous (nobody)
Summary: False+: NonThreadSafeSingleton with static volatile field
Initial Comment:
This code generates the NonThreadSafeSingleton warning. I think it is essentially the same as bug 2826119, except here it applies to a static method. Use of the volatile modifier makes this code thread safe in Java 5.0 and above.
class NonThreadSafeSingleton {
private static volatile Object bar = null;
static Object foo() {
if (bar == null) {
synchronized (NonThreadSafeSingleton.class) {
if (bar == null) {
bar = new Object();
}
}
}
return bar;
}
}
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=479921&aid=2872063&group_id=56262------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf_______________________________________________
Pmd-devel mailing list
Pmd-devel@...
https://lists.sourceforge.net/lists/listinfo/pmd-devel