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 3e5f7a3
Browse filesBrowse the repository at this point in the historyBrowse files
feat(#195): Kotlin native typing for the four new origins (cross-port parity)
Kotlin has no metamodel registry of its own (it rides the Java metadata module), so its
#195 work is codegen typing only — mirrors the committed native-typing reference (aff49ce).
- KotlinGenUtil.kt: originGuaranteedNonNull — true iff the field carries origin.aggregate
@agg:any|all|collect (COALESCE-guaranteed non-null: any→false, all→true, collect→[]);
first/computed excluded (stay nullable). Reads own children (ADR-0039/0029).
- KotlinEntityGenerator.kt + KotlinExposedTableGenerator.kt: joined into the projection
data-class + Exposed view-column nullable decision (nullable = !required && !originGuaranteedNonNull),
keeping the read type and the view column consistent (the PR-#80 invariant).
- KotlinPayloadGenerator.kt (the cross-port payload-typing reference): extended the origin
dispatch — @agg:any|all → Boolean, @agg:collect → List<T> (T = @Of element type), new
origin.computed → declared subType (nullable), new origin.first → @Of source type (nullable).
- KotlinPayloadGeneratorTest.kt + KotlinProjectionCompileTest.kt: new tests (payload dispatch
types; projection DTO + Exposed column nullability precision + a real Kotlin compile).
Verified: mvn -pl codegen-kotlin test 282 run / 0 fail, BUILD SUCCESS; compiles under
allWarningsAsErrors; the in-test generated projection compiles. Rides on the committed Java
metadata validation (547c698).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NGQ7oSuNcjhsMHWwZzhBwr
Copy file name to clipboardExpand all lines: server/java/codegen-kotlin/src/main/kotlin/com/metaobjects/generator/kotlin/KotlinExposedTableGenerator.kt
+6-1Lines changed: 6 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -487,7 +487,12 @@ open class KotlinExposedTableGenerator : MultiFileDirectGeneratorBase<MetaObject
487
487
// field.map is always a single jsonb column.
488
488
if (field isObjectField|| field isMapField) continue
489
489
val isPk = field.name in primaryFieldSet
490
-
val nullable =!isPk &&!KotlinGenUtil.isRequiredField(field)
490
+
// #195: an origin.aggregate @agg:any|all|collect view column is COALESCE-guaranteed
491
+
// non-null (any→false, all→true, collect→[]), so it is emitted NON-null even when the
492
+
// field is not @required — keeping the view column consistent with the projection
493
+
// data-class read type ([KotlinEntityGenerator]); the PR-#80 read/write invariant.
494
+
val nullable =!isPk &&!KotlinGenUtil.isRequiredField(field) &&
495
+
!KotlinGenUtil.originGuaranteedNonNull(field)
491
496
val baseSpec =if (field isEnumField) {
492
497
// field.enum → typed Exposed enumerationByName column referencing the
493
498
// generated enum class. Length matches the historical VARCHAR fallback
0 commit comments