Don't allow duplicate methods.

Fixes #7062