Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 308217 - [content assist] Override method proposal not working if '(' is typed while content assist is open
Summary: [content assist] Override method proposal not working if '(' is typed while c...
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 3.6   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 4.6 M6   Edit
Assignee: Noopur Gupta CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 312194 411483 444383 481847 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-04-06 10:58 EDT by Olivier Thomann CLA
Modified: 2016-03-11 04:05 EST (History)
7 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Olivier Thomann CLA 2010-04-06 10:58:33 EDT
Using

I got this weird problem with code completion.

1) Use the following test case:
public class X {
	static class Y {
		public boolean foo2(String s) {
			return true;
		}
		public boolean foo2(Number n) {
			return true;
		}
	}
	public static void main(String[] args) {
		Y y = new Y() {
		// code assist here
		};
	}
}


2) remove the comment with "code assist here and do Ctrl + Space at this location
3) Once you have all the completion proposals, type "foo2(N".
This leaves only foo2(Number) in the list of proposals.
Try to apply it, it won't work.
Two issues:
1) If autoinsertion of ')' is set, then the completion doesn't do anything
2) If it is disabled, then you end up with:
			public boolean foo2(Number n) {};
which doesn't compile.

If the completion is done after typing only: foo2 and selecting "foo2(Number), then it works as expected.
Comment 1 Olivier Thomann CLA 2010-04-06 10:58:54 EDT
I forgot the build id: I20100323-0800
Comment 2 Markus Keller CLA 2013-05-21 11:41:36 EDT
*** Bug 312194 has been marked as a duplicate of this bug. ***
Comment 3 Dani Megert CLA 2013-07-09 06:14:20 EDT
*** Bug 411483 has been marked as a duplicate of this bug. ***
Comment 4 Markus Keller CLA 2014-09-18 11:40:24 EDT
*** Bug 444383 has been marked as a duplicate of this bug. ***
Comment 5 Noopur Gupta CLA 2015-11-17 01:30:18 EST
*** Bug 481847 has been marked as a duplicate of this bug. ***
Comment 6 Eclipse Genie CLA 2016-03-10 07:51:31 EST
New Gerrit change created: https://git.eclipse.org/r/68144
Comment 7 Eclipse Genie CLA 2016-03-10 07:52:05 EST
New Gerrit change created: https://git.eclipse.org/r/68145
Comment 8 Noopur Gupta CLA 2016-03-10 13:03:35 EST
(In reply to Eclipse Genie from comment #6)
> New Gerrit change created: https://git.eclipse.org/r/68144
Abandoned.

(In reply to Eclipse Genie from comment #7)
> New Gerrit change created: https://git.eclipse.org/r/68145
Updated to use ICompletionListener#selectionChanged(..).
Comment 9 Markus Keller CLA 2016-03-10 15:16:01 EST
Looks good, but I didn't test it. I assume you've verified that ContentAssistProcessor#fSelectedProposal doesn't leak proposals.

Please add some explanation for the surprising code in CompilationUnitEditor, and include a link to this bug. OK to release after that.
Comment 11 Noopur Gupta CLA 2016-03-11 04:05:33 EST
Thanks, Markus.

(In reply to Markus Keller from comment #9)
> Looks good, but I didn't test it. I assume you've verified that
> ContentAssistProcessor#fSelectedProposal doesn't leak proposals.

Yes, the proposal is not stored anywhere and fSelectedProposal is set to null when content assist session ends.

> Please add some explanation for the surprising code in
> CompilationUnitEditor, and include a link to this bug. OK to release after
> that.

Done.