Hi folks,

I run FindBugs on Clojure source code, and there are few things it  
uncovered. I'd be happy to fix these and submit patches (after I  
submitted a contributor agreement), except if someone already a  
contributor wants to tackle these instead (they're easy to fix for the  
most part).

1. withMeta() in CachedSeq, LazilyPersistedVector, and LazyCons isn't  
synchronized, and it looks like a potential for race condition. I've  
looked into some usages of withMeta() to make sure I'm not crying wolf  
in vain (i.e. there's a guarantee of synchronization higher up the  
call chain), but it looks like there isn't, so I'm fairly certain this  
is a real problem.

2. Keyword and Ref define compareTo, but don't redefine equals (and  
hashCode) to be consistent with it. It ain't necessarily a problem if  
you know what you're doing, but since they're public it's usually a  
good rule of thumb to have equals consistent with compareTo (and then  
hashCode consistent with equals).

3. There are lots of usages of "new Integer(...)", "new Short(...)",  
"new Long(...)" etc. Now, in Java 5 and above, "Integer.valueOf(...)"  
and similar methods for all primitive wrapper types are the preferred  
idioms as the valueOf() methods return canonical instances for certain  
value range (usually -128..127) - these are used behind the scenes for  
Java autoboxing as well.

There are a lot of other FindBugs warnings as well, but I won't go  
into them as any contributor/committer can run FindBugs on their own  
and review them. These three however I think desire emphasis.

Attila.

--
twitter: http://twitter.com/szegedi
weblog: http://constc.blogspot.com
home: http://www.szegedi.org

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to