Fix capturing outer this in some cases in JVM codegen

When property initializer of some inner entity (e.g. anonymous object) contains
a reference to some outer entity (say, a property of the outer class), we need
to make sure we called "lookupInContext" on this entity's owner class, so that
"setCaptureThis" was called on the appropriate closure

 #KT-4176 Fixed
Add regression test for outdated issue

 #KT-3738 Obsolete
Minor refactorings in codegen contexts

Add assertions, nullability annotations, fix formatting, etc.