Replace HTML JavaDoc with Markdown and enable javac -Xlintdoc - #69
Open
ThoSap wants to merge 1 commit into
Open
Conversation
-Xlintdocjavac -Xlintdoc
javac -Xlintdocjavac -Xlintdoc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Every hand-written JavaDoc comment is now a JEP 467 markdown comment.
0 traditional
/**blocks remain, against 224///lines.The PR also adds the one compiler flag that makes the change safe to maintain:
-Xdoclint:all,-missing.Without it, a broken
[Reference]compiles silently - see the review notes, where that claim is measured rather than assumed.Why
The project already documented mostly in markdown: 198
///lines against 17 traditional blocks in 8 files.This finishes the job and makes the style uniform, so nobody has to decide which form to write.
Markdown also removes the HTML escaping trap.
Three JavaDoc comments in
RoleServicecarried SQL grammar placeholders -CREATE ROLE <name>,COMMENT ON ROLE <name> IS <comment>which javac read as unknown HTML tags.The rendered documentation silently swallowed them.
The conversion rules applied
/** … *////per line<p>///line{@link Foo}[Foo]{@link #member}[#member]{@code null}`null`<a href="url">text</a>[text](url)A reference uses the short form because the type is imported or in the same package, which is the rule the Oracle guide states:
write
[List]whenjava.util.Listis imported,[java.util.List]otherwise.No reference in this PR needed the fully qualified form as everyone was checked against the file's imports.
Three angle-bracket placeholders became code spans rather than links, because Markdown passes raw HTML through unchanged:
/// Build: `CREATE ROLE <name> [ [ WITH ] option [ ... ] ]`The reference pass
Ten type names sat in prose and in
@param/@returntext with no markup, and became reference links:GrantService[DSLContext]×2,[GrantSpec]×2,[Privilege]DefaultPrivilegeService[DSLContext],[DefaultPrivilegeSpec],[Privilege]RoleReconciler[Role],[Secret]DatabaseSpec[Database]SchemaSpec[Schema][Schema]and[Database]were checked for ambiguity: neither file importsorg.jooq.Schema, so both resolve to the CRD classes.Two link labels were made descriptive for consistency.
PrivilegeandGrantObjectTypehad used the URL as its own label, whileRoleServiceused text:Deliberately left as code spans
A
[Reference]is only correct for a program element. These are not, and all 33 stay as`code`:select,insert,usage,truncate,trigger,maintainschema,table,sequencehost,port,dbname,metadata.name,format,patterninput,objectType,role,objectsnull,"hostname"Also untouched: type names inside
```javafences inHostCustomizerandKubernetesNameCustomizer, which are example snippets rather than prose; and the four plain@see SchemaCustomizerreferences, which resolve as traditional references and which the Oracle guide does not discuss in markdown form.Why
-Xdoclint:all,-missingIt is the only check in the build that verifies a reference resolves. That was measured, not assumed. A probe class with a broken
@see NoSuchTypeand a broken[NoSuchType]:@see[Ref]-Xdoclint:referenceSo the 15 JavaDoc checks in
errorprone.argsdo not make doclint redundant, and this PR would otherwise ship 10 new reference links with nothing validating them.The groups are complementary rather than overlapping, which is the opposite of the
-Xlintsituation, where 11 categories were left off precisely because an Error Prone check owned them:referencesyntaxMalformedInlineTagcatches a reversed@{code}; doclint catches an unterminated{@linkthat Error Prone misseshtmlUnescapedEntitymatches only uppercase generic syntax, so lowercase<name>slips pastaccessibilitymissingMissingJavadocexists only on Error Prone master, not 2.50.0Why
missingis offIt reports about 200 findings, most of them undocumented members of the generated jOOQ code. doclint ignores
@SuppressWarnings, so the@SuppressWarnings({"all", …})that exempts generated code from every Error Prone check does nothing here. Silencing it would need-Xdoclint/package:-it.aboutbits.postgresql.core.infrastructure.persistence.*.Review notes
-missingnegation carries no access qualifier, on purpose.-Xdoclint:all,-missing/privatedisablesmissingfor private members only and leaves it on elsewhere - 204 findings.-Xdoclint:all,-missinggives 0.javac's doclint default is already
/private, the widest setting.Verified with a probe: a broken reference on a
privatemethod is reported by plain-Xdoclint:reference, and suppressed only by/package,/protectedor/public.htmldiagnostics are errors, not warnings, so a future unescaped<tag>fails the build rather than scrolling past.Test scope
./gradlew --rerun-tasks :operator:compileJava :operator:compileTestJava :generated:compileJava- BUILD SUCCESSFUL.-Xlintcategories.reference,syntax,htmlandaccessibility.grepconfirms no/**block,{@link},{@code},{@literal},<a href>,<p>,<code>or<pre>remains in hand-written sources.Follow-up
Error Prone's
TraditionalJavadocToMarkdownwould enforce this style from now on, and it ships aSuggestedFixso patch mode can convert anything that slips in.It is not in 2.50.0, which is still the latest release, and adding the flag early fails the build with
TraditionalJavadocToMarkdown is not a valid checker name.Add
-Xep:TraditionalJavadocToMarkdown:ERRORonce 2.51.0 ships and note it is declaredSUGGESTION, so it reports nothing until raised.