This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Created attachment 141034 [details] testcase Product Version: NetBeans IDE Dev (Build 201310070001) Java: 1.7.0_40; Java HotSpot(TM) 64-Bit Server VM 24.0-b56 Runtime: Java(TM) SE Runtime Environment 1.7.0_40-b43 System: Windows 7 version 6.1 running on amd64; Cp1252; en_CA (nb) User directory: C:\Users\Gili\AppData\Roaming\NetBeans\dev Cache directory: C:\Users\Gili\AppData\Local\NetBeans\Cache\dev 1. Open testcase. 2. Open com.mycompany.organizemembersbugs.Test 3. Click the hint on line 15 "Organize members" 4. Notice that Netbeans deletes the Javadoc from line 9 through 11. Setting priority to P1 because this bug causes data loss. I didn't notice this problem until I had already processed many files and now I have to recover the Javadoc from history.
the data loss is recoverable - since it is a hint, editor's Undo be used. In the worst case, the user may recover the data from the local history. Other comment-loosing defects are also filed as P3.
Fixed in http://hg.netbeans.org/jet-main/rev0f9781dc0eb4
Canidate for a 7.4 patch? This issue is really annoying.
7.4 shouldn't have shipped with this bug (which again, I consider a P1). It seems that *any* hint that transforms the code deletes the Javadoc of code it touches. For example, the "Change type of X to long" hint does the same. I reproduced this with 7.4 final, not a dev build. Please fix this in 7.4 as soon as possible.
*** Bug 235161 has been marked as a duplicate of this bug. ***
Integrated into 'main-silver', will be available in build *201310240001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-silver/rev/0f9781dc0eb4 User: Svata Dedic <sdedic@netbeans.org> Log: #237072: original javadoc copied to copied members
There seems to be regressions after the fix: 1) Calling Organize Members from hint causes an empty line to be inserted between a declaration and it's javadoc comment 2) Calling Organize Members from menu causes that some javadoc comments are duplicated
Based on the time remaining to patch1 deadline, and the side effects discovered by testing, I would prefer NOT to fix it as a part of patch1. I'll try to solve it along with other comment-affecting defects for 8.0
svata, I recommend simply disabling Organize Members in patch 1. This functionality causes data loss and should be disabled until it is fixed properly.
Related to https://netbeans.org/bugzilla/show_bug.cgi?id=238372 ?
As noted in #229590, I think it is a broad range of refactorings which are affected, so just disabling them is not a realistic option. Still annoying me, but not a critical problem now that I am aware of its existence; I always run a local diff before I commit so I notice when Javadoc goes missing and can easily revert the deletion. Would not help if the Javadoc were added since the last commit of course.
(In reply to Jesse Glick from comment #11) > Still annoying me, but not a critical problem now that I am aware of its > existence; I always run a local diff before I commit so I notice when > Javadoc goes missing and can easily revert the deletion. Would not help if > the Javadoc were added since the last commit of course. BTW: I do the same before pushing my changes. A self-code-review to minimize the diff hunks. BUT all the other NB users (at companies/schools/universities) aren't aware of this bug. IMHO this issue is still critical because it removes "important" content from the sources.
So I would delay patch1 until this issue can be fixed properly. It is really critical to get this right.
(In reply to _ gtzabari from comment #13) > So I would delay patch1 until this issue can be fixed properly. It is really > critical to get this right. I understand considerations about schools / dev teams - but the issues with deleting javadoc is present for years in many kind of hints / refactorings. If's not reasonable to delay a patch to fix issues that have been present 2-3 releases back. Note: this particular defect was attempted to fix, but the fix was inappropriate; 7.4 behaviour should be better than dev.
Perhaps that's true, but I've never run into this kind of data-loss before in a public release. I guess we can agree to disagree, but I consider this bug to be a show-stopper (7.4 should have been delayed, had we caught this in time). Anyway, I've stated my 2 cents :) so I'll leave it at that. I'll be fine with whatever decision you make.
(In reply to _ gtzabari from comment #15) > Anyway, I've stated my 2 cents :) so I'll leave it at that. I'll be fine > with whatever decision you make. We will release Patch 1 on-time, beside that I would like to try to fix this (along with other refactoring deleting javadoc issues) as soon as possible and if it's ready to be shipped as another patch for 7.4 we will do so.
(In reply to Stepan Zebra from comment #7) > There seems to be regressions after the fix: > 1) Calling Organize Members from hint causes an empty line to be inserted > between a declaration and it's javadoc comment > 2) Calling Organize Members from menu causes that some javadoc comments are > duplicated Stepan: could you please provide a testcase for duplicating comments ? I was able to reproduce the (1) - but I am not sure if I observed the same behaviour as you: the javadoc comment was shifted one line up (previous blank line deleted, one blank inserted between javadoc and its declaration).
(In reply to Svata Dedic from comment #17) > (In reply to Stepan Zebra from comment #7) > > There seems to be regressions after the fix: > > 1) Calling Organize Members from hint causes an empty line to be inserted > > between a declaration and it's javadoc comment > > 2) Calling Organize Members from menu causes that some javadoc comments are > > duplicated > > Stepan: could you please provide a testcase for duplicating comments ? I was > able to reproduce the (1) - but I am not sure if I observed the same > behaviour as you: the javadoc comment was shifted one line up (previous > blank line deleted, one blank inserted between javadoc and its declaration). Using the attached project, I can reproduce it by opening AppTest.java and invoking Source > Organize Members without moving the text cursor anywhere (it's on 1:1) and in Test.java when I put the text cursor to the beginning of the inner class (14:4) and invoke Source > Organize Members twice.
I've changed internals of copy comments so that duplicates are ignored. Should be safe & backwards compatible. Fixed in rev. Note - the AppTest from the attached example is wrongly indented with respect to the formatting settings. If you run Org.Members on it, it will misformat javadoc comments. Once the source formatting is cleaned up (Alt-shift-F), org. members will work OK. Fixed in rev. http://hg.netbeans.org/jet-main/rev/e841b05ec1a5
verified in trunk
Grafted into 7.4 as #7884effdb6f4 and #65f576a409ae
Is this really supposed to be fixed? Still broken in 20131211-ca7d20f516e1. Move Method, Introduce Constant, etc. delete class Javadoc (and annotations).
Just the organize members case should be fixed. The problem is more general as you note in comment #11, and is likely to be fixed for 8.0, although it is not safe (according to some preliminary implementation) to backport to 7.4
Svata, Are you saying that this is fully fixed in the 8.0 branch, but only part of the fix was backported to 7.4? Or are you saying that there is outstanding work to fix it in 8.0 as well?
Sorry for not being clear; the 'Organize Members' effects on comments are supposed to be fully fixed for 8.0 AND backported to 7.4. This is what the orginal report was about, as well as comments #1-11,13-21. There's potentially a lot of hints, refactorings or other code transformations that break or erase the comments, as one must specifically care about carrying the comments to the changed code. Filed a separate issue #239487 to address the general behaviour.
Integrated into 'releases/release74', will be available in build *201403261440* or newer. Wait for official and publicly available build. Changeset: http://hg.netbeans.org/releases/rev/7884effdb6f4 User: Svata Dedic <sdedic@netbeans.org> Log: #237072: original javadoc copied to copied members