Bug 92981

Summary: Content Assist overrides wrong method
Product: [Eclipse Project] JDT Reporter: Markus Keller <markus.kell.r>
Component: CoreAssignee: David Audel <david_audel>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: eclipse, tobias_widmer
Version: 3.1   
Target Milestone: 3.1 M7   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Markus Keller CLA 2005-04-27 14:57:08 EDT
I20050426-1700

abstract class Top {
	abstract int getCount();
}

class Impl extends Top {
	final int getCount() {
		return 1;
	}
}

class Sub extends Impl {
	get//Ctrl+Space inserts:
//	@Override
//	protected void finalize() throws Throwable {
//		// TODO Auto-generated method stub
//		super.finalize();
//	}
}

I have auto-insertion of single proposals enabled.
The 'getCount()' proposal says "override method in Top".
Comment 1 Dani Megert CLA 2005-04-28 04:44:55 EDT
Tom, please investigate.
Comment 2 Tom Hofmann CLA 2005-04-28 05:17:23 EDT
The problem is twofold:

- the override proposal for the final method 'getCount' should not be proposed
in the first place.

- OverrideCompletionProposal.updateReplacementString detects that there are no
valid override candidates, but simply chooses an arbitrary overridable candidate
that does not match the proposal (finalize in this case).

Moving to core for the first problem. Adding Tobias for the second.
Comment 3 Frederic Fusier CLA 2005-04-28 05:32:25 EDT
Perhaps it should be interesting to open a separated bug for JDT/UI issue.
This would clarify things to know when these 2 different issues were fixed...
Comment 4 Tom Hofmann CLA 2005-04-28 05:35:31 EDT
done, see bug 93086
Comment 5 David Audel CLA 2005-04-28 07:14:38 EDT
Fixed first problem and test added
  CompletionTests#testCompletionMethodDeclaration12()
Comment 6 Olivier Thomann CLA 2005-05-12 14:21:09 EDT
Verified in I20050510-0010 + JDT/Core v_556