33## Quick Reference
44
55- Use when: reviewing ` *Singletons ` holder classes and their callers
6- - Review focus: field/accessor naming, eager initialization, static-import call sites
6+ - Review focus: field/accessor naming, eager initialization, singleton accessor call sites
77
88Javaagent modules keep shared ` Instrumenter ` instances and related collaborators in a dedicated
99` Singletons ` holder class such as ` MyLibrarySingletons ` .
@@ -28,10 +28,12 @@ Javaagent modules keep shared `Instrumenter` instances and related collaborators
2828 - ` CONTEXT ` stays ` CONTEXT `
2929 - ` REQUEST_INFO ` stays ` REQUEST_INFO `
3030 - ` RESPONSE_STATUS ` stays ` RESPONSE_STATUS `
31- - Callers should static import the exported singleton member and use it unqualified:
32- accessor methods for lower camel collaborators, fields for uppercase constant-like members.
31+ - Callers should static import only exported singleton accessors and uppercase constant-like
32+ fields, and use those members unqualified: accessors for lower camel collaborators, fields for
33+ uppercase constant-like members.
3334- Keep verb-named helper methods as verbs when they perform work instead of returning a stored
34- field. This naming rule applies to field accessors.
35+ field. These methods are not singleton accessors and should not be static imported under this
36+ rule.
3537
3638## Preferred Pattern
3739
@@ -102,7 +104,9 @@ class MyInstrumentation implements TypeInstrumentation {
102104 and immutable value constants.
103105- Accessor methods named ` getInstrumenter() ` , ` getHelper() ` , ` getSetter() ` , and similar when they
104106 simply return a backing field.
105- - Call sites that qualify singleton member usage with the holder class instead of static importing
106- the accessor or field.
107+ - Call sites that qualify singleton accessor or uppercase constant-like field usage with the holder
108+ class instead of static importing the accessor or field.
109+ - Static imports of non-accessor helper methods on a ` *Singletons ` class when the method performs
110+ work instead of returning a stored singleton or constant.
107111- Mismatches between a field name and its accessor, such as ` private static final Helper helper; `
108112 with ` public static Helper getHelper() ` .
0 commit comments