Wrap (ASTNode childNode) { if (myContext.isForbidWrapping()) return createNoneWrap(); final IElementType childType = childNode.getElementType(); if (SKIP.contains(childType)) { return createNoneWrap(); } if (myParentType == ARGUMENT_LIST) { if (childType == T_LBRACK || childType == T_RBRACK) { return createNoneWrap(); } } if (myParentType == APPLICATION_ARGUMENT_LIST) { if (myNode.getFirstChildNode() == childNode) { return createNoneWrap(); } } if (myParentType == GroovyStubElementTypes.EXTENDS_CLAUSE || myParentType == GroovyStubElementTypes.IMPLEMENTS_CLAUSE) { if (childType == GroovyTokenTypes.kEXTENDS || childType == GroovyTokenTypes.kIMPLEMENTS) { return Wrap.createWrap(mySettings.EXTENDS_KEYWORD_WRAP, true); } } if (myParentType == GroovyElementTypes.ARGUMENTS || myParentType == TRY_RESOURCE_LIST) { if (childType == GroovyTokenTypes.mLPAREN || childType == GroovyTokenTypes.mRPAREN) { return createNoneWrap(); } } if (myParentType == ARRAY_INITIALIZER) { if (childType == T_LBRACE || childType == T_RBRACE) { return createNoneWrap(); } } if (myParentType == GroovyStubElementTypes.THROWS_CLAUSE && childType == GroovyTokenTypes.kTHROWS) { return Wrap.createWrap(mySettings.THROWS_KEYWORD_WRAP, true); } if (myParentType == GroovyStubElementTypes.MODIFIER_LIST) { if (getLeftSiblingType(childNode) == GroovyStubElementTypes.ANNOTATION) { return getCommonWrap(); } else { return null; } } if (myParentType == PARAMETER_LIST) { if (childType == T_LPAREN || childType == T_RPAREN) { return createNoneWrap(); } } if (myParentType == CLOSURE) { final ASTNode leftSibling = getLeftSibling(childNode); if (leftSibling != null && leftSibling.getElementType() == T_LBRACE || childType == T_RBRACE) { boolean simpleClosure = mySettings.KEEP_SIMPLE_LAMBDAS_IN_ONE_LINE && !myNode.textContains('\n'); return simpleClosure ? createNoneWrap() : getCommonWrap(); } } if (ANNOTATION_CONTAINERS.contains(myParentType)) { final ASTNode leftSibling = getLeftSibling(childNode); if (leftSibling != null && leftSibling.getElementType() == GroovyStubElementTypes.MODIFIER_LIST && endsWithAnnotation(leftSibling)) { final int wrapType = getAnnotationsWrapType(childNode); if (wrapType != -1) { return Wrap.createWrap(wrapType, true); } } } return getCommonWrap(); }