String (@NotNull PsiComment comment) { final IElementType type = comment.getTokenType(); final String text = comment.getText(); int start = 0, end = text.length(); if (comment instanceof PsiDocComment) { if (text.startsWith("/**")) start += "/**".length(); if (text.endsWith("*/")) end -= "*/".length(); } else if (type == JavaTokenType.C_STYLE_COMMENT) { if (text.startsWith("/*")) start += "/*".length(); if (text.endsWith("*/")) end -= "*/".length(); } else if (type == JavaTokenType.END_OF_LINE_COMMENT) { if (text.startsWith("//")) start += "//".length(); } while (start < end && Character.isWhitespace(text.charAt(start))) { start++; } while (start < end - 1 && Character.isWhitespace(text.charAt(end - 1))) { end--; } String extractedText = start < end ? text.substring(start, end) : ""; if (extractedText.trim().startsWith(SuppressionUtilCore.SUPPRESS_INSPECTIONS_TAG_NAME)) { return ""; } return extractedText; }