Fix some 'code smells' and code duplications found by SonarQube.
Note that I "undeprecated" some constructors. Unlike visit methods which must no longer be used after some api version, for correctness, these deprecated constructors can still be used without any issue, and can actually be useful.