Please use the Apache issue tracking system for new NetBeans issues ( !!
Bug 239487 - Improve comment handling for hints and refactorings
Improve comment handling for hints and refactorings
Product: java
Classification: Unclassified
Component: Source
PC Linux
: P2 (vote)
: 8.0.1
Assigned To: Svata Dedic
Depends on: 245348
Blocks: 165451 230832 239609 241883 241969 242152 243035 244170 244174 245103 245318
  Show dependency treegraph
Reported: 2013-12-13 19:25 UTC by Svata Dedic
Modified: 2014-07-17 02:17 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT


Note You need to log in before you can comment on or make changes to this bug.
Description Svata Dedic 2013-12-13 19:25:15 UTC
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.
Comment 1 Jesse Glick 2013-12-13 19:40:47 UTC
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.
Comment 2 _ gtzabari 2014-02-01 04:40:56 UTC
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?
Comment 3 _ gtzabari 2014-03-05 14:36:36 UTC

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.
Comment 4 Svata Dedic 2014-07-10 14:00:07 UTC
Adapted to API changes introduced by issue #245348 in jet-main#dc9a3b874239
Comment 5 Quality Engineering 2014-07-17 02:17:51 UTC
Integrated into 'main-silver', will be available in build *201407170001* on (upload may still be in progress)

User: Svata Dedic <>
Log: #239487: code adapted to API change introduced by #245348

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo