PsiMethod (PsiMethod method, Language language) { if (method.getLanguage().equals(language)) { return method; } return JVMElementFactories.getFactory(language, method.getProject()).createMethodFromText(method.getText(), null); }