The error can probably be worked around by adding an explicit type ascription after the anonymous class definition; or by making all non-overriding members of the type private (enough).