Fix Trac #1061: refactor handling of default methods