Skip to content

Commit 93e1a0b

Browse files
committed
Make UnrecognisedJavadocTag an error
Its one finding was the Javadoc of JavadocLexer.stripMargins, where {@code <pre>{@code} left the inner brace open, so the parser ended the tag at the wrong brace. It reads <code>&lt;pre&gt;&#123;@code</code> now, as Token.Type.INLINE_TAG_OPEN writes {@code.
1 parent b3c6c9b commit 93e1a0b

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

‎buildSrc/src/main/groovy/open-java-format.error-prone-conventions.gradle‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ tasks.withType(JavaCompile).configureEach {
3838
error('RefactorSwitch')
3939
error('SameNameButDifferent')
4040
error('StringConcatToTextBlock')
41+
error('UnrecognisedJavadocTag')
4142
error('UnusedVariable')
4243
disable('IsInstanceLambdaUsage')
4344
disable('LexicographicalAnnotationAttributeListing')

‎open-java-format/src/main/java/com/palantir/javaformat/java/javadoc/JavadocLexer.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ static List<Token> lex(String input) throws LexException {
8080
/**
8181
* Strips the margin from every continuation line: the {@code *} prefix (with the space after it) from lines that
8282
* have one, and the comment's own indentation from lines that do not. What remains of a bare line's indentation is
83-
* relative to the comment, as on {@code *} lines after their {@code * }, so a {@code <pre>{@code} block written
84-
* without the {@code *} margin keeps its shape for {@link #deindentPreCodeBlocks}.
83+
* relative to the comment, as on {@code *} lines after their {@code * }, so a <code>&lt;pre&gt;&#123;@code</code>
84+
* block written without the {@code *} margin keeps its shape for {@link #deindentPreCodeBlocks}.
8585
*
8686
* <p>The indentation stripped from bare lines is the smaller of the shortest {@code *} prefix and the shortest
8787
* indentation of a bare line, so a bare line is never cut into and lines of both kinds stay aligned with each

0 commit comments

Comments
 (0)