Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 369353

Summary: Problem with content assist when overriding a method while extending a base class anonymously
Product: [Eclipse Project] JDT Reporter: Mauro Molinari <mauromol>
Component: CoreAssignee: Ayushman Jain <amj87.iitr>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: amj87.iitr
Version: 3.7.1   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard: stalebug

Description Mauro Molinari CLA 2012-01-23 01:57:54 EST
Build Identifier: M20110909-1335

In some circumstances, missing types are not automatically imported and this makes code assist fail when trying to anonymously ovverride a class and override one of its methods.

Reproducible: Always

Steps to Reproduce:
1. Consider the following classes:

package test3;

public class OtherClass1
{
}

---

package test3;

public class OtherClass2
{
}

2. now consider the following:

package test2;

public class BaseClass<T>
{
	public void baseMethod(T param)
	{
	}
}

3. then write this:
package test2;

public class Test
{
	private void myMethod()
	{
		final ThirdClass tc = new ThirdClass();
		tc.thirdMethod(|
	}
}

4. go to "|" and type: new BC| <= invoke code assist
5. choose BaseClass()
6. the following will be added: "new BaseClass<OtherClass1>()"; please note that OtherClass1 has not been imported and is underlined
7. go after "new BaseClass<OtherClass1>()", add an opening "{" and a closing "}", then put the cursor between them and hit "return", so that you have:

tc.thirdMethod(new BaseClass<OtherClass1>(){
  |
}

8. when at "|" hit ctrl+space and choose to override baseMethod; you get:

tc.thirdMethod(new BaseClass<OtherClass1>(){
	public void baseMethod(OtherClass1 param) {};
}

instead of:

tc.thirdMethod(new BaseClass<OtherClass1>(){
	@Override
	public void baseMethod(OtherClass1 param)
	{
	  // TODO Stub di metodo generato automaticamente
	  super.baseMethod(param);
	}
}
Comment 1 Ayushman Jain CLA 2012-01-23 02:03:51 EST
Will investigate, time permitting.
Comment 2 Eclipse Genie CLA 2019-09-13 11:56:48 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.