[Previous]  [Next] 
|
User Manual [Previous]  [Next] Strictness DirectiveThe strictness directive is used to control certain messages that the Umple compiler may issue. It has five subdirectives that are specified by a second keyword following 'strictness': The first two are 'modelOnly' or 'noExtraCode'. These are used when the programmer or modeller intends not to include base language code, and wants a warning to appear if base language code is found. Base language code is code in a language like Java or PHP that is discovered by Umple but not interpreted in any way. One example is the code in the bodies of methods; however, when parsing a class, any time Umple cannot parse what it finds, it assumes it must be base language code. It just emits the base language code for the base language compiler to deal with. However there are circumstances when the developer does not want this: The developer may be creating a pure model or may want that the only base language code would be in the body of methods. It is advantageous therefore to tell the compiler to raise a warning if it thinks it has found base language code in some other context, since otherwise, an ordinary Umple syntax error may go undetected, until the base language compiler is run on the code.
The second set of subdirectives are 'expect', 'allow' and 'disallow'. These are used to control the effect of certain messages. They are followed by a message number.
The strictness directives take effect on the entire system being built. The code of all Ump files of that system will be subject to the strictness subdirectives. Example// Tell the compiler that error 25 // will appear (and fail if it does not) strictness expect 25; // Tell the compiler that if error 22 // occurs, not to fail the compile. // However, this does not mean that // code can be generated strictness allow 22; // UNDER DEVELOPMENT: The following // is not operational yet // Tell the compiler that base language // code should not appear strictness modelOnly; // Tell the compiler that the only base // language code could be in method bodies // Any other unparsable 'extra code' in classes // will be rejected. strictness noExtraCode; Load the above code into UmpleOnline Syntax// A high level of strictness will cause warnings to be issued when base language code // is found, where it might not have been intended. Strictness can also be used // To either suppress certain messages, or to declare that they should be present. // NOTE: This is currently under development strictness- : strictness  ( [=strictness:modelOnly|noExtraCode|none]  | [[strictnessMessage]]  | [[strictnessDisableAuto]]  ) ; strictnessMessage : [=message:allow|ignore|expect|disallow] [messageNumber] strictnessDisableAuto : disable [**expression] |