From 7b955048eb86e1c12114554beacb27b329252b15 Mon Sep 17 00:00:00 2001 From: Antoine Musso Date: Wed, 31 May 2023 17:57:28 +0200 Subject: Fix all Javadoc warnings and fail on them This fixes all the javadoc warnings, stops ignoring doclint 'missing' category and fails the build on javadoc warnings for public and protected classes and class members. Since javadoc doesn't allow access specifiers when specifying doclint configuration we cannot set `-Xdoclint:all,-missing/private` hence there is no simple way to skip private elements from doclint. Therefore we check javadoc using the Eclipse Java compiler (which is used by default) and javadoc configuration in `.settings/org.eclipse.jdt.core.prefs` files. This allows more fine grained configuration. We can reconsider this when javadoc starts supporting access specifiers in the doclint configuration. Below are detailled explanations for most modifications. @inheritDoc =========== doclint complains about explicits `{@inheritDoc}` when the parent does not have any documentation. As far as I can tell, javadoc defaults to inherit comments and should only be used when one wants to append extra documentation from the parent. Given the parent has no documentation, remove those usages which doclint complains about. In some case I have moved up the documentation from the concrete class up to the abstract class. Remove `{@inheritDoc}` on overriden methods which don't add additional documentation since javadoc defaults to inherit javadoc of overridden methods. @value to @link =============== In PackConfig, DEFAULT_SEARCH_FOR_REUSE_TIMEOUT and similar are forged from Integer.MAX_VALUE and are thus not considered constants (I guess cause the value would depends on the platform). Replace it with a link to `Integer.MAX_VALUE`. In `StringUtils.toBoolean`, @value was used to refer to the `stringValue` parameter. I have replaced it with `{@code stringValue}`. {@link } to ==================== @link does not support being given an external URL. Replaces them with HTML ``. @since: being invalid ===================== org.eclipse.jgit/src/org/eclipse/jgit/util/Equality.java has an invalid tag `@since: ` due to the extra `:`. Javadoc does not complain about it with version 11.0.18+10 but does with 11.0.19.7. It is invalid regardless. invalid HTML syntax =================== - javadoc doesn't allow
,

and

anymore, use
and

instead - replace code by {@code code} - tags don't allow summary attribute, specify caption as to fix this doclint visibility issue ======================== In the private abstract classes `BaseDirCacheEditor` and `BasePackConnection` links to other methods in the abstract class are inherited in the public subclasses but doclint gets confused and considers them unreachable. The HTML documentation for the sub classes shows the relative links in the sub classes, so it is all correct. It must be a bug somewhere in javadoc. Mute those warnings with: @SuppressWarnings("doclint:missing") Misc ==== Replace `<` and `>` with HTML encoded entities (`< and `>`). In `SshConstants` I went enclosing a serie of -> arrows in @literal. Additional tags =============== Configure maven-javad0c-plugin to allow the following additional tags defined in https://openjdk.org/jeps/8068562: - apiNote - implSpec - implNote Missing javadoc =============== Add missing @params and descriptions Change-Id: I840056389aa59135cfb360da0d5e40463ce35bd0 Also-By: Matthias Sohn --- .../src/org/eclipse/jgit/junit/ssh/SshTestGitServer.java | 6 ++++++ .../src/org/eclipse/jgit/junit/ssh/SshTestHarness.java | 1 + 2 files changed, 7 insertions(+) (limited to 'org.eclipse.jgit.junit.ssh/src/org/eclipse') diff --git a/org.eclipse.jgit.junit.ssh/src/org/eclipse/jgit/junit/ssh/SshTestGitServer.java b/org.eclipse.jgit.junit.ssh/src/org/eclipse/jgit/junit/ssh/SshTestGitServer.java index 5d043ffc3a..1138be8a96 100644 --- a/org.eclipse.jgit.junit.ssh/src/org/eclipse/jgit/junit/ssh/SshTestGitServer.java +++ b/org.eclipse.jgit.junit.ssh/src/org/eclipse/jgit/junit/ssh/SshTestGitServer.java @@ -116,7 +116,9 @@ public class SshTestGitServer { * @param hostKey * the unencrypted private key to use as host key * @throws IOException + * if an IO error occurred * @throws GeneralSecurityException + * if something went wrong */ public SshTestGitServer(@NonNull String testUser, @NonNull Path testKey, @NonNull Repository repository, @NonNull byte[] hostKey) @@ -138,7 +140,9 @@ public class SshTestGitServer { * @param hostKey * the unencrypted private key to use as host key * @throws IOException + * if an IO error occurred * @throws GeneralSecurityException + * if something went wrong * @since 5.9 */ public SshTestGitServer(@NonNull String testUser, @NonNull Path testKey, @@ -413,6 +417,7 @@ public class SshTestGitServer { * @return the port the server listens on; test clients should connect to * that port * @throws IOException + * if an IO error occurred */ public int start() throws IOException { server.start(); @@ -423,6 +428,7 @@ public class SshTestGitServer { * Stops the test server. * * @throws IOException + * if an IO error occurred */ public void stop() throws IOException { executorService.shutdownNow(); diff --git a/org.eclipse.jgit.junit.ssh/src/org/eclipse/jgit/junit/ssh/SshTestHarness.java b/org.eclipse.jgit.junit.ssh/src/org/eclipse/jgit/junit/ssh/SshTestHarness.java index a28d5ebd98..6fa30d7e1e 100644 --- a/org.eclipse.jgit.junit.ssh/src/org/eclipse/jgit/junit/ssh/SshTestHarness.java +++ b/org.eclipse.jgit.junit.ssh/src/org/eclipse/jgit/junit/ssh/SshTestHarness.java @@ -191,6 +191,7 @@ public abstract class SshTestHarness extends RepositoryTestCase { * to use * @return the public-key part of the line * @throws IOException + * if an IO error occurred */ protected static String createKnownHostsFile(File file, String host, int port, File publicKey) throws IOException { -- cgit v1.2.3
caption