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 228172 - import statement refactoring broken
Summary: import statement refactoring broken
Status: RESOLVED DUPLICATE of bug 200742
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 7.3
Hardware: PC Windows 7 x64
: P3 normal (vote)
Assignee: Jan Lahoda
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-04-02 17:21 UTC by gnomed
Modified: 2013-04-03 17:38 UTC (History)
1 user (show)

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 gnomed 2013-04-02 17:21:17 UTC
When refactoring an import statement, the new "refactored" line is inserted into the middle of the old line without deleting the old line, resulting in a completely useless/nonsensical import statement.

for example, lets say I have a line:
"import com.test.hello.Greeting;"

Now lets say I changed the package of the "Greeting" class to be in "com.test.hello.sir".

This sounds contrived, but it happens (for example I am working with generated code and changed the packages I generate it to).

So in netbeans it will highlight the bad import statement and offer to change it to the correct import statement (the suggestion in the context menu appears correct). However when I click to have it do this, it puts the new package name in the middle of the old one for some reason.

So the result is:

"import com.test.hello.sir.Greeting.test.hello.Greeting;"

The old import statement piece that is tacked on at the end will consistently contain everything except the beginning package in the statement, regardless of carat position at the time of refactoring.
Comment 1 Jan Lahoda 2013-04-03 17:38:36 UTC
Already reported as bug #200742, thanks for the report anyway.

*** This bug has been marked as a duplicate of bug 200742 ***