Fix numerous warnings reported by IDEA
This merge request contains a collection of mostly automatic fixes to issues detected by IDEA's integrated linter. This doesn't address all the issues - I'm still working another request that covers the problems with generic types.