Patches for GROOVY-7048  and GROOVY-7049, refactorings

Hi,
so this PR includes many refactorings, tiny fixes for bugs for which the symptom did not occur often.
I reduced just the most common codenarc warnings like Unnecessary GString. So these refactorings are broing to review, but not complex (I did not move code around between classes).

A larger effort went into refactoring regexp code, which was implemented in a very wasteful way. Whether this gives a noticeable performance boost (e.g. for completion candidates) i don't know.

If you insist, I can try to make smaller PRs out of this, like leaving the refactorings that spanmany files for another time.
As far as I know no interface in the Groovy codebase use the "I" prefix. For consistency it would be better to call the interface just PackageHelper.