Bug 92981 - Content Assist overrides wrong method
Summary: Content Assist overrides wrong method
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.1 M7   Edit
Assignee: David Audel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-04-27 14:57 EDT by Markus Keller CLA
Modified: 2005-05-12 14:21 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 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