@Documented @Retention(value=SOURCE) @Target(value=METHOD) public @interface Contract
Method contract has the following syntax:
contract ::= (clause ';')* clause
clause ::= args '->' effect
args ::= ((arg ',')* arg )?
arg ::= value-constraint
value-constraint ::= 'any' | 'null' | '!null' | 'false' | 'true'
effect ::= value-constraint | 'fail'
@Contract("_, null -> null")
- method returns null if its second argument is null@Contract("_, null -> null; _, !null -> !null")
- method returns null if its second argument is null and not-null otherwise@Contract("true -> fail")
- a typical assertFalse method which throws an exception if true
is passed to itpublic abstract String value
public abstract boolean pure
Copyright © 2015 e-Spirit AG. All Rights Reserved. Build 5.1.408