Umple User Manual [Previous]  [Next]
The 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 can't 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 intend that the only base language code would 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, and 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. 'expect n' declares that message number n should occur; it is an error if the message does not. This is used in testing to create example cases of message n; an error would be triggered if message n does not appear. 'allow n' is used in the case of errors, to tell the compiler to not actually 'fail', but to report that error as if it was a warning. This is also used in testing to include cases that give message n, without the compiler reporting that it has failed. 'disallow n', where n is a warning, tells the compiler to treat n as if it was an error, and fail the compilation. Some of the above are still under development.
// 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;
// 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]] ) ;