SI-7321 memory leak in SpecializeTypes.

Currently the map is declared LinkedHashMap, whiich doesn't align
with other caching maps. Such map is only needed to ensure
deterministic order on the generated specialized classes. The same
can be accomplished by manually sorting generated classes.

While refactoring I noticed some differences with the proposed code
style, like e.g. importing way too many members from Definitions,
instead of a single wildcard import. Such aggressive refactoring is not
mergeable with 2.10.x, so I plan for a more minimalistic PR for 2.10
branch.