From c8511cea39e2a26835b6f7c250113f75b5a115ea Mon Sep 17 00:00:00 2001 From: cpovirk Date: Tue, 7 Jul 2026 09:29:58 -0700 Subject: [PATCH] Test that `SuggestedFixes.replaceIncludingComments` removes Markdown Javadoc. kak@ points out that this may have been addressed way back in https://github.com/google/error-prone/commit/2dde25434696cc2f87e76b64bf60d8875da36a09. PiperOrigin-RevId: 943937282 --- .../bugpatterns/UnusedMethodTest.java | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/core/src/test/java/com/google/errorprone/bugpatterns/UnusedMethodTest.java b/core/src/test/java/com/google/errorprone/bugpatterns/UnusedMethodTest.java index 27e48432424..f52abd90d14 100644 --- a/core/src/test/java/com/google/errorprone/bugpatterns/UnusedMethodTest.java +++ b/core/src/test/java/com/google/errorprone/bugpatterns/UnusedMethodTest.java @@ -253,6 +253,44 @@ public class UnusedWithComment {} .doTest(); } + @Test + public void removal_markdownJavadocs() { + refactoringHelper + .addInputLines( + "UnusedWithComment.java", + """ + package unusedvars; + + public class UnusedWithComment { + /// Method comment + private void test1() {} + + /// First line of method comment + /// Second line of method comment + private void test2() {} + + // Keep this comment + + /// First line of method comment + /// + /// Second line of method comment + private void test3() {} + } + """) + .addOutputLines( + "UnusedWithComment.java", + """ + package unusedvars; + + public class UnusedWithComment { + + // Keep this comment + + } + """) + .doTest(); + } + @Test public void usedInLambda() { helper