void (@NotNull final String methodName, final PsiType toType) { final RulesProvider provider = new RulesProvider() { @Override public PsiType migrationType(PsiElement context) { return toType; } @Override public PsiElement victim(PsiClass aClass) { final PsiAnonymousClass anonymousClass = PsiTreeUtil.findChildOfType(aClass, PsiAnonymousClass.class); assertNotNull(anonymousClass); return anonymousClass.findMethodsByName(methodName, false)[0]; } }; start(provider); }