void (@Nullable GrTypeDefinitionBody typeDefinitionBody) { final boolean isInterface = typeDefinitionBody != null && ((GrTypeDefinition)typeDefinitionBody.getParent()).isInterface(); if (myType2 == GroovyTokenTypes.mSEMI) return; if (typeDefinitionBody != null) { //check variable definitions only inside class body if ((myType1 == GroovyStubElementTypes.VARIABLE_DECLARATION || isSemiAfter(GroovyStubElementTypes.VARIABLE_DECLARATION)) && TokenSets.METHOD_DEFS.contains(myType2)) { final int minBlankLines = Math.max( isInterface ? mySettings.BLANK_LINES_AROUND_METHOD_IN_INTERFACE : mySettings.BLANK_LINES_AROUND_METHOD, isInterface ? mySettings.BLANK_LINES_AROUND_FIELD_IN_INTERFACE : mySettings.BLANK_LINES_AROUND_FIELD ); myResult = Spacing.createSpacing(0, 0, minBlankLines + 1, mySettings.KEEP_LINE_BREAKS, keepBlankLines()); return; } else if (myType1 == GroovyStubElementTypes.VARIABLE_DECLARATION || isSemiAfter(GroovyStubElementTypes.VARIABLE_DECLARATION) || myType2 == GroovyStubElementTypes.VARIABLE_DECLARATION) { final int minBlankLines = isInterface ? mySettings.BLANK_LINES_AROUND_FIELD_IN_INTERFACE : mySettings.BLANK_LINES_AROUND_FIELD; myResult = Spacing.createSpacing(0, 0, minBlankLines + 1, mySettings.KEEP_LINE_BREAKS, keepBlankLines()); return; } } if (TokenSets.METHOD_DEFS.contains(myType1) || isSemiAfter(TokenSets.METHOD_DEFS) || TokenSets.METHOD_DEFS.contains((myType2))) { if (myType1 == GroovyDocElementTypes.GROOVY_DOC_COMMENT) { if (isGroovyDocFormattingAllowed()) createLF(true); } else { final int minBlankLines = isInterface ? mySettings.BLANK_LINES_AROUND_METHOD_IN_INTERFACE : mySettings.BLANK_LINES_AROUND_METHOD; myResult = Spacing.createSpacing(0, 0, minBlankLines + 1, mySettings.KEEP_LINE_BREAKS, keepBlankLines()); } return; } if (TokenSets.TYPE_DEFINITIONS.contains(myType1) || isSemiAfter(TokenSets.TYPE_DEFINITIONS) || TokenSets.TYPE_DEFINITIONS.contains((myType2)) ) { if (myType1 == GroovyDocElementTypes.GROOVY_DOC_COMMENT) { if (isGroovyDocFormattingAllowed()) createLF(true); } else { final int minBlankLines = mySettings.BLANK_LINES_AROUND_CLASS; myResult = Spacing.createSpacing(0, 0, minBlankLines + 1, mySettings.KEEP_LINE_BREAKS, keepBlankLines()); } } }