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 37939 - [IMT] Import Management Tool doesn't handle duplicate class names automatically
Summary: [IMT] Import Management Tool doesn't handle duplicate class names automatically
Status: RESOLVED WONTFIX
Alias: None
Product: java
Classification: Unclassified
Component: Unsupported (show other bugs)
Version: 3.x
Hardware: PC Windows ME/2000
: P3 blocker (vote)
Assignee: issues@java
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-12-09 21:55 UTC by zacjacobson
Modified: 2007-09-26 09:14 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
source that breaks when IMT is run on ItemUser.java (1.14 KB, application/octet-stream)
2004-03-15 18:00 UTC, zacjacobson
Details

Note You need to log in before you can comment on or make changes to this bug.
Description zacjacobson 2003-12-09 21:55:07 UTC
Suppose we have a couple classes:

a.Item
persistant.Item
persistant.ItemUser

If ItemUser needs to use a.Item for anything but
doesn't use persistant.Item, that class (a.Item)
is referred to by FQN. 

Running the IMT under its default settings will
(if it's used the limit number of times of course)
change the code so that the Item in the local
package is used instead - the import statement is
not created for a.Item, because there's a class of
that name is in the local package.

Shouldn't the import statement be created, or that
same-name class be left as FQN by default? IMT
breaks the code otherwise.
Comment 1 Jan Pokorsky 2004-03-10 17:58:10 UTC
Try to place the cursor on Item in editor and use alt+shift+i. It is
probably what you are looking for.
Comment 2 zacjacobson 2004-03-10 18:15:03 UTC
I'm not looking for a shortcut to create import statements.

I am looking for the import management tool (IMT) to not break my code
when there are same-named classes in different packages.
Comment 3 Jan Pokorsky 2004-03-10 18:48:12 UTC
Could you show on some example of persistant.ItemUser how it breaks
your code, please? I tried you class layout mentioned previously and
it works for me.
Comment 4 zacjacobson 2004-03-15 18:00:31 UTC
Created attachment 13988 [details]
source that breaks when IMT is run on ItemUser.java
Comment 5 zacjacobson 2004-03-15 18:07:50 UTC
I have attached some example code.

IMT breaks the code, though in a slightly different manner than I
described originally - it DOES add the import statement for the
extra-package class, and it's this which breaks all usage of the
package-local class of the same name.
Comment 6 Jan Becicka 2004-06-18 13:59:33 UTC
Closing, Import Management Tools was replaced by Fix Import functionality.