@@ -87,6 +87,11 @@ Place a comment **above each class name string** stating its version role:
8787- ** Floor class** (proves "at least version X"): use ` // added in X.Y ` .
8888- ** Ceiling class** (proves "not yet version Y"): use ` // removed in Y.Z ` .
8989
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
93+ ` // added in X.Y, removed in Y.Z ` is appropriate.
94+
9095** How to identify ceiling classes** : check whether a ** newer sibling module** exists for
9196the same library (e.g., ` mongo-4.0 ` next to ` mongo-3.7 ` ). If the newer module's
9297` classLoaderMatcher() ` checks a different variant of the same class (e.g.,
@@ -183,17 +188,20 @@ public ElementMatcher.Junction<ClassLoader> classLoaderMatcher() {
183188 - Floor class → ` // added in X.Y ` (class introduced in version X.Y).
184189 - Ceiling class → ` // removed in Y.Z ` (class removed in version Y.Z, ensuring the
185190 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 ` .
186193 Do not use ` // added in ` for a ceiling class — that states when the class first appeared,
187194 which is irrelevant and misleading; the purpose is the upper bound.
188195 To identify ceiling classes, check if a newer sibling module's ` classLoaderMatcher() `
189196 checks a different variant or replacement class.
190- - ** Single-class lower-bound comments are required.** When a single-class
191- ` hasClassesNamed(...) ` check exists solely to establish the module's lower bound, add an
192- inline ` // added in X.Y ` comment. The comment explains why the matcher exists and which
193- version boundary it enforces. First validate that ` X.Y ` is factually correct from
194- repository or upstream evidence; do not infer it from the module name alone. Flag a
195- missing comment in this case, and do not flag an existing one for removal unless the
196- comment is demonstrably wrong.
197+ - ** Single-class landmark comments are required.** When a single-class
198+ ` hasClassesNamed(...) ` check establishes the module's lower bound, add an inline
199+ ` // added in X.Y ` comment. If that same class also establishes the upper bound because
200+ it is removed or replaced in a newer sibling version, include that fact too, e.g.
201+ ` // added in X.Y, removed in Y.Z ` . First validate each stated boundary from repository
202+ or upstream evidence; do not infer versions from the module name alone. Flag a missing
203+ boundary comment in this case, and do not flag an existing dual-role comment for removal
204+ unless it is demonstrably wrong.
197205- Prefer ** one landmark class** per version boundary — choose the most stable/specific class.
198206- Pair with ** muzzle config** (` assertInverse.set(true) ` ) for full coverage.
199207- Use ` hasClassesNamed(...) ` (from ` AgentElementMatchers ` ) — not raw ByteBuddy matchers.
0 commit comments