Bug 71763 - [imports on paste] should check for copied inner types
Summary: [imports on paste] should check for copied inner types
Status: ASSIGNED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.0   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
: 83828 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-08-11 06:06 EDT by Max Gilead CLA
Modified: 2023-03-28 11:31 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Max Gilead CLA 2004-08-11 06:06:06 EDT
Consider these two files:

OuterClass1.java:

public class OuterClass1
	{
	private class InnerClass {}
	private void foo() { new InnerClass(); }
	}

OuterClass2.java:

public class OuterClass2
	{
	}


After pasting two lines from OuterClass1 into OuterClass2 the resulting
OuterClass2 is:

import OuterClass1.InnerClass;

public class OuterClass2
	{
	private class InnerClass {}
	private void foo() { new InnerClass(); }
	}

while the expected result (we're pasting InnerClass too!) should be:

public class OuterClass2
	{
	private class InnerClass {}
	private void foo() { new InnerClass(); }
	}

I understand that Eclipse tries to make sure the code refrences the same class
but it should detect that code for InnerClass is pasted as well and thus the
author most probably wants it to use local OuterClass2.InnerClass class instead
of OuterClass1.InnerClass
Comment 1 Martin Aeschlimann CLA 2005-05-22 16:41:11 EDT
*** Bug 83828 has been marked as a duplicate of this bug. ***
Comment 2 Robin Green CLA 2005-07-25 13:49:25 EDT
In addition, the import statement is bogus code in the first place. You can't
import a member type (at least, eclipse gives me an error if I try).
Comment 3 Martin Aeschlimann CLA 2005-07-26 04:08:55 EDT
You can import a member type, as long as it not inside a private outer type.

e.g. import java.util.Map.Entry;
Comment 4 Eclipse Genie CLA 2019-03-31 14:19:33 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 5 Dani Megert CLA 2019-04-02 10:06:51 EDT
Still a bug in 4.11.
Comment 6 Eclipse Genie CLA 2021-03-23 10:19:25 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 7 Eclipse Genie CLA 2023-03-28 11:31:55 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.