diff --git a/config/checker-framework-suppressions/checker-nullness-optional-interning-suppressions.xml b/config/checker-framework-suppressions/checker-nullness-optional-interning-suppressions.xml index 4000ebd72a0..fe7ca14291c 100644 --- a/config/checker-framework-suppressions/checker-nullness-optional-interning-suppressions.xml +++ b/config/checker-framework-suppressions/checker-nullness-optional-interning-suppressions.xml @@ -4328,28 +4328,6 @@ private Scope excludeScope; - - src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/SummaryJavadocCheck.java - argument - incompatible argument for parameter javadocInlineTag of SummaryJavadocCheck.isInlineReturnTag. - else if (inlineTag.isPresent() && isInlineReturnTag(inlineTagNode)) { -
- found : @Initialized @Nullable DetailNode - required: @Initialized @NonNull DetailNode -
-
- - - src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/SummaryJavadocCheck.java - argument - incompatible argument for parameter javadocInlineTag of SummaryJavadocCheck.isSummaryTag. - && isSummaryTag(inlineTagNode) -
- found : @Initialized @Nullable DetailNode - required: @Initialized @NonNull DetailNode -
-
- src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/SummaryJavadocCheck.java return diff --git a/pom.xml b/pom.xml index 965f8c5db92..a093059eccd 100644 --- a/pom.xml +++ b/pom.xml @@ -734,6 +734,10 @@ ${java.version} false + + + java/util/Optional.get:.* + diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/SummaryJavadocCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/SummaryJavadocCheck.java index fdc3df92ce7..6686375f955 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/SummaryJavadocCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/SummaryJavadocCheck.java @@ -210,17 +210,20 @@ public int[] getRequiredJavadocTokens() { @Override public void visitJavadocToken(DetailNode ast) { - final Optional inlineTag = getInlineTagNode(ast); - final DetailNode inlineTagNode = inlineTag.orElse(null); - if (inlineTag.isPresent() - && isSummaryTag(inlineTagNode) - && isDefinedFirst(inlineTagNode)) { - validateSummaryTag(inlineTagNode); - } - else if (inlineTag.isPresent() && isInlineReturnTag(inlineTagNode)) { - validateInlineReturnTag(inlineTagNode); + final Optional inlineTagNode = getInlineTagNode(ast); + boolean shouldValidateUntaggedSummary = true; + if (inlineTagNode.isPresent()) { + final DetailNode node = inlineTagNode.get(); + if (isSummaryTag(node) && isDefinedFirst(node)) { + shouldValidateUntaggedSummary = false; + validateSummaryTag(node); + } + else if (isInlineReturnTag(node)) { + shouldValidateUntaggedSummary = false; + validateInlineReturnTag(node); + } } - else if (!startsWithInheritDoc(ast)) { + if (shouldValidateUntaggedSummary && !startsWithInheritDoc(ast)) { validateUntaggedSummary(ast); } }