[FB-Discuss] Question about custom detector

Michiel Graat M.Graat at student.science.ru.nl
Tue Dec 6 12:18:46 EST 2005

Hi Dave,

> One potential source of false positives is when accesses occur in a
> private method that is always called with a lock held.  We handle this
> situation by building a method call graph (for calls to private
> methods only).  If a private method containing an unlocked field access
> is only called from call sites where a lock is held, then the access is
> considered to be properly synchronized.  (Look for the use of the
> SelfCalls class, which constructs this call graph.)

I have been looking into the SelfCalls class and I'm not entirely sure as
to what it does. I understand the code until isSelfCall is called (this
happens when an invoke instruction was found).

isSelfCall loops through all the methods in the current class and checks
if they're the same (that is: have the same name, signature and
same type) as the method which is called in the invoke instruction. So,
what is SelfCalls looking for: method calls in a class to other methods
within the class? Is this correct or am I missing something?

As for my problem: is writing custom code (based upon SelfCalls and
FindInconsistentSync2) which looks for calls to a certain method (saving
that information in a call graph) the way to go?

Maybe I'm making things more difficult than they are but, once again, I'm
new to FindBugs' code so sometimes simple things elude me ;)



More information about the Findbugs-discuss mailing list