Standardize and improve descriptions of intentions/inspections

This commit is contained in:
Alexey Belkov
2018-03-10 13:34:20 +03:00
committed by Mikhail Glukhikh
parent bc7ccbc39b
commit 3b2bbee595
276 changed files with 359 additions and 356 deletions
@@ -1,24 +1,30 @@
<html>
<body>
This inspection reports dangerous operations inside constructors including:
<ul>
<li>Accessing non-final property in constructor</li>
<li>Calling non-final function in constructor</li>
<li>Using 'this' as function argument in constructor of non-final class</li>
<li>Accessing a non-final property in constructor</li>
<li>Calling a non-final function in constructor</li>
<li>Using <b>this</b> as a function argument in a constructor of a non-final class</li>
</ul>
These operations are dangerous because your class can be inherited,
and derived class is not yet initialized at this moment. Typical example:
<code><pre>
and a derived class is not yet initialized at this moment. Typical example:
<br /><br />
<pre>
<b>abstract class</b> Base {
<b>val</b> code = calculate()
<b>abstract fun</b> calculate(): Int
}
<b>class</b> Derived(<b>private val</b> x: Int) : Base() {
<b>override fun</b> calculate() = x
}
<b>fun</b> testIt() {
println(Derived(42).code) <i>// Expected: 42, actual: 0</i>
}
</pre></code>
</pre>
</body>
</html>