Repository navigation
feat: JVM init goal, int-backed enum arrays, full view expressions - #626
Merged
Merged
Conversation
…e files in the layout ratchet CodeWriter.describe and JavaWriter.simpleName follow the spec rule that writer methods are public or protected, never private. The layout analyzer now throws when javac reports a syntax error, so a generator file that does not parse is never counted as clean.
Ports the rc.21 view vocabulary to the JVM loader (and so Kotlin): the typed function set beside coalesce, cast with dbColumnType spellings, int-stored enum casts, origin.function validation, union and grain checks, and path operands in correlated filters. The five conformance fixtures the Java ledger excused now pass and the ledger is empty.
A quoted value on a string attribute (column: "007") was inferred as the integer 7. Quoted text is now never inferred, matching every other port, and the YAML conformance ledger is empty. Also records the C1 and C6 fixes in the changelog.
An int-backed field.enum array stores each member as its declared integer: a native integer[] on Postgres, a JSON array of numbers in a text column on SQLite, MySQL and Derby. A member with no declared integer is refused on write and a stored integer with no member fails the read. The shared roundtrip-int-enum-array scenario now runs on Postgres, SQLite and MySQL in the Java lane, so its deferral is gone.
…m arrays An isArray field.enum with an @intValueMap now gets portableIntEnumArray: a native INTEGER[] on Postgres and a JSON array of numbers on SQLite and MySQL, with the symbol-to-integer mapping inlined as when expressions. The column type goes in its own MetaIntEnumArrayColumnType.kt support file, written only into a package that has such a column. The roundtrip-int-enum-array scenario runs in the Kotlin lane, the compile gates no longer leave out the IntEnumArray tier, and the docs and known-gaps entry say what is left (string-backed enum arrays).
mvn metaobjects:init writes the port-neutral .metaobjects/config.json and an empty loadable metaobjects/meta.app.json, each only when missing, and prints the plugin entry to add to the pom with an empty generators list. -Dmeta.init.withDocs=true is the opt-in that adds the api reference generator to the printed entry. It never edits the pom.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What Changed
metaobjects:initgoal. Writes.metaobjects/config.jsonand an empty, loadablemetaobjects/meta.app.json, each only when missing. Prints the<plugin>entry to add to the pom with an empty<generators/>; it never editspom.xml.-Dmeta.init.withDocs=trueadds the api reference generator to that printed entry.field.enumarrays persist as their declared integers. OMDB writes a nativeinteger[]on Postgres and a JSON array of numbers ([5,0]) on SQLite, MySQL and Derby, where it used to refuse the field. The Kotlin Exposed generator emits aportableIntEnumArraycolumn plus aMetaIntEnumArrayColumnType.ktsupport file, replacing a scalar column that did not compile. String-backed enum arrays are unchanged and still lack an Exposed array column.ExpressionAttributeandValidationPhasenow check every view function andcastthe way the TypeScript port does, and quoted number-like text (for example"007") stays a string instead of being read as a number. The layout ratchet test helper also fails on unparsable files, and two writer helpers incodegen-baseare nowprotected.Validation
Risk Assessment
✅ Low: The change is bounded and consistent with the lane intent (JVM loader parity, OMDB/Exposed int-backed enum arrays, init goal). I traced the code paths and found no wrong-result defects; the conformance ledgers are emptied only where the new code covers the fixtures. Remaining items are minor doc, duplication and test-oracle nits.
Testing
Drove the Java and Kotlin lane changes against the real product code in-process: D7 Maven init goal across four disposable project shapes, C1 and C4 Java loader on corpus fixtures plus adversarial YAML, and C6 Kotlin int-enum-array generation plus a successful compile of the emitted tree. All three driven scenarios pass with live transcripts. The OMDB int-array persistence half of C6 was not driven live (needs a Postgres roundtrip) and is reported untested. The configured affected-lane command passed at this commit and was not re-run. Verdict go on the driven scope.
Evidence: D7 maven init goal transcript (live InitMojo runs)
Evidence: C1/C4 Java loader transcript (live loader on fixtures and adversarial YAML)
Pipeline
Updates from git push no-mistakes
✅ **Intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
server/java/codegen-kotlin/src/main/kotlin/com/metaobjects/generator/kotlin/KotlinExposedTableGenerator.kt:335- Pass comments were misordered by the new loop. The new int-enum-array support-file loop was inserted directly under the existing '// Pass 3f: ONE shared MetaDurationColumnType.kt ...' comment, so that comment described the wrong loop. Fixed inline: the new loop now has its own '// Pass 3g' comment and the 3f comment sits above the duration loop. Comment-only change.docs/features/field-types.md:252- The parenthetical '(Python on SQLite and MySQL is the one place that still does.)' reads as if Python writes member symbols there. docs/ports/python.md says those engines store no enum array of either kind (Postgres-only). Reword to say that, or drop the parenthetical. Not edited inline because the sentence wraps across lines in the file.server/java/metadata/src/main/java/com/metaobjects/loader/ValidationPhase.java:503- originStringList (MetaOrigin) duplicates ownStringList (MetaData) line for line. MetaOrigin is a MetaData, so one helper serves both; the origin one can delegate or be deleted.server/java/maven-plugin/src/test/java/com/metaobjects/mojo/InitMojoTest.java:25- The comment, CHANGELOG and docs say the scaffold config is identical to what every other port's init writes. InitMojoTest checks only the Java constant's own substrings, so a drift from the TS/C# init output would pass. The C# init builds the same JSON from shared constants. A test that compares against a cross-port expected value, or a shared fixture, would be an independent oracle.✅ **Test** - passed
✅ No issues found.
scripts/ci-local.sh --affected --strict-toolchainsBaseline (given):scripts/ci-local.sh --affected --strict-toolchainspassed at 168ff8dc77; broad regression came from that configured test command with its passing outcome. No source or test files changed in this turn, so the command was not re-run.Offline dependency classpaths:mvn -o -q -f server/java/<module>/pom.xml dependency:build-classpathfor metadata, maven-plugin, codegen-kotlin (outputs in scratch).Maven init goal driven live: javac-compiled driver calling InitMojo.execute() with baseDir/withDocs set, run in 4 disposable project dirs (fresh, rerun, existing config, pom present + docs opt-in); sha256 check of kept files; Java loader load of the scaffolded metaobjects/ dir.Java loader driver (MetaDataLoader.fromDirectory, CanonicalJsonSerializer) on fixtures/conformance/projection-view-vocabulary-rc21, error-computed-cast-enum-not-int-stored, fixtures/yaml-conformance/yaml-quoted-leading-zero, and inline quoted/unquoted YAML adversarial inputs.Kotlin generators (KotlinEntityGenerator, KotlinExposedTableGenerator) run via Java driver on codegen-kotlin test model enum-int-backed-array against reactor target/classes; generated tree compiled with kotlin-compiler 2.0.21 K2JVMCompiler, Exposed 0.55.0 and kotlinx-serialization-core 1.7.3 on the classpath.Scratch under DEV_SCRATCH removed; worktree git status clean.docs/features/field-types.md:250- docs/features/field-types.md said Python on SQLite and MySQL writes member symbols for int-backed enum arrays. Python's codec encodes ints element-wise on every dialect and has no SQLite/MySQL array path, so the claim was wrong. Reworded to point at the port page without asserting a refusal.docs/CONFORMANCE.md:96- docs/CONFORMANCE.md said there were two ledgered YAML fixtures and pointed at a_commentin each port's ledger. Java's YAML ledger is now empty and its note is gone. Reworded to cover the C# and Rust ledgers.docs/features/cli.md:42- docs/features/cli.md repeated the init settings list that docs/ports/java.md owns. Reduced the cli.md row to a short pointer to the Java port page.server/java/maven-plugin/src/main/java/com/metaobjects/mojo/InitMojo.java:34- InitMojo Javadoc citedmvn metaobjects:generate --list, which does not exist (no list parameter on the goal). Pointed it at the generator catalog in docs/ports/java.md.✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.