Skip to content

Modernize property code generation and validate generated Java 馃 - #3238

Merged
lwrage merged 1 commit into
masterfrom
3237_modernize_property_code_generation
Sep 17, 2026
Merged

lwrage merged 1 commit into
masterfrom
3237_modernize_property_code_generation

Conversation

@lwrage

@lwrage lwrage commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Fixes #3237

Summary

The property generator used Xtend, had no Maven build, and tested its generated Java only through source-string comparisons. Convert all 27 Xtend sources in the generator, UI handler, and tests to idiomatic Java 21 with JDK collections, and remove obsolete Xtend/Guava collection dependencies and Eclipse wiring.

Modernize the emitted Java with var, pattern matching, expression lambdas, Optional.isEmpty(), and Stream.toList(). Generated blank lines are empty. Add POMs for the three bundles and a tools profile in both aggregators so normal root builds continue to exclude the tools.

All 26 existing exact-output tests now compile their generated sources and imported property sets with --release 21. Six additional tests use the validated models/generatedjava AADL project to load and execute freshly compiled classes, checking:

  • Scalar getters, constant/property references, missing and inapplicable values, defaults, and mode selection.
  • Nested lists and rejection of mutations in property, constant, and record-field lists.
  • Range bounds/delta, imported enumeration and unit conversion, and nested record extraction, equality, hashing, and round-tripping.

The tests use standard Eclipse Xtext testing APIs. Temporary generated source/classes and class loaders are cleaned up after each test.

Validation

mvn -o -T5 -s releng/osate.releng/settings.xml -f tools/pom.xml -Plocal,tools \
  -Dtycho.localArtifacts=default -Dpr.build=true -Dsign=false \
  -Dspotbugs=false -Dcodecoverage=false -Djavadoc=false \
  clean verify
  • Four-project tools reactor passed: 32 tests, zero failures, errors, or skips.
  • Generated-source compilation and runtime tests passed on JDK 21.
  • git diff --cached --check passed.
  • Validation was limited to the requested tools profile; the full root reactor was not used for final PR validation.

Compatibility and dependencies

Generated code targets Java 21. The deliberate behavior change is that Stream.toList() returns unmodifiable lists, including nested lists; callers that need to mutate them must make mutable copies. Exact-output expectations and runtime assertions cover this change. The UI handler compiles, but interactive UI behavior was not exercised.

Based directly on master, with no prerequisite PR or merge-order dependency. The migration is kept in one commit because the source ownership, build wiring, and updated output expectations form one coherent change.

Convert the 27 tools Xtend sources to maintained Java 21 and replace
collection helpers with JDK APIs. Remove obsolete Xtend source paths,
builders, and runtime dependencies from the three tools bundles.

Emit Java with var, pattern matching, expression lambdas, Optional.isEmpty,
and Stream.toList, and keep generated blank lines empty. Generated list
extraction now returns unmodifiable lists, including nested lists.

Add an opt-in Maven tools profile and compile all 26 existing output-test
fixtures with --release 21. Add six runtime tests using validated AADL
models to exercise generated getters, constants, modes, lists, units,
enums, ranges, and nested record round-tripping.

Fixes #3237
@lwrage
lwrage merged commit 61406d1 into master Sep 17, 2026
1 check passed
@lwrage
lwrage deleted the 3237_modernize_property_code_generation branch September 17, 2026 17:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Modernize property code generation and add Maven validation 馃

2 participants