Fix Issue 7902 - Synchronized should only be allowed for class
declarations.