blob: 24d6f9c6212ce550dd538cd4c80b66cb3d70d84e [file] [log] [blame]
<html><body>
This intention changes a library method contract.
Method contract has the following syntax:<br/>
contract ::= (clause ';')* clause<br/>
clause ::= args '->' effect<br/>
args ::= ((arg ',')* arg )?<br/>
arg ::= value-constraint<br/>
value-constraint ::= 'any' | 'null' | '!null' | 'false' | 'true'<br/>
effect ::= value-constraint | 'fail' | 'exit'<p/>
The constraints denote the following:<br/>
<ul>
<li> _ - any value
<li> null - null value
<li> !null - a value statically proved to be not-null
<li> true - true boolean value
<li> false - false boolean value
<li> fail - the method throws exception, if the arguments satisfy argument constraints
<li> exit - the method terminates the current process, if the arguments satisfy argument constraints
</ul>
Examples:<p/>
<code>@Contract("_, null -> null")</code> - method returns null if its second argument is null<br/>
<code>@Contract("_, null -> null; _, !null -> !null")</code> - method returns null if its second argument is null and not-null otherwise<br/>
<code>@Contract("true -> fail")</code> - a typical assertFalse method which throws an exception if <code>true</code> is passed to it<br/>
</body></html>