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.

Bug 203184 - Organize imports removes classes referenced by Javadoc
Summary: Organize imports removes classes referenced by Javadoc
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 7.1
Hardware: PC Windows 7
: P2 normal (vote)
Assignee: Dusan Balek
URL:
Keywords: USABILITY
Depends on:
Blocks:
 
Reported: 2011-10-06 00:46 UTC by _ gtzabari
Modified: 2012-03-24 11:02 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Testcase (13.97 KB, application/octet-stream)
2011-11-12 03:09 UTC, _ gtzabari
Details

Note You need to log in before you can comment on or make changes to this bug.
Description _ gtzabari 2011-10-06 00:46:18 UTC
Product Version: NetBeans IDE Dev (Build 201109180600)
Java: 1.7.0; Java HotSpot(TM) 64-Bit Server VM 21.0-b17
System: Windows 7 version 6.1 running on amd64; Cp1252; en_US (nb)
User directory: C:\Users\Gili\.netbeans\dev
Cache directory: C:\Users\Gili\.netbeans\dev\var\cache

When "organize imports" is invoked, it fails to take into consideration classes referenced by Javadoc @link tags. It removes these classes (thinking they are unused), thereby breaking the Javadoc.
Comment 1 Dusan Balek 2011-10-07 09:35:24 UTC
Fixed in jet-main.

http://hg.netbeans.org/jet-main/rev/51e6e75512a1
Comment 2 Quality Engineering 2011-10-10 12:28:51 UTC
Integrated into 'main-golden'
Changeset: http://hg.netbeans.org/main-golden/rev/51e6e75512a1
User: Dusan Balek <dbalek@netbeans.org>
Log: Issue #203184: Organize imports removes classes referenced by Javadoc - fixed.
Comment 3 _ gtzabari 2011-11-12 03:07:49 UTC
This issue is back in dev build 201110050601.
Comment 4 _ gtzabari 2011-11-12 03:09:13 UTC
Created attachment 113140 [details]
Testcase

Notice how "Organize Imports" removes java.sql.DatabaseMetaData that is referenced by the Javadoc.
Comment 5 Dusan Balek 2011-11-14 10:10:33 UTC
I cannot reproduce the issue in the current dev build. Please note that fix has been integrated into main-golden on 2011-10-10. Could you please try some newer build? Thanks.
Comment 6 Anton Chechel 2012-01-24 16:47:17 UTC
I am able to reproduce it:

1. Create new Java SE Project.
2. In JavaApplication1 after package declaration line paste "import javafx." and press Alt-Enter.
3. Organize imports action removes my javadoc completely.
4. Also it removes new lines between package and class declarations.

Source:
=====
package javaapplication1;

import javafx.

/**
 *
 * @author Manowar
 */
public class JavaApplication1 {
=====

Result:
=====
package javaapplication1;
public class JavaApplication1 {
=====
Comment 7 Anton Chechel 2012-01-24 16:49:07 UTC
I am using a dev version:
Product Version: NetBeans IDE Dev (Build 20111227-ccd05eef72af)
Java: 1.6.0_27; Java HotSpot(TM) 64-Bit Server VM 20.2-b06
System: Windows 7 version 6.1 running on amd64; Cp1252; en_US (nb)
User directory: C:\Projects\netbeans\jet-main\nbbuild\testuserdir
Cache directory: C:\Projects\netbeans\jet-main\nbbuild\testuserdir\var\cache
Comment 8 Dusan Balek 2012-03-23 12:24:30 UTC
OrganizeImport hint should not appear in case of syntax error in import section.
Fixed in jet-main.

http://hg.netbeans.org/jet-main/rev/dd09d3a76393
Comment 9 Quality Engineering 2012-03-24 11:02:03 UTC
Integrated into 'main-golden', will be available in build *201203240400* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/dd09d3a76393
User: Dusan Balek <dbalek@netbeans.org>
Log: Issue #203184: Organize imports removes classes referenced by Javadoc - fixed.