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
caption 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
---
.../.settings/org.eclipse.jdt.core.prefs | 2 +-
.../org/eclipse/jgit/lfs/server/LargeFileRepository.java | 1 +
.../src/org/eclipse/jgit/lfs/server/LfsProtocolServlet.java | 1 -
.../org/eclipse/jgit/lfs/server/fs/FileLfsRepository.java | 13 ++++++++-----
.../eclipse/jgit/lfs/server/fs/ObjectDownloadListener.java | 5 ++++-
.../eclipse/jgit/lfs/server/fs/ObjectUploadListener.java | 5 +++--
.../src/org/eclipse/jgit/lfs/server/s3/S3Repository.java | 4 ----
7 files changed, 17 insertions(+), 14 deletions(-)
(limited to 'org.eclipse.jgit.lfs.server')
diff --git a/org.eclipse.jgit.lfs.server/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.jgit.lfs.server/.settings/org.eclipse.jdt.core.prefs
index 0857bc15f2..3a92f0c434 100644
--- a/org.eclipse.jgit.lfs.server/.settings/org.eclipse.jdt.core.prefs
+++ b/org.eclipse.jgit.lfs.server/.settings/org.eclipse.jdt.core.prefs
@@ -52,7 +52,7 @@ org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=error
org.eclipse.jdt.core.compiler.problem.missingJavadocComments=error
org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=protected
-org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=return_tag
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=all_standard_tags
org.eclipse.jdt.core.compiler.problem.missingJavadocTags=error
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsMethodTypeParameters=disabled
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
diff --git a/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/LargeFileRepository.java b/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/LargeFileRepository.java
index 5e37664eb3..4c81baf838 100644
--- a/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/LargeFileRepository.java
+++ b/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/LargeFileRepository.java
@@ -60,6 +60,7 @@ public interface LargeFileRepository {
* @return length of the object content in bytes, -1 if the object doesn't
* exist
* @throws java.io.IOException
+ * if an IO error occurred
*/
long getSize(AnyLongObjectId id) throws IOException;
}
diff --git a/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/LfsProtocolServlet.java b/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/LfsProtocolServlet.java
index 3ec08ecc83..6747b014dc 100644
--- a/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/LfsProtocolServlet.java
+++ b/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/LfsProtocolServlet.java
@@ -164,7 +164,6 @@ public abstract class LfsProtocolServlet extends HttpServlet {
}
}
- /** {@inheritDoc} */
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException {
diff --git a/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/fs/FileLfsRepository.java b/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/fs/FileLfsRepository.java
index 31d5b2f8c5..ff648aaebf 100644
--- a/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/fs/FileLfsRepository.java
+++ b/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/fs/FileLfsRepository.java
@@ -38,13 +38,16 @@ public class FileLfsRepository implements LargeFileRepository {
private final Path dir;
/**
- * Constructor for FileLfsRepository.
+ *
+ * Constructor for FileLfsRepository.
+ *
*
* @param url
* external URL of this repository
* @param dir
* storage directory
* @throws java.io.IOException
+ * if an IO error occurred
*/
public FileLfsRepository(String url, Path dir) throws IOException {
this.url = url;
@@ -52,26 +55,22 @@ public class FileLfsRepository implements LargeFileRepository {
Files.createDirectories(dir);
}
- /** {@inheritDoc} */
@Override
public Response.Action getDownloadAction(AnyLongObjectId id) {
return getAction(id);
}
- /** {@inheritDoc} */
@Override
public Action getUploadAction(AnyLongObjectId id, long size) {
return getAction(id);
}
- /** {@inheritDoc} */
@Override
@Nullable
public Action getVerifyAction(AnyLongObjectId id) {
return null;
}
- /** {@inheritDoc} */
@Override
public long getSize(AnyLongObjectId id) throws IOException {
Path p = getPath(id);
@@ -148,6 +147,8 @@ public class FileLfsRepository implements LargeFileRepository {
}
/**
+ * Get URL of content server
+ *
* @return the url of the content server
* @since 4.11
*/
@@ -156,6 +157,8 @@ public class FileLfsRepository implements LargeFileRepository {
}
/**
+ * Set the URL of the content server
+ *
* @param url
* the url of the content server
* @since 4.11
diff --git a/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/fs/ObjectDownloadListener.java b/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/fs/ObjectDownloadListener.java
index d42701125e..2ea92da82b 100644
--- a/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/fs/ObjectDownloadListener.java
+++ b/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/fs/ObjectDownloadListener.java
@@ -50,7 +50,9 @@ public class ObjectDownloadListener implements WriteListener {
private ByteBuffer buffer = ByteBuffer.allocateDirect(8192);
/**
- * Constructor for ObjectDownloadListener.
+ *
+ * Constructor for ObjectDownloadListener.
+ *
*
* @param repository
* the repository storing large objects
@@ -61,6 +63,7 @@ public class ObjectDownloadListener implements WriteListener {
* @param id
* id of the object to be downloaded
* @throws java.io.IOException
+ * if an IO error occurred
*/
public ObjectDownloadListener(FileLfsRepository repository,
AsyncContext context, HttpServletResponse response,
diff --git a/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/fs/ObjectUploadListener.java b/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/fs/ObjectUploadListener.java
index f5212fe259..1ac2b2072a 100644
--- a/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/fs/ObjectUploadListener.java
+++ b/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/fs/ObjectUploadListener.java
@@ -92,7 +92,9 @@ public class ObjectUploadListener implements ReadListener {
* @param id
* a {@link org.eclipse.jgit.lfs.lib.AnyLongObjectId} object.
* @throws java.io.FileNotFoundException
+ * if file wasn't found
* @throws java.io.IOException
+ * if an IO error occurred
*/
public ObjectUploadListener(FileLfsRepository repository,
AsyncContext context, HttpServletRequest request,
@@ -146,7 +148,6 @@ public class ObjectUploadListener implements ReadListener {
}
}
- /** {@inheritDoc} */
@Override
public void onAllDataRead() throws IOException {
close();
@@ -156,6 +157,7 @@ public class ObjectUploadListener implements ReadListener {
* Close resources held by this listener
*
* @throws java.io.IOException
+ * if an IO error occurred
*/
protected void close() throws IOException {
try {
@@ -174,7 +176,6 @@ public class ObjectUploadListener implements ReadListener {
}
}
- /** {@inheritDoc} */
@Override
public void onError(Throwable e) {
try {
diff --git a/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/s3/S3Repository.java b/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/s3/S3Repository.java
index c7c7a7146b..3c98d7b9e5 100644
--- a/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/s3/S3Repository.java
+++ b/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/s3/S3Repository.java
@@ -58,7 +58,6 @@ public class S3Repository implements LargeFileRepository {
this.s3Config = config;
}
- /** {@inheritDoc} */
@Override
public Response.Action getDownloadAction(AnyLongObjectId oid) {
URL endpointUrl = getObjectUrl(oid);
@@ -75,7 +74,6 @@ public class S3Repository implements LargeFileRepository {
return a;
}
- /** {@inheritDoc} */
@Override
public Response.Action getUploadAction(AnyLongObjectId oid, long size) {
cacheObjectMetaData(oid, size);
@@ -95,13 +93,11 @@ public class S3Repository implements LargeFileRepository {
return a;
}
- /** {@inheritDoc} */
@Override
public Action getVerifyAction(AnyLongObjectId id) {
return null; // TODO(ms) implement this
}
- /** {@inheritDoc} */
@Override
public long getSize(AnyLongObjectId oid) throws IOException {
URL endpointUrl = getObjectUrl(oid);
--
cgit v1.2.3