SpaceRequirements (ASTNode left, ASTNode right) { if (right.getElementType() == JavaDocTokenType.DOC_TAG_VALUE_SHARP_TOKEN || left.getElementType() == JavaDocTokenType.DOC_TAG_VALUE_SHARP_TOKEN) { return SpaceRequirements.MUST_NOT; } PsiFile containingFile = left.getTreeParent().getPsi().getContainingFile(); LanguageLevel level = containingFile instanceof PsiJavaFile ? ((PsiJavaFile)containingFile).getLanguageLevel() : LanguageLevel.HIGHEST; Lexer lexer = createLexer(level); SpaceRequirements spaceRequirements = LanguageUtil.canStickTokensTogetherByLexer(left, right, lexer); if (left.getElementType() == JavaTokenType.END_OF_LINE_COMMENT) { return SpaceRequirements.MUST_LINE_BREAK; } if (left.getElementType() == JavaDocTokenType.DOC_COMMENT_DATA) { String text = left.getText(); if (!text.isEmpty() && Character.isWhitespace(text.charAt(text.length() - 1))) { return SpaceRequirements.MAY; } } if (right.getElementType() == JavaDocTokenType.DOC_COMMENT_DATA) { String text = right.getText(); if (!text.isEmpty() && Character.isWhitespace(text.charAt(0))) { return SpaceRequirements.MAY; } } else if (right.getElementType() == JavaDocTokenType.DOC_INLINE_TAG_END) { return SpaceRequirements.MAY; } return spaceRequirements; }