Skip to content

Commit d7189be

Browse files
committed
compact
1 parent ac61193 commit d7189be

2 files changed

Lines changed: 18 additions & 15 deletions

File tree

.github/agents/knowledge/javaagent-module-patterns.md

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,10 @@ The compact form does **not** apply when matchers are chained (e.g., positive +
150150
In that case, follow the multi-class rule: place each version comment directly above its
151151
class name string.
152152

153-
When the positive matcher in a chain still has a **single inline class string**, keep that
154-
class on the `return hasClassesNamed("...")` line and place its version comment on the
155-
preceding line. Place the negated matcher's comment above the `.and(...)` call. This keeps
156-
the compact look for chained-with-single-positive shapes:
153+
Within a chain, each `hasClassesNamed("...")` call with a **single inline class string**
154+
whether used directly, as `not(hasClassesNamed("..."))`, or inside `.and(...)` — should
155+
keep the class on one line and place its version comment on the line immediately above
156+
that call:
157157

158158
```java
159159
// added in 4.0.0.Final
@@ -162,9 +162,16 @@ return hasClassesNamed("io.netty.handler.codec.http.HttpMessage")
162162
.and(not(hasClassesNamed("io.netty.handler.codec.http.CombinedHttpHeaders")));
163163
```
164164

165-
Only break the positive class onto its own line (with the comment indented above it) when
166-
there are multiple positive classes, or when the chained landmark requires a multi-line
167-
two-line form (such as the artifact-presence-gate two-liner).
165+
```java
166+
// removed in 4.0
167+
return not(hasClassesNamed("io.vertx.core.Starter"))
168+
// added in 5.0
169+
.and(not(hasClassesNamed("io.vertx.core.http.impl.HttpClientConnectionInternal")));
170+
```
171+
172+
Only break a class onto its own line (with the comment indented above it) when that call
173+
has multiple class strings, or when the chained landmark requires a multi-line two-line
174+
form (such as the artifact-presence-gate two-liner).
168175

169176
**How to identify ceiling classes**: look for a **newer sibling module** for the same
170177
library, such as `mongo-4.0` next to `mongo-3.7`. If the newer module's

instrumentation/vertx/vertx-http-client/vertx-http-client-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/vertx/v4_0/client/VertxClientInstrumentationModule.java

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,10 @@ public VertxClientInstrumentationModule() {
2424

2525
@Override
2626
public ElementMatcher.Junction<ClassLoader> classLoaderMatcher() {
27-
return not(hasClassesNamed(
28-
// removed in 4.0
29-
"io.vertx.core.Starter"))
30-
.and(
31-
not(
32-
hasClassesNamed(
33-
// added in 5.0
34-
"io.vertx.core.http.impl.HttpClientConnectionInternal")));
27+
// removed in 4.0
28+
return not(hasClassesNamed("io.vertx.core.Starter"))
29+
// added in 5.0
30+
.and(not(hasClassesNamed("io.vertx.core.http.impl.HttpClientConnectionInternal")));
3531
}
3632

3733
@Override

0 commit comments

Comments
 (0)