itemisCREATE / statecharts

YAKINDU Statechart Tools (http://www.statecharts.org)
Eclipse Public License 1.0
174 stars 84 forks source link

Rework naming setting/defaults in Java code generator #3157

Closed tkutz closed 4 years ago

tkutz commented 4 years ago

The Java code generator defines certain defaults and naming logic that does not always work as expected. We should simplify it, and maybe even clean up the generator model in the regards.

For a simple statechart there are three files generated:

  1. IStatemachine.java (Lib)
  2. ISimpleStatemachine.java (API)
  3. SimpleStatemachine.java (Impl)

Current behavior: package naming

Default

Using Naming.basePackage

Using Naming.implementationSuffix

Using statechart namespace

Current behavior: file naming

Proposal: package naming (as discussed with ATE)

Default

** Use explicit package naming features:

Using statechart namespace will add the namespace to the package name

Using Naming.implementationSuffix

Proposal: file naming

Also relevant when changing this, is to change the default statechart name in the new statechart wizard to Statechart.sct, as the current name default.sct is already a Java keyword and would generate invalid code now.

Together with these changes we can add the following generator model validation rules:

tkutz commented 4 years ago

See also https://github.com/Yakindu/statecharts/issues/2635 https://github.com/Yakindu/statecharts/issues/1000

tkutz commented 4 years ago

@terfloth let's define the desired behavior