Skip to content

Commit a294423

Browse files
committed
visibility
1 parent ee36ce4 commit a294423

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

docs/style-guide.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ methods.
5959

6060
## Java Language Conventions
6161

62+
### Visibility modifiers
63+
64+
Follow the principle of minimal necessary visibility. Use the most restrictive access modifier that
65+
still allows the code to function correctly.
66+
6267
### Package conventions
6368

6469
Classes in `.internal` packages are not considered public API and may change without notice. These
@@ -117,6 +122,12 @@ Following the reasoning from
117122
Prefer AssertJ assertions over JUnit assertions (assertEquals, assertTrue, etc.) for better error
118123
messages.
119124

125+
### JUnit
126+
127+
Test classes and test methods should generally be package-protected (no explicit visibility
128+
modifier) rather than `public`. This follows the principle of minimal necessary visibility and is
129+
sufficient for JUnit to discover and execute tests.
130+
120131
### AutoService
121132

122133
Use the `@AutoService` annotation when implementing SPI interfaces. This automatically generates the
@@ -140,7 +151,7 @@ public class MyCustomizerProvider implements AutoConfigurationCustomizerProvider
140151
## Configuration
141152

142153
- Use `otel.` prefix for all configuration property keys
143-
- Read config via the `ConfigProperties` interface
154+
- Read configuration via the `ConfigProperties` interface
144155
- Provide sensible defaults and document all options
145156
- Validate configuration early with clear error messages
146157

0 commit comments

Comments
 (0)