PsiMethod (@NotNull PsiField field, @NotNull String methodName, boolean isGetter) { PsiMethod prototype = isGetter ? GroovyPropertyUtils.generateGetterPrototype(field) : GroovyPropertyUtils.generateSetterPrototype(field); try { prototype.setName(methodName); return prototype; } catch (IncorrectOperationException e) { return null; } }