Skip to content

Commit

Permalink
Move the AlmostJavadoc finding to point at the Javadoc.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 580568132
  • Loading branch information
graememorgan authored and Error Prone Team committed Nov 9, 2023
1 parent 5ce8792 commit a2b2bff
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import static com.google.errorprone.BugPattern.SeverityLevel.WARNING;
import static com.google.errorprone.BugPattern.StandardTags.STYLE;
import static com.google.errorprone.bugpatterns.javadoc.Utils.getDiagnosticPosition;
import static com.google.errorprone.matchers.Description.NO_MATCH;
import static com.google.errorprone.util.ASTHelpers.getStartPosition;
import static com.google.errorprone.util.ASTHelpers.getSymbol;
Expand Down Expand Up @@ -83,7 +84,12 @@ public Description matchCompilationUnit(CompilationUnitTree tree, VisitorState s
}
generateFix(comment)
.ifPresent(
fix -> state.reportMatch(describeMatch(javadocableTrees.get(token.pos()), fix)));
fix ->
state.reportMatch(
describeMatch(
getDiagnosticPosition(
comment.getSourcePos(0), javadocableTrees.get(token.pos())),
fix)));
}
}
return NO_MATCH;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@ public void htmlTag() {
.addSourceLines(
"Test.java", //
"public class Test {",
" /* Foo <em>Test</em>. */",
" // BUG: Diagnostic contains:",
" /* Foo <em>Test</em>. */",
" void foo() {}",
"}")
.doTest();
Expand All @@ -166,8 +166,8 @@ public void enumConstant() {
.addSourceLines(
"Test.java", //
"public enum Test {",
" /* Foo <em>Test</em>. */",
" // BUG: Diagnostic contains:",
" /* Foo <em>Test</em>. */",
" FOO",
"}")
.doTest();
Expand All @@ -179,8 +179,8 @@ public void abstractEnumConstant() {
.addSourceLines(
"Test.java", //
"public enum Test {",
" /* Foo <em>Test</em>. */",
" // BUG: Diagnostic contains:",
" /* Foo <em>Test</em>. */",
" FOO {",
" @Override public String toString() {",
" return null;",
Expand All @@ -196,8 +196,8 @@ public void multiField() {
.addSourceLines(
"Test.java", //
"public class Test {",
" /* Foo <em>Test</em>. */",
" // BUG: Diagnostic contains:",
" /* Foo <em>Test</em>. */",
" int x = 1, y = 2;",
"}")
.doTest();
Expand Down

0 comments on commit a2b2bff

Please sign in to comment.