Skip to content

Commit 8e95654

Browse files
author
FusionAuth Automation
committed
Sync from monorepo 4591cce86e9e
1 parent 1f733b9 commit 8e95654

1 file changed

Lines changed: 42 additions & 0 deletions

File tree

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# AGENTS.md — src/main/java/io/fusionauth/domain
2+
3+
Rules for domain model classes under `io.fusionauth.domain`. These are the classes shared with client libraries and must maintain Java 8 compatibility.
4+
5+
## Java 8 Compatibility (critical)
6+
- All code in `io.fusionauth.domain.*` **must be Java 8 compatible**.
7+
- Do not use Java 9+ language features (e.g., pattern variables with `instanceof`, `var`, records, sealed classes).
8+
- The rest of the codebase targets Java 21 — this directory is the exception.
9+
- Build and verify client libraries before pushing a PR that touches domain objects.
10+
11+
## Domain Object Standards
12+
13+
### Copy Constructors (required)
14+
Every domain object must provide a copy constructor.
15+
16+
### equals / hashCode
17+
Use the IntelliJ default generator (Java 7+ style) for `equals` and `hashCode`. Ensure all fields are included.
18+
19+
### toString
20+
Must use:
21+
```java
22+
return com.inversoft.json.ToString.toString(this);
23+
```
24+
25+
### Field Visibility
26+
Prefer `public` fields over private fields with getters/setters.
27+
28+
## Immutability and Constraints
29+
When a field is intentionally immutable or constrained, add a short comment explaining **why** — not just that it is.
30+
31+
## Copy Constructor Completeness
32+
Ensure every field is handled in:
33+
- Copy constructor
34+
- `equals`
35+
- `hashCode`
36+
37+
Missing fields in any of these are a common source of subtle bugs.
38+
39+
## Client Library Impact
40+
Changes to domain objects ripple into client libraries published via git subtrees. After modifying domain objects:
41+
- Reflect changes in `fusionauth-client-builder`.
42+
- Build and verify client libraries before merging.

0 commit comments

Comments
 (0)