Issue 7902 - Synchronized should only be allowed for class declarations

https://d.puremagic.com/issues/show_bug.cgi?id=7902