PsiMethod (@NotNull PsiClass scope) { final String name = scope.getName(); LOG.assertTrue(name != null, scope.getText()); GroovyPsiElementFactory factory = GroovyPsiElementFactory.getInstance(myContext.getProject()); final GrMethod constructor = factory.createConstructorFromText(name, ArrayUtilRt.EMPTY_STRING_ARRAY, ArrayUtilRt.EMPTY_STRING_ARRAY, "{}", scope); if (scope instanceof GroovyScriptClass) constructor.getModifierList().setModifierProperty(GrModifier.DEF, true); return (PsiMethod)scope.add(constructor); }