| Summary: | Java generator produces bad code for array attributes of non-basic types in DataClasses | ||
|---|---|---|---|
| Product: | [Modeling] eTrice | Reporter: | Klaus Birken <klaus.birken> |
| Component: | Generators | Assignee: | Project Inbox <etrice.generators-inbox> |
| Status: | CLOSED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | hrr |
| Version: | 0.1.0 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows XP | ||
| Whiteboard: | 0.2.0M1 | ||
This is already fixed in the mail line of the development (when the new types were introduced). But a closer look at DataClass (with inheritance) generation lead to a number of fixes and improvements (see commit 40ff55bc1e31c1ec8a70f396af371b44f6ae8b11). Thanks for reporting this. If you want to pick up the changes you have to use our nightly builds from http://download.eclipse.org/etrice/updates/nightly closing bugs that went into 0.2.0M1 |
Non-basic array attributes in a DataClass will lead to bad Java code. Example: DataClass ExampleSimple { Attribute a : int16 } DataClass ExampleArrayDerived { Attribute val [ 19 ] : ExampleSimple } From the above model, the Java generator produces // default constructor public ExampleArrayDerived() { val = new ExampleSimple(); // !! Type mismatch: cannot convert from ExampleSimple to ExampleSimple[] } // deep copy public ExampleArrayDerived deepCopy() { ExampleArrayDerived copy = new ExampleArrayDerived(); copy.val = val.deepCopy(); // !! Cannot invoke deepCopy() on the array type ExampleSimple[] return copy; } This code is not compilable (see comments with the compiler's error messages).