Verifies that deprecated tag is followed by "As of " or "since ", and '@Deprecated' annotation follows.
(final List<String> lines, final String relativePath)
| 443 | * Verifies that deprecated tag is followed by "As of " or "since ", and '@Deprecated' annotation follows. |
| 444 | */ |
| 445 | private void deprecated(final List<String> lines, final String relativePath) { |
| 446 | int i = 0; |
| 447 | for (String line : lines) { |
| 448 | line = line.trim().toLowerCase(Locale.ROOT); |
| 449 | if (line.startsWith("* @deprecated")) { |
| 450 | if (!line.startsWith("* @deprecated as of ") && !line.startsWith("* @deprecated since ")) { |
| 451 | addFailure(relativePath, i + 1, |
| 452 | "@deprecated must be immediately followed by \"As of \" or \"since \""); |
| 453 | } |
| 454 | if (!getAnnotations(lines, i).contains("@Deprecated")) { |
| 455 | addFailure(relativePath, i + 1, "No \"@Deprecated\" annotation"); |
| 456 | } |
| 457 | } |
| 458 | i++; |
| 459 | } |
| 460 | } |
| 461 | |
| 462 | /** |
| 463 | * Returns all annotation lines that comes after the given 'javadoc' line. |
no test coverage detected