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 47087 - "Fix Imports" doesn't find nested types, removes too many imports
Summary: "Fix Imports" doesn't find nested types, removes too many imports
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Unsupported (show other bugs)
Version: 4.x
Hardware: PC Linux
: P3 blocker (vote)
Assignee: Daniel Prusa
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-08-11 11:51 UTC by afreije
Modified: 2007-09-26 09:14 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description afreije 2004-08-11 11:51:55 UTC
When using generics, It is not uncommon to use a
type expression like Foo<Bar>. The "Fix Imports"
tool (Alt-Shift-F) doesn't find the nested type
Bar, causing the import of Bar to be removed.
Fix Imports is a very nice feature, but it must be
very reliable, especially since there is no Undo.

In the following example, the import of
java.util.List will be removed when using Fix Imports.

---

import java.util.List;

interface Foo<T> {
    Foo<List<?>> get();
}
Comment 1 Daniel Prusa 2004-08-11 16:28:08 UTC
Fixed.
Checking in JavaFixAllImports.java;
/cvs/editor/src/org/netbeans/modules/editor/java/JavaFixAllImports.java,v
 <--  JavaFixAllImports.java
new revision: 1.11; previous revision: 1.10
Comment 2 afreije 2004-08-14 16:20:21 UTC
This bug has been fixed only partly (Q-build 2004-08-12). Undo has
been fixed, but in the example, java.util.List is still removed by Fix
Imports. List is used in the declaration of Foo.get(), so it should
not be removed from the imports.

Initially I set this bug's subcomponent to "srcmodel" because maybe 
the nested type expressions are correctly scanned, but ignored further
on. My knowledge of NetBeans' internals are insufficient to be sure
though.

Comment 3 Daniel Prusa 2004-08-17 16:00:09 UTC
The bug is reproducible in Q-build 2004-08-12, but it is fixed in the
following dev builds (the related commit was not included into the
Q-build).
Comment 4 Quality Engineering 2007-09-20 12:12:20 UTC
Reorganization of java component