void (@NotNull GrClosableBlock closure) { ASTNode rBraceAtTheEnd = GeeseUtil.getClosureRBraceAtTheEnd(myChild1); boolean spacesWithinBraces = closure.getParent() instanceof GrStringInjection ? myGroovySettings.SPACE_WITHIN_GSTRING_INJECTION_BRACES : mySettings.SPACE_WITHIN_BRACES; boolean simpleClosure = shouldHandleAsSimpleClosure(closure, mySettings) || myForbidNewLineInSpacing; int spaces = simpleClosure && spacesWithinBraces ? 1 : 0; if (myGroovySettings.USE_FLYING_GEESE_BRACES && myType2 == GroovyTokenTypes.mRCURLY && rBraceAtTheEnd != null) { String text = rBraceAtTheEnd.getTreeParent().getText(); if (text.indexOf('\n') < 0) { /* the case: foo { bar {print x}<we are here>} */ myResult = Spacing.createSpacing(1, 1, simpleClosure ? 0 : 1, false, 1); } else { myResult = Spacing.createSpacing(0, 0, 0, true, 100, 0); } } else if (myType1 == GroovyTokenTypes.mLCURLY && myType2 == GroovyTokenTypes.mRCURLY) { //empty closure createSpaceInCode(false); } else if (myType1 == GroovyTokenTypes.mLCURLY && myType2 != GroovyEmptyStubElementTypes.PARAMETER_LIST && myType2 != GroovyTokenTypes.mCLOSABLE_BLOCK_OP || myType2 == GroovyTokenTypes.mRCURLY) { //spaces between statements myResult = Spacing.createSpacing(spaces, spaces, simpleClosure ? 0 : 1, mySettings.KEEP_LINE_BREAKS, keepBlankLines()); } else if (myType1 == GroovyTokenTypes.mCLOSABLE_BLOCK_OP) { myResult = GroovySpacingProcessorBasic.createDependentSpacingForClosure(mySettings, myGroovySettings, closure, true); } else if (myType1 == GroovyTokenTypes.mLCURLY) { createSpaceInCode(spacesWithinBraces); } }