You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 2da5cd2
Browse filesBrowse the repository at this point in the historyBrowse files
Sync the vendored java skill: underscore prefix for hierarchy fields
The naming convention now reserves the underscore prefix for fields
used inside the class hierarchy (~/.claude b75c844).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: .claude/skills/java/rules/convention-naming.md
+24-16Lines changed: 24 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -49,17 +49,25 @@ public Optional<Product> findProductById(final UUID id) {
49
49
### Variablen
50
50
51
51
-**camelCase** für lokale Variablen
52
-
-**_underscorePrefix** für private Felder
52
+
-**_underscorePrefix** nur für `private`/`protected` Felder, die ausschliesslich aus der eigenen Klassenhierarchie gelesen werden — als `_feld`, nie als `objekt._feld`
53
+
- Ein Feld, das direkt über ein Objekt gelesen wird (`objekt.feld`), ist `public` und trägt keinen Underscore
54
+
- Auch der Zugriff über eine andere Instanz derselben Klasse (z.B. `other.id` in `equals`) zählt als Zugriff über ein Objekt
53
55
-`final` bevorzugen
54
56
55
57
```java
56
-
publicclassExample {
57
-
privatefinalProductRepository _productRepository;
58
+
publicclassOrder {
59
+
publicfinalOrderId id; // wird von aussen gelesen: order.id
60
+
protectedfinalMoney _total; // nur Order und Unterklassen: _total
61
+
privatefinalList<Line> _lines; // nur Order selbst: _lines
58
62
59
-
publicvoidprocess() {
60
-
finalvar products = _productRepository.findAll();
63
+
publicbooleanequals(finalObjecto) {
64
+
return o instanceoffinalOrder other && id.equals(other.id); // other._id waere falsch
61
65
}
62
66
}
67
+
68
+
// anderswo
69
+
finalvar orderId = order.id; // richtig
70
+
finalvar total = order._total; // falsch: Underscore-Feld ueber ein Objekt
63
71
```
64
72
65
73
### Konstanten
@@ -116,20 +124,20 @@ public enum CrmOrganisationType {
-[ ] Klassen/Records: PascalCase mit Suffix (*Dto, *Repository, etc.)
158
166
-[ ] Interfaces: PascalCase ohne I-Prefix
159
167
-[ ] Methoden: camelCase mit Verb-Prefix
160
-
-[ ]Private Felder: _underscorePrefix
168
+
-[ ]Underscore nur bei private/protected Feldern, die ausschliesslich aus der eigenen Klassenhierarchie gelesen werden; Zugriff ueber ein Objekt nur auf public-Felder ohne Underscore
0 commit comments