Commit 9b8ecf7
committed
fix(jvm): ADR-0039 own-accessor sweep — remaining non-sanctioned own reads (Java + Kotlin)
Second-pass ADR-0039 sweep over the JVM tree (metadata, codegen-spring,
codegen-kotlin, omdb, core-spring): find every remaining own-only read, flip
the ones that read an INHERITABLE effective value/member set (bugs — extends is
a super-reference, so own drops inherited members), and comment every read that
is legitimately own.
BUGs flipped (own -> resolving):
- Kotlin controller/relations/m2m/exposed-table: identity + relationship member
iteration was reading entity.children (own) via filterIsInstance — flipped to
entity.getIdentities(true) / entity.relationships (identities & relationships
ARE inheritable; an entity inheriting its PK identity or a relationship from a
BaseEntity was silently dropped). Sites: KotlinSpringControllerGenerator PK,
KotlinRelationsGenerator (manyRels, reverseFks, primaryKeyKotlinType),
KotlinM2mSupport.primaryKeyField, KotlinExposedTableGenerator (composition FK +
identity.reference decorations), KotlinPayloadGenerator @via relationship.
- KotlinStoredProcGenerator: @param (field) and @proc/@table/@procname (source)
were own — flipped (@param is an inheritable field property; source attrs are
inheritable).
- SpringRenderHelperGenerator.resolveNestedObjectRef: field @objectref was own —
flipped (matches TS render-helper's resolving field .attr() and the already-
resolving Kotlin sibling).
- M2MFields (shared codegen+runtime M:N FK derivation): junction
identity.reference iteration and @references read were own — flipped to the
resolving getIdentities()/getMetaAttr, matching the TS reference whose
referenceIdentities() builds on the resolving identities() ("effective view,
own + inherited"). Own would mis-derive M:N FK direction for an inherited
junction reference.
- MetaSource.getPhysicalName: @proc/@table aliases were own — flipped to
resolving, matching getTableName()/getEffectiveKind()/getRole() and the C#
port's ADR-0039 resolving PhysicalName.
KEPT own + commented (sanctioned):
- template.* attr getters (MetaTemplate/OutputTemplate/PromptTemplate/
ToolcallTemplate + render-helper/api-model @kind reads): templates read own by
cross-port contract (TS/C# use ownAttr/OwnAttr) — a template's declared refs
are authored-here, not inherited.
- origin.* reads (KotlinPayloadGenerator field.children<MetaOrigin>): origin
NEVER inherits (ADR-0029).
- declaration-layer markers: @isAbstract (IOUtil/CanonicalJsonSerializer/
KotlinGenUtil), TPH @discriminator/@discriminatorValue (TphPlan/KotlinTphPlan/
TphHelper), @provided (Fr019SharedEnum) — describe THIS declaration, never
inherited.
- @dbColumnType stays the physical own-only exception (validation site commented;
the JVM type-mappers already resolve it in the codegen role, matching TS
column-mapper — schema/migrate is TS-owned so no own-only schema reader exists
on the JVM).
- root-level scans (MetaRoot.objects/fields/findObject, SymbolTable,
Spring/omdb M2M findEntity, root.children template scans): root is never
extended — own is the complete set (matches TS root.ownChildren()).
- super-resolution walks (MetaObject.getSources per-hop, discriminatorRoot) and
the ValidationPhase structural tree-recursion + validate-own-declaration attr
reads (class-level policy comment) + parser source-tagging.
Verification: Java metadata 1065, codegen-spring 158, omdb/core-spring 74,
Kotlin codegen 266, Java + Kotlin Testcontainers integration suites all green.
No golden/snapshot changed (only *.java/*.kt sources touched) — the flips only
affect INHERITED members, which no existing fixture exercised on these paths.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GF9xLEQZaPus5Y6opk398n1 parent cc4b4fd commit 9b8ecf7
35 files changed
Lines changed: 209 additions & 46 deletions
File tree
- server/java
- codegen-kotlin/src/main/kotlin/com/metaobjects/generator/kotlin
- apidocs
- codegen-spring/src/main/java/com/metaobjects/generator
- apidocs
- spring
- metadata/src/main/java/com/metaobjects
- io
- json
- util
- loader
- parser/json
- validation
- object
- relationship
- source
- template
- validation
- omdb/src/main/java/com/metaobjects/manager/db
Lines changed: 5 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
65 | 69 | | |
66 | 70 | | |
67 | 71 | | |
| |||
Lines changed: 6 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
843 | 843 | | |
844 | 844 | | |
845 | 845 | | |
846 | | - | |
847 | | - | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
848 | 849 | | |
849 | 850 | | |
850 | 851 | | |
| |||
1016 | 1017 | | |
1017 | 1018 | | |
1018 | 1019 | | |
1019 | | - | |
| 1020 | + | |
| 1021 | + | |
| 1022 | + | |
1020 | 1023 | | |
1021 | 1024 | | |
1022 | 1025 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
| 74 | + | |
| 75 | + | |
74 | 76 | | |
75 | 77 | | |
76 | 78 | | |
| |||
Lines changed: 6 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
60 | 61 | | |
61 | 62 | | |
62 | 63 | | |
| |||
Lines changed: 3 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
111 | | - | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
112 | 114 | | |
113 | 115 | | |
114 | 116 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
| 84 | + | |
| 85 | + | |
84 | 86 | | |
85 | 87 | | |
86 | 88 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
| 77 | + | |
| 78 | + | |
77 | 79 | | |
78 | 80 | | |
79 | 81 | | |
| |||
Lines changed: 7 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| 66 | + | |
| 67 | + | |
66 | 68 | | |
67 | 69 | | |
68 | 70 | | |
| |||
148 | 150 | | |
149 | 151 | | |
150 | 152 | | |
| 153 | + | |
| 154 | + | |
151 | 155 | | |
152 | 156 | | |
153 | 157 | | |
| |||
300 | 304 | | |
301 | 305 | | |
302 | 306 | | |
303 | | - | |
304 | | - | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
305 | 310 | | |
306 | 311 | | |
307 | 312 | | |
| |||
Lines changed: 9 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
73 | | - | |
74 | | - | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
75 | 76 | | |
76 | 77 | | |
77 | 78 | | |
| |||
233 | 234 | | |
234 | 235 | | |
235 | 236 | | |
236 | | - | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
237 | 240 | | |
238 | 241 | | |
239 | 242 | | |
| |||
258 | 261 | | |
259 | 262 | | |
260 | 263 | | |
261 | | - | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
262 | 267 | | |
263 | 268 | | |
264 | 269 | | |
| |||
Lines changed: 11 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
| 82 | + | |
| 83 | + | |
82 | 84 | | |
83 | 85 | | |
84 | 86 | | |
| |||
254 | 256 | | |
255 | 257 | | |
256 | 258 | | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
257 | 262 | | |
258 | 263 | | |
259 | 264 | | |
| |||
294 | 299 | | |
295 | 300 | | |
296 | 301 | | |
297 | | - | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
298 | 307 | | |
299 | 308 | | |
300 | 309 | | |
| |||
303 | 312 | | |
304 | 313 | | |
305 | 314 | | |
306 | | - | |
| 315 | + | |
307 | 316 | | |
308 | 317 | | |
309 | 318 | | |
| |||
0 commit comments