reprogrammer / keshmesh

Keshmesh is a static analysis tool for finding and fixing concurrency bug patterns in Java.
http://keshmesh.cs.illinois.edu/
Other
16 stars 5 forks source link

Is the use of getClass in a final class an instance of LCK02J? #40

Open reprogrammer opened 13 years ago

reprogrammer commented 13 years ago

Since final classes cannot be subclassed, the use of the return value of getClass as a lock object inside a final class is safe. Anonymous classes are a special kind of final classes. So, the use of getClass inside an anonymous class is safe. If our detector reports too many false positives in these cases, we can have the detector check for these corner cases.