Archive for March 27th, 2009

Towards Side Effectless Assert Statements

Friday, March 27th, 2009

It is a well known rule that assert statements should cause no changes in state outside of them (aka side effects). Until now, you could only check if this rule was followed by visually inspecting the code. In IntelliJ IDEA 9 a new assert statement with side effects inspection will be available to help you keep assert statements free of side effects.

'assert' has side effects warning

The inspection will warn about modification of variables and fields inside of the assert statement. The assert statement will also be reported if a method called by it modifies any fields.

Quick Navigation to Project Structure

Friday, March 27th, 2009

To change settings of a module that hosts the file you are currently editing, just press Alt+F1, 7 or open the View menu, select Select In and click Project Structure.



IntelliJ IDEA will open the Project Structure dialog and jump to the required module.



This action works for files from libraries and JDK, too, and is available in every view that lists files — Project View, Changes tool window and so on.