see discussion in issue #237072; currently one must use GeneratorUtilities to import comments, then manually copy comments from Trees being replaced to new trees.
To improve behaviour in hints, comments should be imported automatically for HintContext.getPath() subtree (if the hint modifies something else, it still needs to import the other locations).
Comments should be automatically copied from a tree being replaced to the replacement ("comments should not disappear").
There should be a way how to 'alias' nodes which are not directly replaced, to indicate the node is a transformed original one. This is stronger than just copying the source comments to the target as it allows the infrastructure to also collect comments from the obsolete subtree and preserve them in the source. All the above will allow not to loose comments.
As noted in issue #237072 comment #22, I have seen a class annotation get deleted during Introduce Comment, so this may not be limited to comments.
The "Add Constructor" hint deletes the class Javadoc as of build 201401270001. Should I file a separate bug report or will you fix it as part of this issue?
Guys, we've been experiencing data loss due to this bug for over 2 releases now. If you avoid fixing it for 8.0, then please please please make it a must-fix in the subsequent release.
Adapted to API changes introduced by issue #245348 in jet-main#dc9a3b874239
Integrated into 'main-silver', will be available in build *201407170001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
User: Svata Dedic <email@example.com>
Log: #239487: code adapted to API change introduced by #245348