/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2016 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
/**
* Specifies some aspects of the method behavior depending on the arguments. Can be used by tools for advanced data flow analysis.
* Note that this annotation just describes how the code works and doesn't add any functionality by means of code generation.<p>
- *
+ *
* Method contract has the following syntax:<br>
* contract ::= (clause ';')* clause<br>
* clause ::= args '->' effect<br>
* arg ::= value-constraint<br>
* value-constraint ::= 'any' | 'null' | '!null' | 'false' | 'true'<br>
* effect ::= value-constraint | 'fail' <p>
- *
+ *
* The constraints denote the following:<br>
* <ul>
* <li> _ - any value
* <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>
- *
+ *
*/
@Documented
@Retention(RetentionPolicy.CLASS)
-@Target(ElementType.METHOD)
+@Target({ElementType.METHOD, ElementType.CONSTRUCTOR})
public @interface Contract {
/**
- * Contains the contract clauses describing causal relations between call arguments and the returned value
+ * Contains the contract clauses describing causal relations between call arguments and the returned value
*/
String value() default "";