Checking Project Syntax
It is important to check the syntax of the project before generating code from the model. This will inform you of any problems which prevent code from being generated. Project syntax can be checked from the menu command Project | Check Project Syntax (alternatively, press F11). A syntax check will also be performed automatically before code is updated from the model. The results (errors, warnings, and information messages) are reported in the Messages window.
When a syntax check is performed, the project file is checked on multiple levels as detailed in the tables below. Note the following:
•For information about solving common syntax errors, see the Code generation prerequisites.
•For components, the checks below are performed only if the use for code engineering property is enabled for the component in the Properties window.
•For classes, interfaces, and enumerations, the checks below are performed only if the class, interface, enumeration is contained in a code language namespace. In other words, it must be under a package which has been defined as namespace root.
•Constraints on model elements are not checked, as they are not part of the code generation process, see Constraining Elements.
Level | Checks if... | Error severity if check fails |
---|---|---|
Project | ...at least one namespace root package exists. | Error |
Component
| ...project file or directory is set. | Error |
...this component has a ComponentRealization relation with at least one class or interface. | Error | |
Class | ...code file name is set.
Note: This check is not applicable for nested classes. | Error if the option Generate missing code file names is not set in Tools | Options | Code Engineering tab. Warning if the option is set. |
...type for operation parameter is set. | Error | |
...type for properties is set. | Error | |
...operation return type is set. | Error | |
...duplicate operations (names + parameter types) exist. | Error | |
...a ComponentRealization relation exists to a component.
Note: This check is not applicable for nested classes. | Warning | |
...name is valid (no forbidden characters, name is not a keyword) | Error | |
...multiple inheritance occurs | Error | |
Class operation | ...name is valid (no forbidden characters, name is not a keyword) | Error |
...a return parameter exists. | Error | |
Class operation parameter | ...name is valid (no forbidden characters, name is not a keyword) | Error |
...type is valid | Error | |
Interface | ...code file name is set. | Error if the option Generate missing code file names is not set in Tools | Options | Code Engineering tab. Warning if the option is set. |
...interface is contained in a code language namespace. | Error | |
...type for properties are set. | Error | |
...type for operation parameters are set | Error | |
...operation return type is set | Error | |
...duplicate operations (names + parameter types) | Error | |
...interfaces are involved in a ComponentRealization | Warning | |
...name is valid (no forbidden characters, name is not a keyword) | Error | |
Interface operation | ...name is valid (no forbidden characters, name is not a keyword) | Error |
Interface operation parameter | ...name is valid (no forbidden characters, name is not a keyword) | Error |
Interface properties | ...name is valid (no forbidden characters, name is not a keyword) | Error |
Package | ...name is valid (no forbidden characters, name is not a keyword)
Note: This check is applicable if the package is inside a namespace root package and has the <<namespace>> stereotype applied to it from the Properties window. | Error |
Enumeration | ...a ComponentRealization relation exists to a component. | Warning |