JetBrains/kotlin — pull request #424 by zgrannan (2014-03-24 12:21:08+00:00)
Title: KT-4556 Intention to convert between "!!" and if

This PR adds the following two intention actions:

***DoubleBangToIfThenIntention***

Converts an expression using '!!' to an if-then expression that throws a `NullPointerException`
if the base expression is null.

The intention prompts the user to choose between a `NullPointerException` and a
`KotlinNullPointerException`. If the user chooses to use `NullPointerException`, then
an appropriate argument is passed to the constructor indicating that the base expression
was null. Additionally, if the base expression is not a stable variable, then it is
extracted to a value for use in the if expression.

***IfThenToDoubleBangIntention***

Converts an if-then expression to an expression using '!!' (if applicable)

This intention will convert an if-then expression to an '!!' intention if the
if-then intention compares an expression to `null`, and returns the expression
if the expression is not null, and throws some Exception otherwise. If the exception thrown
is not an instance of `NullPointerException` or `KotlinNullPointerException`, or if there is
any argument passed to the Exception constructor, then the intention text is changed to warn
the user that their exception will be overwritten if the intention is applied.

Additionally, if the expression checked against null is only used in the if-then expression,
then the intention will prompt the user to inline the expression after converting the
if-then expresion to a '!!' expresion.