ASTNode (ASTNode first, ASTNode last, ASTNode anchor, Boolean before) { if (first.getElementType() == GroovyStubElementTypes.ANNOTATION_MEMBER_VALUE_PAIR && last.getElementType() == GroovyStubElementTypes.ANNOTATION_MEMBER_VALUE_PAIR) { ASTNode lparenth = getNode().getFirstChildNode(); ASTNode rparenth = getNode().getLastChildNode(); if (lparenth == null) { getNode().addLeaf(GroovyTokenTypes.mLPAREN, "(", null); } if (rparenth == null) { getNode().addLeaf(GroovyTokenTypes.mRPAREN, ")", null); } final PsiNameValuePair[] nodes = getAttributes(); if (nodes.length == 1) { final PsiNameValuePair pair = nodes[0]; if (pair.getName() == null) { final String text = pair.getValue().getText(); try { final PsiAnnotation annotation = GroovyPsiElementFactory.getInstance(getProject()).createAnnotationFromText("@AAA(value = " + text + ")"); getNode().replaceChild(pair.getNode(), annotation.getParameterList().getAttributes()[0].getNode()); } catch (IncorrectOperationException e) { LOG.error(e); } } } if (anchor == null && before != null) { anchor = before.booleanValue() ? getNode().getLastChildNode() : getNode().getFirstChildNode(); } if (nodes.length > 0) { var comma = Factory.createSingleLeafElement(GroovyElementTypes.T_COMMA, ",", 0, 1, SharedImplUtil.findCharTableByTree(first), getManager()); super.addInternal(comma, comma, anchor, before); } } return super.addInternal(first, last, anchor, before); }