[java-inspections] Detect dashes in MismatchedJavadocCodeInspection

#IDEA-374566 Fixed

GitOrigin-RevId: 7e7466f2143e23a58d1d159a8759c50aaf0fa95b
This commit is contained in:
Louis Vignier
2025-06-23 09:40:39 +00:00
committed by intellij-monorepo-bot
parent 736e9f8958
commit aedc98ce14
2 changed files with 12 additions and 2 deletions
@@ -1,4 +1,4 @@
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.codeInspection.javaDoc;
import com.intellij.codeInsight.Nullability;
@@ -39,7 +39,7 @@ public final class MismatchedJavadocCodeInspection extends AbstractBaseJavaLocal
public static final Pattern
RETURN_LINE_START_TYPE_SINGULAR = Pattern.compile("@return\\s+an? (\\S+) (that |describing |containing |of |with |whose |which )");
public static final Pattern
RETURN_LINE_MIDDLE = Pattern.compile("(?:\n\\s*\\*|;|,)\\s+(\\S+) (iff?\\s|when\\s|otherwise|in case of|in the case of)",
RETURN_LINE_MIDDLE = Pattern.compile("(?:\n\\s*\\*|;|,|–|—)\\s+(\\S+) (iff?\\s|when\\s|otherwise|in case of|in the case of)",
Pattern.MULTILINE);
public static final Pattern DESCRIPTION =
Pattern.compile("^\\s+Returns (\\S+) (iff?\\s|when\\s|in case of|in the case of)", Pattern.CASE_INSENSITIVE);
@@ -19,6 +19,16 @@ public interface MismatchedJavadocCode {
*/
int getData2();
/**
* @return foo — <warning descr="Method is specified to return 'false' but its return type is not boolean">false</warning> otherwise
*/
int getDataEmDash();
/**
* @return foo - false otherwise
*/
int getDataDash();
/**
* @return true if data is found; false otherwise
*/