Skip to content

Commit b3eba44

Browse files
ADR-007 desicion
1 parent 25a0084 commit b3eba44

1 file changed

Lines changed: 3 additions & 22 deletions

File tree

docs/adr/ADR-007-internal-api-encapsulation.md

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Status
44

5-
Proposed.
5+
Accepted.
66

77
## Context
88

@@ -277,30 +277,11 @@ escape hatch — but it should be a deliberate choice, not a default.
277277

278278
## Decision
279279

280-
*Pending team review.*
280+
**Option B — Single-package infra.** Every infra and resource façade class moves into `com.marketdata.sdk` and drops the `public` modifier so it becomes package-private; the compiler then refuses any consumer reference to `HttpTransport`, `RequestSpec`, `AsyncSemaphore`, the wire-format deserializers, or any other internal type. B was chosen over A (JPMS) because the threat model includes classpath consumers — still the majority in 2026 — and JPMS enforcement degrades to a soft IDE warning on classpath, while Option B's enforcement is identical at the language level for both consumer modes.
281281

282282
## Consequences
283283

284-
Follow-on work implied by each option. The chosen option will be
285-
marked when the decision is made.
286-
287-
- **A (JPMS, recommended):** Add `src/main/java/module-info.java` with
288-
the exports listed in the option above. Add `requires` clauses for
289-
Jackson and JSpecify (`requires static org.jspecify` for compile-time
290-
only). Update CLAUDE.md to record the modulepath/classpath
291-
enforcement contract. No source moves, no refactor of resource code.
292-
Tests continue to access internals via Gradle's standard test source
293-
set wiring. Verify that `./gradlew build` still succeeds end-to-end
294-
and that `javadoc` no longer surfaces `internal.*` packages.
295-
296-
- **B (single-package infra):** Move every infra and resource façade
297-
class to `com.marketdata.sdk`; drop `public` from every type that
298-
was internal. Refactor `@JsonDeserialize` annotations off response
299-
records and into a programmatic `SimpleModule` registered on
300-
`HttpTransport`'s `ObjectMapper`. Update every test that imports
301-
formerly-internal types to the new package. Update CLAUDE.md to
302-
describe the single-package convention and the package-private
303-
default for non-DTO classes.
284+
Move every infra and resource façade class to `com.marketdata.sdk`, drop `public` from every type that was internal, refactor `@JsonDeserialize` annotations off response records into a programmatic `SimpleModule` registered on `HttpTransport`'s `ObjectMapper` (response records become data-only, decoupled from wire-format logic), and migrate every test that imports formerly-internal types to the new package — tests for package-private types must live in the matching test package. README's package-layout section needs to reflect the new tree.
304285

305286
## References
306287

0 commit comments

Comments
 (0)