@@ -82,14 +82,19 @@ class suffices for a simple version boundary — use multiple classes only when:
8282 present (e.g., Jersey checks both the JAX-RS spec API and the Jersey implementation class;
8383 AWS SDK Lambda checks both the Lambda module and JSON protocol core).
8484
85- Place a comment ** above each class name string** stating its version role:
86-
87- - ** Floor class** (proves "at least version X"): use ` // added in X.Y ` .
88- - ** Ceiling class** (proves "not yet version Y"): use ` // removed in Y.Z ` .
89-
90- A single landmark class can sometimes provide ** both** bounds: its presence proves the
91- module is at least version ` X.Y ` , and the same class disappears in ` Y.Z ` , so its presence
92- also excludes ` Y.Z+ ` . In that case, a combined comment such as
85+ Place a comment ** above each class name string** stating its version role and matcher shape:
86+
87+ - ** Positive floor class** in ` hasClassesNamed(...) ` (proves "at least version X"):
88+ use ` // added in X.Y ` .
89+ - ** Positive ceiling class** in ` hasClassesNamed(...) ` (proves "not yet version Y"):
90+ use ` // removed in Y.Z ` .
91+ - ** Negated exclusion class** in ` not(hasClassesNamed(...)) ` or
92+ ` .and(not(hasClassesNamed(...))) ` : use ` // added in Y.Z ` , because the class's presence
93+ starts excluding ` Y.Z+ ` .
94+
95+ A single ** positive** landmark class can sometimes provide ** both** bounds: its presence
96+ proves the module is at least version ` X.Y ` , and the same class disappears in ` Y.Z ` , so
97+ its presence also excludes ` Y.Z+ ` . In that case, a combined comment such as
9398` // added in X.Y, removed in Y.Z ` is appropriate.
9499
95100** How to identify ceiling classes** : check whether a ** newer sibling module** exists for
@@ -152,9 +157,9 @@ OpenTelemetry instrumentation:
152157``` java
153158@Override
154159public ElementMatcher . Junction<ClassLoader > classLoaderMatcher() {
155- // InternalRequest was introduced in 7.0.0
160+ // added in 7.0.0
156161 return hasClassesNamed(" org.elasticsearch.client.RestClient$InternalRequest" )
157- // Instrumentation class was introduced in 8.10 (native OTel support)
162+ // added in 8.10 (native OTel support)
158163 .and(not(hasClassesNamed(
159164 " co.elastic.clients.transport.instrumentation.Instrumentation" )));
160165}
@@ -165,9 +170,9 @@ public ElementMatcher.Junction<ClassLoader> classLoaderMatcher() {
165170``` java
166171@Override
167172public ElementMatcher . Junction<ClassLoader > classLoaderMatcher() {
168- // LibraryTelemetryOptions was introduced in azure-core 1.53
173+ // added in azure-core 1.53
169174 return hasClassesNamed(" com.azure.core.util.LibraryTelemetryOptions" )
170- // OpenTelemetryTracer was introduced in azure-core-tracing-opentelemetry 1.0.0-beta.47
175+ // added in azure-core-tracing-opentelemetry 1.0.0-beta.47
171176 .and(not(hasClassesNamed(" com.azure.core.tracing.opentelemetry.OpenTelemetryTracer" )));
172177}
173178```
@@ -185,13 +190,17 @@ public ElementMatcher.Junction<ClassLoader> classLoaderMatcher() {
185190- ** Version comments on landmark classes.** For multi-class checks, ` .and(not(...)) `
186191 chains, or cases where the landmark version differs from the module's base version,
187192 each ` hasClassesNamed() ` call must have a ` // ` comment stating the class's ** role** :
188- - Floor class → ` // added in X.Y ` (class introduced in version X.Y).
189- - Ceiling class → ` // removed in Y.Z ` (class removed in version Y.Z, ensuring the
190- module does not activate on Y.Z+).
191- - Single class that serves as both floor and ceiling → include both boundaries, e.g.
192- ` // added in X.Y, removed in Y.Z ` .
193- Do not use ` // added in ` for a ceiling class — that states when the class first appeared,
194- which is irrelevant and misleading; the purpose is the upper bound.
193+ - Positive floor class → ` // added in X.Y ` (class introduced in version X.Y).
194+ - Positive ceiling class → ` // removed in Y.Z ` (class removed in version Y.Z, ensuring
195+ the module does not activate on Y.Z+).
196+ - Negated exclusion class in ` not(hasClassesNamed(...)) ` → ` // added in Y.Z ` (class
197+ introduced in version Y.Z, so its presence excludes Y.Z+).
198+ - Single positive class that serves as both floor and ceiling → include both boundaries,
199+ e.g. ` // added in X.Y, removed in Y.Z ` .
200+ Do not use ` // added in ` for a ** positive** ceiling class — that states when the class
201+ first appeared, which is irrelevant and misleading; the purpose is the upper bound.
202+ Conversely, do use ` // added in ` for a ** negated** exclusion class, because the class's
203+ first appearance is exactly what begins the excluded version range.
195204 To identify ceiling classes, check if a newer sibling module's ` classLoaderMatcher() `
196205 checks a different variant or replacement class.
197206- ** Single-class landmark comments are required.** When a single-class
0 commit comments