Bug 243670 - [quick fix] Bad variable type and import in QuickFix for inner types from default package
Summary: [quick fix] Bad variable type and import in QuickFix for inner types from def...
Status: ASSIGNED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.4   Edit
Hardware: PC Windows XP
: P5 minor (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2008-08-09 14:33 EDT by Tomasz Nurkiewicz CLA
Modified: 2022-08-29 10:17 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tomasz Nurkiewicz CLA 2008-08-09 14:33:23 EDT
Build ID: I20080617-2000

Steps To Reproduce:
1. Create class with inner class in it:
class A {
	class B {}
}
2. Create an instance of A class and assign to variable: A a = new A();
3. Create an instance of B class: a.new B();
4. Use QuickFix or Ctrl+2 to assign newly created object to variable.
5. Eclipse produces inapriopriate "B b = " instead of "A.B b = " and invalid import "import A.B"


More information:
Same thing happens when creating local variable or field, using QuickFix and Ctrl+2 as well. Solution should be tested also for inner classes inside inner class (like A.B.C c = b.new C())
Comment 1 Olivier Thomann CLA 2008-08-11 08:38:28 EDT
Move to JDT/UI
Comment 2 Dani Megert CLA 2008-08-11 09:47:07 EDT
This works for me using R3.4 and 3.5 M1: it adds the expected import only if needed.

If you still see this please provide more detailed steps.
Comment 3 Markus Keller CLA 2008-08-11 10:46:44 EDT
I can reproduce in 3.5M1, but only with A.java in the default package.
See also bug 230300.
Comment 4 Dani Megert CLA 2008-08-11 11:06:56 EDT
Please provide exact test case.
Comment 5 Dani Megert CLA 2008-08-11 11:07:32 EDT
==>

public class A {
	class B {
	}
}

public class C {
	void foo() {
		A a = new A();
		a.new B();
	}

}
Comment 6 Eclipse Genie CLA 2020-08-16 14:02:24 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 2022-08-29 10:17:06 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.