@@ -17,7 +17,9 @@ Javaagent modules keep shared `Instrumenter` instances and related collaborators
1717 ` "io.opentelemetry.<module-name>" ` .
1818- For exported collaborators, keep the field ` private ` , use a lower camel case field name, and
1919 give the accessor method the exact same name as the field. Do not prefix these accessors with
20- ` get ` .
20+ ` get ` . This rule applies only to zero-arg methods that directly return a stored singleton
21+ field; methods that take arguments or compute a value are not singleton accessors and keep
22+ their normal names (including ` get* ` when appropriate).
2123 - ` instrumenter ` -> ` instrumenter() `
2224 - ` helper ` -> ` helper() `
2325 - ` setter ` -> ` setter() `
@@ -34,6 +36,9 @@ Javaagent modules keep shared `Instrumenter` instances and related collaborators
3436- Keep verb-named helper methods as verbs when they perform work instead of returning a stored
3537 field. These methods are not singleton accessors and should not be static imported under this
3638 rule.
39+ - Methods on a ` *Singletons ` class that take arguments (for example ` addressAndPort(client) ` or
40+ ` getAddressAndPort(client) ` ) are not singleton accessors. Do not apply the field-style
41+ accessor naming rule to them, and do not flag their ` get* ` prefix on that basis.
3742
3843## Preferred Pattern
3944
@@ -103,7 +108,8 @@ class MyInstrumentation implements TypeInstrumentation {
103108 final` field would be clearer and matches the naming guidance, including semantic keys/handles
104109 and immutable value constants.
105110- Accessor methods named ` getInstrumenter() ` , ` getHelper() ` , ` getSetter() ` , and similar when they
106- simply return a backing field.
111+ simply return a backing field. Do not flag ` get* ` -prefixed methods that take arguments or
112+ compute a value rather than returning a stored singleton field.
107113- Call sites that qualify singleton accessor or uppercase constant-like field usage with the holder
108114 class instead of static importing the accessor or field.
109115- Static imports of non-accessor helper methods on a ` *Singletons ` class when the method performs
0 commit comments