Java: avoid exceptions on bad javadoc html (IJ-CR-142291)

GitOrigin-RevId: 40fe350fab9354863141929cd135a5f2d0393fc2
This commit is contained in:
Bas Leijdekkers
2024-08-15 15:56:37 +00:00
committed by intellij-monorepo-bot
parent df3532e177
commit 31cd07cef6
3 changed files with 36 additions and 4 deletions
@@ -153,13 +153,15 @@ final class MarkdownDocumentationCommentsMigrationInspection extends BaseInspect
continue;
}
else if (c == '>') {
String name = html.substring(tag + (endTag ? 2 : 1), (html.charAt(i-1) == '/') ? i - 1 : i).trim().toLowerCase(Locale.ENGLISH);
int start = tag + (endTag ? 2 : 1);
int end = (!endTag && html.charAt(i - 1) == '/') ? i - 1 : i;
String name = html.substring(start, end).trim().toLowerCase(Locale.ENGLISH);
if ("li".equals(name)) {
if (endTag) {
inList = false;
}
else {
if (" ".equals(result.substring(result.length() - 4))) {
if (result.length() > 4 && " ".equals(result.substring(result.length() - 4))) {
result.delete(result.length() - 4, result.length());
}
result.append(" - ");
@@ -347,4 +347,17 @@ interface Nothing {}
/// If **at least** one element has priority, elements would be prioritized. No priority will be used otherwise
///
/// @author Ilya.Kazakevich
final class LookupWithIndentsBuilder {}
final class LookupWithIndentsBuilder {
/// #
/// Returns a hash code value for the object. This method is
/// supported for the benefit of hash tables such as those provided by
/// [java.util.HashMap].</>
public int hashCode() {
return 1;
}
/// - one
/// - two
void x() {}
}
@@ -363,4 +363,21 @@ interface Nothing {}
*
* @author Ilya.Kazakevich
*/
final class LookupWithIndentsBuilder {}
final class LookupWithIndentsBuilder {
<warning descr="Javadoc comment can be Markdown documentation comment">/**</warning>
* <h1>
* Returns a hash code value for the object. This method is
* supported for the benefit of hash tables such as those provided by
* {@link java.util.HashMap}.</>
*/
public int hashCode() {
return 1;
}
<warning descr="Javadoc comment can be Markdown documentation comment">/**</warning>
* <li>one</li>
* <li>two</li>
*/
void x() {}
}