Fix a problem where deleting last import directive via "optimize imports" could lead to incorrect psi structure resulting in CCE, see EA-64291
New imports are inserted at the head (after package directive if present) of the file (before any comments) if no imports were present
Add test for inserting import to file where a first statement is a comment
Drop code dealing with non-existing import list in ImportInsertHelperImpl
AbstractQuickFixTest: check for unexpected actions before changes to the file are made as it relies on the first line having specific format
It's needed for better recovering for cases of changes like 'class' -> 'object'
The only sensible case when it's may be bad:
class A {
object B
constructor() : super()
}
But it seems to be rare, and ';' can be used to separate object from secondary ctor