PsiMethod (final Project project, final String signature) { if (StringUtil.isEmpty(signature)) return null; try { return JavaPsiFacade.getInstance(project).getElementFactory(). createMethodFromText("void " + fixSignature(signature, true) + "{}", null); } catch (IncorrectOperationException e) { // something wrong } return null; }