false positive on getClass synchronization warning?

View: New views
1 Messages — Rating Filter:   Alert me  

false positive on getClass synchronization warning?

by John Penix :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I'm looking at what I think is a false positive for this warning type:

http://findbugs.sourceforge.net/bugDescriptions.html#WL_USING_GETCLASS_RATHER_THAN_CLASS_LITERAL


The code synchronizes on getClass(), but doesn't access static data -
just a non-static field.  I'm not going to argue this code is right,
but it isn't a potential race on static data that I think this check
is looking for.  I think the check can look for an access to a static
field inside the synchronized.

Meanwhile, I think there is another bug pattern to be identified here,
perhaps: WTF_SYNCHRONIZING_FOR_NO_APPARENT_REASON

John
_______________________________________________
Findbugs-discuss mailing list
Findbugs-discuss@...
https://mailman.cs.umd.edu/mailman/listinfo/findbugs-discuss
LightInTheBox - Buy quality products at wholesale price