Separate out builder/impl copy generators
Builders are taking an immutable implementation of target type,
hence for list entries they can rely on the key to be present and
do not have to check it. Implementations need to account
for the builder key being set to null, hence they need to
instantiate the key themselves.
This patch separates the two code paths, so both cases are properly
expressed in the object hierarchy. This allows us to simplify
the abstract template, removing weird boolean-based decisions.
We also promote implementation constructor to package-visible, which
allows javac to skip generation of synthetic accessor.
We further optimize the template output by capturing importedNames
when they are reused -- leading to xtend generating cleaner Java code.
JIRA: MDSAL-374
Change-Id: I3274e35780b8e6a56d470caf80459e9e115a5374
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>