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 203870 - Updating imports after pasting code does not include static imports
Summary: Updating imports after pasting code does not include static imports
Status: NEW
Alias: None
Product: java
Classification: Unclassified
Component: Editor (show other bugs)
Version: 7.1
Hardware: Macintosh Mac OS X
: P3 normal (vote)
Assignee: Dusan Balek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-18 05:10 UTC by dbell
Modified: 2013-09-02 14:20 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description dbell 2011-10-18 05:10:43 UTC
[ BUILD # : 201110140600 ]
[ JDK VERSION : 1.6.26 ]

When pasting code in the editor that has been copied from another compilation
unit, editor prompts to add imports to fix references that are not available in
the new context. While this works for types, it does not work for methods
referenced via static imports.

To Reproduce:

From the following class:

import org.junit.Test;
import static org.junit.Assert.*;

public class MyTest {

    [@Test
    public void shouldDoSomethingWhenSomethingHappens() {
        assertTrue(true);
    }]
}

copy the text surrounded by the square brackets. Paste the code into the
following class:

public class MyImportlessTest {
    //paste the text here
}


Expected Behaviour:

Ideally, the editor would prompt user to add an import for org.junit.Test, and
also a static import for org.junit.Assert.assertTrue.


Observed Behaviour:

Only the type import is suggested (org.junit.Test)