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
---
.../src/org/eclipse/jgit/archive/BaseFormat.java | 1 +
.../src/org/eclipse/jgit/archive/TarFormat.java | 6 ------
.../src/org/eclipse/jgit/archive/Tbz2Format.java | 6 ------
.../src/org/eclipse/jgit/archive/TgzFormat.java | 6 ------
.../src/org/eclipse/jgit/archive/TxzFormat.java | 6 ------
.../src/org/eclipse/jgit/archive/ZipFormat.java | 6 ------
6 files changed, 1 insertion(+), 30 deletions(-)
(limited to 'org.eclipse.jgit.archive/src/org/eclipse')
diff --git a/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/BaseFormat.java b/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/BaseFormat.java
index 0ebac77228..25cd36817a 100644
--- a/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/BaseFormat.java
+++ b/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/BaseFormat.java
@@ -40,6 +40,7 @@ public class BaseFormat {
* options map
* @return stream with option applied
* @throws IOException
+ * if an IO error occurred
*/
protected ArchiveOutputStream applyFormatOptions(ArchiveOutputStream s,
Map o) throws IOException {
diff --git a/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/TarFormat.java b/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/TarFormat.java
index 702bad62fe..dfa60321b0 100644
--- a/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/TarFormat.java
+++ b/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/TarFormat.java
@@ -39,7 +39,6 @@ public final class TarFormat extends BaseFormat implements
private static final List SUFFIXES = Collections
.unmodifiableList(Arrays.asList(".tar")); //$NON-NLS-1$
- /** {@inheritDoc} */
@Override
public ArchiveOutputStream createArchiveOutputStream(OutputStream s)
throws IOException {
@@ -47,7 +46,6 @@ public final class TarFormat extends BaseFormat implements
Collections. emptyMap());
}
- /** {@inheritDoc} */
@Override
public ArchiveOutputStream createArchiveOutputStream(OutputStream s,
Map o) throws IOException {
@@ -58,7 +56,6 @@ public final class TarFormat extends BaseFormat implements
return applyFormatOptions(out, o);
}
- /** {@inheritDoc} */
@Override
public void putEntry(ArchiveOutputStream out,
ObjectId tree, String path, FileMode mode, ObjectLoader loader)
@@ -108,19 +105,16 @@ public final class TarFormat extends BaseFormat implements
out.closeArchiveEntry();
}
- /** {@inheritDoc} */
@Override
public Iterable suffixes() {
return SUFFIXES;
}
- /** {@inheritDoc} */
@Override
public boolean equals(Object other) {
return (other instanceof TarFormat);
}
- /** {@inheritDoc} */
@Override
public int hashCode() {
return getClass().hashCode();
diff --git a/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/Tbz2Format.java b/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/Tbz2Format.java
index 940dafd40f..26da431147 100644
--- a/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/Tbz2Format.java
+++ b/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/Tbz2Format.java
@@ -33,7 +33,6 @@ public final class Tbz2Format extends BaseFormat implements
private final ArchiveCommand.Format tarFormat = new TarFormat();
- /** {@inheritDoc} */
@Override
public ArchiveOutputStream createArchiveOutputStream(OutputStream s)
throws IOException {
@@ -41,7 +40,6 @@ public final class Tbz2Format extends BaseFormat implements
Collections. emptyMap());
}
- /** {@inheritDoc} */
@Override
public ArchiveOutputStream createArchiveOutputStream(OutputStream s,
Map o) throws IOException {
@@ -55,7 +53,6 @@ public final class Tbz2Format extends BaseFormat implements
return tarFormat.createArchiveOutputStream(out, o);
}
- /** {@inheritDoc} */
@Override
public void putEntry(ArchiveOutputStream out,
ObjectId tree, String path, FileMode mode, ObjectLoader loader)
@@ -63,19 +60,16 @@ public final class Tbz2Format extends BaseFormat implements
tarFormat.putEntry(out, tree, path, mode, loader);
}
- /** {@inheritDoc} */
@Override
public Iterable suffixes() {
return SUFFIXES;
}
- /** {@inheritDoc} */
@Override
public boolean equals(Object other) {
return (other instanceof Tbz2Format);
}
- /** {@inheritDoc} */
@Override
public int hashCode() {
return getClass().hashCode();
diff --git a/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/TgzFormat.java b/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/TgzFormat.java
index 72e2439f68..d1ed035d0f 100644
--- a/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/TgzFormat.java
+++ b/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/TgzFormat.java
@@ -34,7 +34,6 @@ public final class TgzFormat extends BaseFormat implements
private final ArchiveCommand.Format tarFormat = new TarFormat();
- /** {@inheritDoc} */
@Override
public ArchiveOutputStream createArchiveOutputStream(OutputStream s)
throws IOException {
@@ -42,7 +41,6 @@ public final class TgzFormat extends BaseFormat implements
Collections. emptyMap());
}
- /** {@inheritDoc} */
@Override
public ArchiveOutputStream createArchiveOutputStream(OutputStream s,
Map o) throws IOException {
@@ -58,7 +56,6 @@ public final class TgzFormat extends BaseFormat implements
return tarFormat.createArchiveOutputStream(out, o);
}
- /** {@inheritDoc} */
@Override
public void putEntry(ArchiveOutputStream out,
ObjectId tree, String path, FileMode mode, ObjectLoader loader)
@@ -66,19 +63,16 @@ public final class TgzFormat extends BaseFormat implements
tarFormat.putEntry(out, tree, path, mode, loader);
}
- /** {@inheritDoc} */
@Override
public Iterable suffixes() {
return SUFFIXES;
}
- /** {@inheritDoc} */
@Override
public boolean equals(Object other) {
return (other instanceof TgzFormat);
}
- /** {@inheritDoc} */
@Override
public int hashCode() {
return getClass().hashCode();
diff --git a/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/TxzFormat.java b/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/TxzFormat.java
index b16fb6dcbd..42549de302 100644
--- a/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/TxzFormat.java
+++ b/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/TxzFormat.java
@@ -33,7 +33,6 @@ public final class TxzFormat extends BaseFormat implements
private final ArchiveCommand.Format tarFormat = new TarFormat();
- /** {@inheritDoc} */
@Override
public ArchiveOutputStream createArchiveOutputStream(OutputStream s)
throws IOException {
@@ -41,7 +40,6 @@ public final class TxzFormat extends BaseFormat implements
Collections. emptyMap());
}
- /** {@inheritDoc} */
@Override
public ArchiveOutputStream createArchiveOutputStream(OutputStream s,
Map o) throws IOException {
@@ -55,7 +53,6 @@ public final class TxzFormat extends BaseFormat implements
return tarFormat.createArchiveOutputStream(out, o);
}
- /** {@inheritDoc} */
@Override
public void putEntry(ArchiveOutputStream out,
ObjectId tree, String path, FileMode mode, ObjectLoader loader)
@@ -63,19 +60,16 @@ public final class TxzFormat extends BaseFormat implements
tarFormat.putEntry(out, tree, path, mode, loader);
}
- /** {@inheritDoc} */
@Override
public Iterable suffixes() {
return SUFFIXES;
}
- /** {@inheritDoc} */
@Override
public boolean equals(Object other) {
return (other instanceof TxzFormat);
}
- /** {@inheritDoc} */
@Override
public int hashCode() {
return getClass().hashCode();
diff --git a/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/ZipFormat.java b/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/ZipFormat.java
index 97a24c75cb..6cb42ae1e5 100644
--- a/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/ZipFormat.java
+++ b/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/ZipFormat.java
@@ -35,7 +35,6 @@ public final class ZipFormat extends BaseFormat implements
private static final List SUFFIXES = Collections
.unmodifiableList(Arrays.asList(".zip")); //$NON-NLS-1$
- /** {@inheritDoc} */
@Override
public ArchiveOutputStream createArchiveOutputStream(OutputStream s)
throws IOException {
@@ -43,7 +42,6 @@ public final class ZipFormat extends BaseFormat implements
Collections. emptyMap());
}
- /** {@inheritDoc} */
@Override
public ArchiveOutputStream createArchiveOutputStream(OutputStream s,
Map o) throws IOException {
@@ -55,7 +53,6 @@ public final class ZipFormat extends BaseFormat implements
return applyFormatOptions(out, o);
}
- /** {@inheritDoc} */
@Override
public void putEntry(ArchiveOutputStream out,
ObjectId tree, String path, FileMode mode, ObjectLoader loader)
@@ -97,19 +94,16 @@ public final class ZipFormat extends BaseFormat implements
out.closeArchiveEntry();
}
- /** {@inheritDoc} */
@Override
public Iterable suffixes() {
return SUFFIXES;
}
- /** {@inheritDoc} */
@Override
public boolean equals(Object other) {
return (other instanceof ZipFormat);
}
- /** {@inheritDoc} */
@Override
public int hashCode() {
return getClass().hashCode();
--
cgit v1.2.3