diff options
author | Antoine Musso <hashar@free.fr> | 2023-05-31 17:57:28 +0200 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2023-06-16 01:08:13 +0200 |
commit | 7b955048eb86e1c12114554beacb27b329252b15 (patch) | |
tree | 9cff6f56c696ccff340a7d8bc032301b5df406d6 /org.eclipse.jgit.lfs.server | |
parent | c7960910f0baa0fe7e5b7e24e8681afeffea22a0 (diff) | |
download | jgit-7b955048eb86e1c12114554beacb27b329252b15.tar.gz jgit-7b955048eb86e1c12114554beacb27b329252b15.zip |
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 <url>} to <a>
====================
@link does not support being given an external URL. Replaces them with
HTML `<a>`.
@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 <br/>, <p/> and </p> anymore, use <br> and <p>
instead
- replace <tt>code</tt> by {@code code}
- <table> tags don't allow summary attribute, specify caption as
<caption>caption</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 <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit.lfs.server')
7 files changed, 17 insertions, 14 deletions
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; /** - * <p>Constructor for FileLfsRepository.</p> + * <p> + * Constructor for FileLfsRepository. + * </p> * * @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); /** - * <p>Constructor for ObjectDownloadListener.</p> + * <p> + * Constructor for ObjectDownloadListener. + * </p> * * @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); |