@Override
  public void insert(@NotNull PsiClass aClass, @Nullable PsiElement anchor, boolean before) throws IncorrectOperationException {

    final T proto = getPsiMember();
    if (proto instanceof GrMethod) {
      GroovyChangeContextUtil.encodeContextInfo(((GrMethod)proto).getParameterList());
    }


    super.insert(aClass, anchor, before);

    final T member = getPsiMember();
    if (member == null) return;

    LOG.assertTrue(member instanceof GroovyPsiElement, member);
    final GroovyPsiElementFactory factory = GroovyPsiElementFactory.getInstance(member.getProject());

    final PsiElement prev = member.getPrevSibling();
    if (prev != null && GroovyTokenTypes.mNLS == prev.getNode().getElementType()) {
      prev.replace(factory.createLineTerminator(1));
    }
    else if (prev instanceof PsiMember) {
      member.getParent().getNode().addLeaf(GroovyTokenTypes.mNLS, "\n", member.getNode());
    }

    final PsiElement next = member.getNextSibling();
    if (next != null && GroovyTokenTypes.mNLS == next.getNode().getElementType()) {
      next.replace(factory.createLineTerminator(1));
    }
    else if (next instanceof PsiMember) {
      member.getParent().getNode().addLeaf(GroovyTokenTypes.mNLS, "\n", next.getNode());
    }

    if (member instanceof GrMethod) {
      GroovyChangeContextUtil.decodeContextInfo(((GrMethod)member).getParameterList(), null, null);
    }

    JavaCodeStyleManager.getInstance(member.getProject()).shortenClassReferences(member);

    adjustDocCommentIfExists(member);
  }
@Override
  public void insert(@NotNull PsiClass aClass, @Nullable PsiElement anchor, boolean before)