Skip to content

Commit ef2e122

Browse files
committed
fix(docs): replace implNote tags the javadoc task rejects with plain prose
1 parent 06b72ff commit ef2e122

8 files changed

Lines changed: 53 additions & 64 deletions

File tree

‎src/main/java/io/github/intisy/docker/registry/ImageAssembler.java‎

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,11 @@ public static Assembled append(String baseConfigJson, String baseManifestJson,
8181
}
8282

8383
/**
84-
* @implNote a docker-schema2 manifest and an OCI manifest use different layer media types, and
85-
* mixing them in one manifest is rejected. Taking the type from the layers already there keeps
86-
* the assembled manifest internally consistent whichever shape the base image used. The
87-
* {@code OCI_LAYER_GZIP} fallback only applies when the base manifest has no layers at all; a
88-
* real base image always has at least one, so this never mixes a Docker manifest with an OCI
89-
* layer type in practice.
84+
* A docker-schema2 manifest and an OCI manifest use different layer media types, and mixing them in one
85+
* manifest is rejected. Taking the type from the layers already there keeps the assembled manifest
86+
* internally consistent whichever shape the base image used. The {@code OCI_LAYER_GZIP} fallback only
87+
* applies when the base manifest has no layers at all; a real base image always has at least one, so this
88+
* never mixes a Docker manifest with an OCI layer type in practice.
9089
*/
9190
private static String layerMediaTypeMatching(JsonObject manifest) {
9291
JsonArray layers = manifest.getAsJsonArray("layers");
@@ -100,10 +99,9 @@ private static String layerMediaTypeMatching(JsonObject manifest) {
10099
}
101100

102101
/**
103-
* @implNote no {@code created} timestamp is written deliberately: a wall-clock value would
104-
* change the config bytes, and therefore the config digest and manifest, on every build, so
105-
* two builds of identical inputs would push different images. Same determinism property as
106-
* why {@link LayerBuilder} pins mtime to zero.
102+
* No {@code created} timestamp is written deliberately: a wall-clock value would change the config bytes,
103+
* and therefore the config digest and manifest, on every build, so two builds of identical inputs would
104+
* push different images. Same determinism property as why {@link LayerBuilder} pins mtime to zero.
107105
*/
108106
private static void addHistory(JsonObject config) {
109107
JsonArray history = config.getAsJsonArray("history");

‎src/main/java/io/github/intisy/docker/registry/ImageConfigOverrides.java‎

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,11 @@
44

55
/**
66
* What to stamp into the assembled image's config.
7-
*
8-
* @implNote {@code cmd} is three-state: never calling {@code withCmd} leaves the base Cmd alone;
9-
* {@code withCmd(null)} removes it; {@code withCmd(list)}, empty list included, replaces it. This
10-
* matters because a base JRE image ships a Cmd that must be removed, via {@code withCmd(null)},
11-
* or the container runs that instead of ours. {@code entrypoint} is only two-state: never calling
12-
* {@code withEntrypoint} leaves the base value alone, any list (including empty) replaces it;
13-
* there is no way to clear it.
7+
* {@code cmd} is three-state: never calling {@code withCmd} leaves the base Cmd alone; {@code withCmd(null)}
8+
* removes it; {@code withCmd(list)}, empty list included, replaces it. This matters because a base JRE image
9+
* ships a Cmd that must be removed, via {@code withCmd(null)}, or the container runs that instead of ours.
10+
* {@code entrypoint} is only two-state: never calling {@code withEntrypoint} leaves the base value alone, any
11+
* list (including empty) replaces it; there is no way to clear it.
1412
*
1513
* @author Finn Birich
1614
*/

‎src/main/java/io/github/intisy/docker/registry/ImagePublisher.java‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ public static String publish(RegistryClient source, ImageReference base,
4141
}
4242

4343
/**
44-
* @implNote a base image is normally published as a multi-architecture index, so the first read
45-
* yields the index and the platform manifest needs a second read by digest. A base that is
46-
* already a single manifest skips straight through.
44+
* A base image is normally published as a multi-architecture index, so the first read yields the index
45+
* and the platform manifest needs a second read by digest. A base that is already a single manifest skips
46+
* straight through.
4747
*/
4848
private static RegistryClient.Manifest resolveToPlatformManifest(RegistryClient source, ImageReference base)
4949
throws IOException {

‎src/main/java/io/github/intisy/docker/registry/ImageReference.java‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22

33
/**
44
* A parsed container image reference.
5-
*
6-
* @implNote {@code docker.io} is the canonical registry name but not the host that serves it, so
7-
* {@link #registry()} and {@link #host()} differ for Docker Hub and nowhere else.
5+
* {@code docker.io} is the canonical registry name but not the host that serves it, so {@link #registry()}
6+
* and {@link #host()} differ for Docker Hub and nowhere else.
87
*
98
* @author Finn Birich
109
*/
@@ -60,9 +59,8 @@ public static ImageReference parse(String text) {
6059
}
6160

6261
/**
63-
* @implNote the docker convention: a first segment is a registry only if it carries a dot or a
64-
* port, or is literally localhost. Without this, {@code myorg/app} would read as a registry
65-
* called myorg.
62+
* The docker convention: a first segment is a registry only if it carries a dot or a port, or is
63+
* literally localhost. Without this, {@code myorg/app} would read as a registry called myorg.
6664
*/
6765
private static boolean looksLikeRegistry(String candidate) {
6866
return candidate.indexOf('.') >= 0 || candidate.indexOf(':') >= 0 || "localhost".equals(candidate);

‎src/main/java/io/github/intisy/docker/registry/LayerBuilder.java‎

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,9 @@
2020

2121
/**
2222
* Turns a directory into one gzipped tar layer.
23-
*
24-
* @implNote every field that could vary between two builds of the same tree is pinned: entries are
25-
* sorted, modification times are zero, and uid and gid are zero with no owner names. Without that
26-
* the digest changes on every build and the node re-pulls a layer whose content is identical.
23+
* Every field that could vary between two builds of the same tree is pinned: entries are sorted, modification
24+
* times are zero, and uid and gid are zero with no owner names. Without that the digest changes on every
25+
* build and the node re-pulls a layer whose content is identical.
2726
*
2827
* @author Finn Birich
2928
*/
@@ -84,9 +83,9 @@ public int compare(Path a, Path b) {
8483
}
8584

8685
/**
87-
* @implNote a rule, not an inspection: Windows cannot report the POSIX executable bit, so
88-
* reading it would make the layer depend on which machine built it, and the launcher script
89-
* would be non-executable exactly on the machine this project is developed on.
86+
* A rule, not an inspection: Windows cannot report the POSIX executable bit, so reading it would make the
87+
* layer depend on which machine built it, and the launcher script would be non-executable exactly on the
88+
* machine this project is developed on.
9089
*/
9190
static boolean isUnderBin(String nameInArchive) {
9291
return nameInArchive.contains("/bin/") || nameInArchive.startsWith("bin/");
@@ -114,22 +113,22 @@ static List<String> directoriesFor(String prefix, Path source, List<Path> files)
114113
}
115114

116115
/**
117-
* @implNote {@code Path} natural ordering is case-insensitive on Windows and case-sensitive on
118-
* Linux, so sorting by {@code Path} directly would order two names differing only by case
119-
* differently depending on the building platform, changing the digest with it. This is the
120-
* string that is actually written to the archive, so sorting by it is platform-independent.
116+
* {@code Path} natural ordering is case-insensitive on Windows and case-sensitive on Linux, so sorting by
117+
* {@code Path} directly would order two names differing only by case differently depending on the
118+
* building platform, changing the digest with it. This is the string that is actually written to the
119+
* archive, so sorting by it is platform-independent.
121120
*/
122121
static String archiveName(Path source, Path file) {
123122
return source.relativize(file).toString().replace('\\', '/');
124123
}
125124

126125
/**
127-
* @implNote the uid, gid and owner name calls are redundant with commons-compress 1.24.0's own
128-
* defaults for the {@code TarArchiveEntry(String)} constructor used above: it reads
129-
* {@code userName} from {@code System.getProperty("user.name")} during construction and resets
130-
* it to {@code ""} immediately afterward, in that same overload's own body. The calls stay to
131-
* guard against a future change to which constructor is used, which would otherwise leak the
132-
* building machine's identity into the layer and silently break cross-machine determinism.
126+
* The uid, gid and owner name calls are redundant with commons-compress 1.24.0's own defaults for the
127+
* {@code TarArchiveEntry(String)} constructor used above: it reads {@code userName} from
128+
* {@code System.getProperty("user.name")} during construction and resets it to {@code ""} immediately
129+
* afterward, in that same overload's own body. The calls stay to guard against a future change to which
130+
* constructor is used, which would otherwise leak the building machine's identity into the layer and
131+
* silently break cross-machine determinism.
133132
*/
134133
private static void pin(TarArchiveEntry entry, int mode, long size) {
135134
entry.setMode((entry.isDirectory() ? TarArchiveEntry.DEFAULT_DIR_MODE : 0) | mode);

‎src/main/java/io/github/intisy/docker/registry/RegistryClient.java‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,9 @@ public RegistryResponse getBlob(String repository, String digest) throws IOExcep
9292
}
9393

9494
/**
95-
* @implNote the two-step upload (POST for a session, PUT with the digest) rather than the
96-
* single-POST form, because the monolithic POST is optional in the spec and registries differ
97-
* about it, while every registry implements the two-step.
95+
* The two-step upload (POST for a session, PUT with the digest) rather than the single-POST form, because
96+
* the monolithic POST is optional in the spec and registries differ about it, while every registry
97+
* implements the two-step.
9898
*/
9999
public void putBlob(String repository, String digest, RegistryBody body) throws IOException {
100100
RegistryResponse session = http.send("POST", base(repository) + "/blobs/uploads/",

‎src/main/java/io/github/intisy/docker/registry/RegistryResponse.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
import java.util.TreeMap;
88

99
/**
10-
* @implNote headers are held case-insensitively because {@code HttpURLConnection} preserves
11-
* whatever casing the server sent, and registries disagree about {@code Docker-Content-Digest}.
10+
* Headers are held case-insensitively because {@code HttpURLConnection} preserves whatever casing the server
11+
* sent, and registries disagree about {@code Docker-Content-Digest}.
1212
*
1313
* @author Finn Birich
1414
*/

‎src/main/java/io/github/intisy/docker/registry/UrlRegistryHttp.java‎

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,10 @@
1212
/**
1313
* The real transport: {@code HttpURLConnection}, because the library targets Java 8 and
1414
* {@code java.net.http} is not available to it.
15-
*
16-
* @implNote acquires a bearer token lazily on a 401 and retries once, caching per scope. Docker
17-
* Hub answers 401 with a challenge on the very first anonymous request, so without the retry every
18-
* pull would need the caller to know the flow. The retry is skipped when the request carries a
19-
* body: a body stream cannot be replayed once consumed, so a write cannot be transparently
20-
* retried after a challenge.
15+
* Acquires a bearer token lazily on a 401 and retries once, caching per scope. Docker Hub answers 401 with a
16+
* challenge on the very first anonymous request, so without the retry every pull would need the caller to
17+
* know the flow. The retry is skipped when the request carries a body: a body stream cannot be replayed once
18+
* consumed, so a write cannot be transparently retried after a challenge.
2119
*
2220
* @author Finn Birich
2321
*/
@@ -50,11 +48,10 @@ private String tokenFor(String url) {
5048
}
5149

5250
/**
53-
* @implNote derives the pull scope from the request path, so that one client can walk several
54-
* repositories without the caller tracking tokens. The scope is deliberately pull-only:
55-
* anonymous pull from Docker Hub is the only authenticated flow this client implements.
56-
* Supporting a registry that requires a token for writes would mean threading the HTTP method
57-
* through and requesting {@code pull,push}.
51+
* Derives the pull scope from the request path, so that one client can walk several repositories without
52+
* the caller tracking tokens. The scope is deliberately pull-only: anonymous pull from Docker Hub is the
53+
* only authenticated flow this client implements. Supporting a registry that requires a token for writes
54+
* would mean threading the HTTP method through and requesting {@code pull,push}.
5855
*/
5956
static String scopeFor(String url) {
6057
int v2 = url.indexOf("/v2/");
@@ -90,8 +87,8 @@ private String fetchToken(AuthChallenge challenge, String scope) throws IOExcept
9087
}
9188

9289
/**
93-
* @implNote a two-field read rather than a gson dependency at this layer, so the transport
94-
* stays free of any model. The token document has exactly one field this needs.
90+
* A two-field read rather than a gson dependency at this layer, so the transport stays free of any model.
91+
* The token document has exactly one field this needs.
9592
*/
9693
static String jsonStringField(String json, String field) {
9794
String needle = "\"" + field + "\"";
@@ -157,9 +154,8 @@ private static void writeBody(HttpURLConnection connection, RegistryBody body) t
157154
}
158155

159156
/**
160-
* @implNote a non-2xx response body arrives on the error stream, and reading the input stream
161-
* instead throws, which would replace the registry's own explanation with an IOException that
162-
* says nothing.
157+
* A non-2xx response body arrives on the error stream, and reading the input stream instead throws, which
158+
* would replace the registry's own explanation with an IOException that says nothing.
163159
*/
164160
private static byte[] readBody(HttpURLConnection connection, int status) throws IOException {
165161
InputStream in = status >= 400 ? connection.getErrorStream() : connection.getInputStream();

0 commit comments

Comments
 (0)